Skip to content

Commit 53e1a9e

Browse files
committed
Update file headers and more _asConcreteType to Misc.swift
1 parent d785cc5 commit 53e1a9e

File tree

8 files changed

+492
-488
lines changed

8 files changed

+492
-488
lines changed

Sources/SwiftSyntax/Misc.swift.gyb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}%
88
//// Automatically Generated From SyntaxNodes.swift.gyb.
99
//// Do Not Edit Directly!
10-
//===------------ SyntaxNodes.swift - Syntax Node definitions -------------===//
10+
//===---------- Misc.swift - Miscelaneous SwiftSyntax definitions ---------===//
1111
//
1212
// This source file is part of the Swift.org open source project
1313
//
@@ -39,6 +39,23 @@ extension SyntaxNode {
3939
% end
4040
}
4141

42+
public extension Syntax {
43+
/// Retrieve the concretely typed node that this Syntax node wraps.
44+
/// This property is exposed for testing purposes only.
45+
var _asConcreteType: Any {
46+
switch self.asSyntaxEnum {
47+
case .token(let node):
48+
return node
49+
case .unknown(let node):
50+
return node
51+
% for node in SYNTAX_NODES:
52+
case .${node.swift_syntax_kind}(let node):
53+
return node
54+
% end
55+
}
56+
}
57+
}
58+
4259
extension SyntaxParser {
4360
static func verifyNodeDeclarationHash() -> Bool {
4461
return String(cString: swiftparse_syntax_structure_versioning_identifier()!) ==

Sources/SwiftSyntax/SyntaxBaseNodes.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
}%
88
//// Automatically Generated From SyntaxNodes.swift.gyb.
99
//// Do Not Edit Directly!
10-
//===------------ SyntaxNodes.swift - Syntax Node definitions -------------===//
10+
//===---------- SyntaxBaseNodes.swift - Syntax Node definitions -----------===//
1111
//
1212
// This source file is part of the Swift.org open source project
1313
//
14-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
14+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
1515
// Licensed under Apache License v2.0 with Runtime Library Exception
1616
//
1717
// See https://swift.org/LICENSE.txt for license information

Sources/SwiftSyntax/SyntaxEnum.swift.gyb

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}%
88
//// Automatically Generated From SyntaxNodes.swift.gyb.
99
//// Do Not Edit Directly!
10-
//===------------ SyntaxNodes.swift - Syntax Node definitions -------------===//
10+
//===--- SyntaxEnum.swift - Enum for exhaustive Syntax node switching -----===//
1111
//
1212
// This source file is part of the Swift.org open source project
1313
//
@@ -47,21 +47,6 @@ public extension Syntax {
4747
% else:
4848
return .${node.swift_syntax_kind}(${node.name}(self)!)
4949
% end
50-
% end
51-
}
52-
}
53-
54-
/// Retrieve the concretely typed node that this Syntax node wraps.
55-
/// This property is exposed for testing purposes only.
56-
var _asConcreteType: Any {
57-
switch self.asSyntaxEnum {
58-
case .token(let node):
59-
return node
60-
case .unknown(let node):
61-
return node
62-
% for node in SYNTAX_NODES:
63-
case .${node.swift_syntax_kind}(let node):
64-
return node
6550
% end
6651
}
6752
}

Sources/SwiftSyntax/SyntaxTraits.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}%
88
//// Automatically Generated From SyntaxNodes.swift.gyb.
99
//// Do Not Edit Directly!
10-
//===------------ SyntaxNodes.swift - Syntax Node definitions -------------===//
10+
//===----------- SyntaxTraits.swift - Traits for syntax nodes -------------===//
1111
//
1212
// This source file is part of the Swift.org open source project
1313
//

0 commit comments

Comments
 (0)