Skip to content

Commit 5768213

Browse files
committed
Regenerate sources
1 parent 8caa4a7 commit 5768213

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

CodeGeneration/Sources/SyntaxSupport/gyb_generated/DeclNodes.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,9 @@ public let DECL_NODES: [Node] = [
16351635
Node(name: "MacroExpansionDecl",
16361636
nameForDiagnostics: "pound literal declaration",
16371637
kind: "Decl",
1638+
traits: [
1639+
"FreestandingMacroExpansion"
1640+
],
16381641
children: [
16391642
Child(name: "PoundToken",
16401643
kind: "PoundToken",

CodeGeneration/Sources/SyntaxSupport/gyb_generated/ExprNodes.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,9 @@ public let EXPR_NODES: [Node] = [
11861186
Node(name: "MacroExpansionExpr",
11871187
nameForDiagnostics: "pound literal expression",
11881188
kind: "Expr",
1189+
traits: [
1190+
"FreestandingMacroExpansion"
1191+
],
11891192
children: [
11901193
Child(name: "PoundToken",
11911194
kind: "PoundToken",

CodeGeneration/Sources/SyntaxSupport/gyb_generated/Traits.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ public let TRAITS: [Trait] = [
5959
Child(name: "RightParen", kind: "RightParenToken"),
6060
]
6161
),
62+
Trait(traitName: "FreestandingMacroExpansion",
63+
children: [
64+
Child(name: "PoundToken", kind: "PoundToken"),
65+
Child(name: "Macro", kind: "IdentifierToken"),
66+
Child(name: "GenericArguments", kind: "GenericArgumentClause", isOptional: true),
67+
Child(name: "LeftParen", kind: "LeftParenToken", isOptional: true),
68+
Child(name: "ArgumentList", kind: "TupleExprElementList"),
69+
Child(name: "RightParen", kind: "RightParenToken", isOptional: true),
70+
Child(name: "TrailingClosure", kind: "ClosureExpr", isOptional: true),
71+
Child(name: "AdditionalTrailingClosures", kind: "MultipleTrailingClosureElementList", isOptional: true),
72+
]
73+
),
6274
Trait(traitName: "WithTrailingComma",
6375
children: [
6476
Child(name: "TrailingComma", kind: "CommaToken", isOptional: true),

Sources/SwiftSyntax/Documentation.docc/gyb_generated/SwiftSyntax.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
433433
- <doc:SwiftSyntax/IdentifiedDeclSyntax>
434434
- <doc:SwiftSyntax/WithCodeBlockSyntax>
435435
- <doc:SwiftSyntax/ParenthesizedSyntax>
436+
- <doc:SwiftSyntax/FreestandingMacroExpansionSyntax>
436437
- <doc:SwiftSyntax/WithTrailingCommaSyntax>
437438
- <doc:SwiftSyntax/WithStatementsSyntax>
438439

Sources/SwiftSyntax/generated/SyntaxTraits.swift

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,74 @@ public extension SyntaxProtocol {
180180
}
181181
}
182182

183+
// MARK: - FreestandingMacroExpansionSyntax
184+
185+
public protocol FreestandingMacroExpansionSyntax: SyntaxProtocol {
186+
var poundToken: TokenSyntax {
187+
get
188+
}
189+
190+
func withPoundToken(_ newChild: TokenSyntax) -> Self
191+
192+
var macro: TokenSyntax {
193+
get
194+
}
195+
196+
func withMacro(_ newChild: TokenSyntax) -> Self
197+
198+
var genericArguments: GenericArgumentClauseSyntax? {
199+
get
200+
}
201+
202+
func withGenericArguments(_ newChild: GenericArgumentClauseSyntax?) -> Self
203+
204+
var leftParen: TokenSyntax? {
205+
get
206+
}
207+
208+
func withLeftParen(_ newChild: TokenSyntax?) -> Self
209+
210+
var argumentList: TupleExprElementListSyntax {
211+
get
212+
}
213+
214+
func withArgumentList(_ newChild: TupleExprElementListSyntax) -> Self
215+
216+
var rightParen: TokenSyntax? {
217+
get
218+
}
219+
220+
func withRightParen(_ newChild: TokenSyntax?) -> Self
221+
222+
var trailingClosure: ClosureExprSyntax? {
223+
get
224+
}
225+
226+
func withTrailingClosure(_ newChild: ClosureExprSyntax?) -> Self
227+
228+
var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? {
229+
get
230+
}
231+
232+
func withAdditionalTrailingClosures(_ newChild: MultipleTrailingClosureElementListSyntax?) -> Self
233+
}
234+
235+
public extension SyntaxProtocol {
236+
/// Check whether the non-type erased version of this syntax node conforms to
237+
/// `FreestandingMacroExpansionSyntax`.
238+
/// Note that this will incur an existential conversion.
239+
func isProtocol(_: FreestandingMacroExpansionSyntax.Protocol) -> Bool {
240+
return self.asProtocol(FreestandingMacroExpansionSyntax.self) != nil
241+
}
242+
243+
/// Return the non-type erased version of this syntax node if it conforms to
244+
/// `FreestandingMacroExpansionSyntax`. Otherwise return `nil`.
245+
/// Note that this will incur an existential conversion.
246+
func asProtocol(_: FreestandingMacroExpansionSyntax.Protocol) -> FreestandingMacroExpansionSyntax? {
247+
return Syntax(self).asProtocol(SyntaxProtocol.self) as? FreestandingMacroExpansionSyntax
248+
}
249+
}
250+
183251
// MARK: - WithTrailingCommaSyntax
184252

185253
public protocol WithTrailingCommaSyntax: SyntaxProtocol {
@@ -364,6 +432,12 @@ extension LabeledSpecializeEntrySyntax: WithTrailingCommaSyntax {
364432
extension MacroDeclSyntax: IdentifiedDeclSyntax, AttributedSyntax {
365433
}
366434

435+
extension MacroExpansionDeclSyntax: FreestandingMacroExpansionSyntax {
436+
}
437+
438+
extension MacroExpansionExprSyntax: FreestandingMacroExpansionSyntax {
439+
}
440+
367441
extension MemberDeclBlockSyntax: BracedSyntax {
368442
}
369443

0 commit comments

Comments
 (0)