@@ -23,20 +23,6 @@ public protocol DeclGroupSyntax: SyntaxProtocol {
2323 func withMembers( _ newChild: MemberDeclBlockSyntax ? ) -> Self
2424}
2525
26- public extension SyntaxProtocol {
27- /// Check whether the non-type erased version of this syntax node conforms to
28- /// `DeclGroupSyntax`.
29- func `is`( _: DeclGroupSyntax . Protocol ) -> Bool {
30- return self . as ( DeclGroupSyntax . self) != nil
31- }
32-
33- /// Return the non-type erased version of this syntax node if it conforms to
34- /// `DeclGroupSyntax`. Otherwise return `nil`.
35- func `as`( _: DeclGroupSyntax . Protocol ) -> DeclGroupSyntax ? {
36- return Syntax ( self ) . as ( SyntaxProtocol . self) as? DeclGroupSyntax
37- }
38- }
39-
4026// MARK: - BracedSyntax
4127
4228public protocol BracedSyntax : SyntaxProtocol {
@@ -46,62 +32,20 @@ public protocol BracedSyntax: SyntaxProtocol {
4632 func withRightBrace( _ newChild: TokenSyntax ? ) -> Self
4733}
4834
49- public extension SyntaxProtocol {
50- /// Check whether the non-type erased version of this syntax node conforms to
51- /// `BracedSyntax`.
52- func `is`( _: BracedSyntax . Protocol ) -> Bool {
53- return self . as ( BracedSyntax . self) != nil
54- }
55-
56- /// Return the non-type erased version of this syntax node if it conforms to
57- /// `BracedSyntax`. Otherwise return `nil`.
58- func `as`( _: BracedSyntax . Protocol ) -> BracedSyntax ? {
59- return Syntax ( self ) . as ( SyntaxProtocol . self) as? BracedSyntax
60- }
61- }
62-
6335// MARK: - IdentifiedDeclSyntax
6436
6537public protocol IdentifiedDeclSyntax : SyntaxProtocol {
6638 var identifier : TokenSyntax { get }
6739 func withIdentifier( _ newChild: TokenSyntax ? ) -> Self
6840}
6941
70- public extension SyntaxProtocol {
71- /// Check whether the non-type erased version of this syntax node conforms to
72- /// `IdentifiedDeclSyntax`.
73- func `is`( _: IdentifiedDeclSyntax . Protocol ) -> Bool {
74- return self . as ( IdentifiedDeclSyntax . self) != nil
75- }
76-
77- /// Return the non-type erased version of this syntax node if it conforms to
78- /// `IdentifiedDeclSyntax`. Otherwise return `nil`.
79- func `as`( _: IdentifiedDeclSyntax . Protocol ) -> IdentifiedDeclSyntax ? {
80- return Syntax ( self ) . as ( SyntaxProtocol . self) as? IdentifiedDeclSyntax
81- }
82- }
83-
8442// MARK: - WithCodeBlockSyntax
8543
8644public protocol WithCodeBlockSyntax : SyntaxProtocol {
8745 var body : CodeBlockSyntax { get }
8846 func withBody( _ newChild: CodeBlockSyntax ? ) -> Self
8947}
9048
91- public extension SyntaxProtocol {
92- /// Check whether the non-type erased version of this syntax node conforms to
93- /// `WithCodeBlockSyntax`.
94- func `is`( _: WithCodeBlockSyntax . Protocol ) -> Bool {
95- return self . as ( WithCodeBlockSyntax . self) != nil
96- }
97-
98- /// Return the non-type erased version of this syntax node if it conforms to
99- /// `WithCodeBlockSyntax`. Otherwise return `nil`.
100- func `as`( _: WithCodeBlockSyntax . Protocol ) -> WithCodeBlockSyntax ? {
101- return Syntax ( self ) . as ( SyntaxProtocol . self) as? WithCodeBlockSyntax
102- }
103- }
104-
10549// MARK: - ParenthesizedSyntax
10650
10751public protocol ParenthesizedSyntax : SyntaxProtocol {
@@ -111,41 +55,13 @@ public protocol ParenthesizedSyntax: SyntaxProtocol {
11155 func withRightParen( _ newChild: TokenSyntax ? ) -> Self
11256}
11357
114- public extension SyntaxProtocol {
115- /// Check whether the non-type erased version of this syntax node conforms to
116- /// `ParenthesizedSyntax`.
117- func `is`( _: ParenthesizedSyntax . Protocol ) -> Bool {
118- return self . as ( ParenthesizedSyntax . self) != nil
119- }
120-
121- /// Return the non-type erased version of this syntax node if it conforms to
122- /// `ParenthesizedSyntax`. Otherwise return `nil`.
123- func `as`( _: ParenthesizedSyntax . Protocol ) -> ParenthesizedSyntax ? {
124- return Syntax ( self ) . as ( SyntaxProtocol . self) as? ParenthesizedSyntax
125- }
126- }
127-
12858// MARK: - WithTrailingCommaSyntax
12959
13060public protocol WithTrailingCommaSyntax : SyntaxProtocol {
13161 var trailingComma : TokenSyntax ? { get }
13262 func withTrailingComma( _ newChild: TokenSyntax ? ) -> Self
13363}
13464
135- public extension SyntaxProtocol {
136- /// Check whether the non-type erased version of this syntax node conforms to
137- /// `WithTrailingCommaSyntax`.
138- func `is`( _: WithTrailingCommaSyntax . Protocol ) -> Bool {
139- return self . as ( WithTrailingCommaSyntax . self) != nil
140- }
141-
142- /// Return the non-type erased version of this syntax node if it conforms to
143- /// `WithTrailingCommaSyntax`. Otherwise return `nil`.
144- func `as`( _: WithTrailingCommaSyntax . Protocol ) -> WithTrailingCommaSyntax ? {
145- return Syntax ( self ) . as ( SyntaxProtocol . self) as? WithTrailingCommaSyntax
146- }
147- }
148-
14965// MARK: - LabeledSyntax
15066
15167public protocol LabeledSyntax : SyntaxProtocol {
@@ -155,41 +71,13 @@ public protocol LabeledSyntax: SyntaxProtocol {
15571 func withLabelColon( _ newChild: TokenSyntax ? ) -> Self
15672}
15773
158- public extension SyntaxProtocol {
159- /// Check whether the non-type erased version of this syntax node conforms to
160- /// `LabeledSyntax`.
161- func `is`( _: LabeledSyntax . Protocol ) -> Bool {
162- return self . as ( LabeledSyntax . self) != nil
163- }
164-
165- /// Return the non-type erased version of this syntax node if it conforms to
166- /// `LabeledSyntax`. Otherwise return `nil`.
167- func `as`( _: LabeledSyntax . Protocol ) -> LabeledSyntax ? {
168- return Syntax ( self ) . as ( SyntaxProtocol . self) as? LabeledSyntax
169- }
170- }
171-
17274// MARK: - WithStatementsSyntax
17375
17476public protocol WithStatementsSyntax : SyntaxProtocol {
17577 var statements : CodeBlockItemListSyntax { get }
17678 func withStatements( _ newChild: CodeBlockItemListSyntax ? ) -> Self
17779}
17880
179- public extension SyntaxProtocol {
180- /// Check whether the non-type erased version of this syntax node conforms to
181- /// `WithStatementsSyntax`.
182- func `is`( _: WithStatementsSyntax . Protocol ) -> Bool {
183- return self . as ( WithStatementsSyntax . self) != nil
184- }
185-
186- /// Return the non-type erased version of this syntax node if it conforms to
187- /// `WithStatementsSyntax`. Otherwise return `nil`.
188- func `as`( _: WithStatementsSyntax . Protocol ) -> WithStatementsSyntax ? {
189- return Syntax ( self ) . as ( SyntaxProtocol . self) as? WithStatementsSyntax
190- }
191- }
192-
19381
19482extension CodeBlockSyntax : BracedSyntax , WithStatementsSyntax { }
19583extension DeclNameArgumentsSyntax : ParenthesizedSyntax { }
0 commit comments