Skip to content

Commit 745a8b9

Browse files
committed
Add WithOptionalCodeBlock trait and adopt it where there's a body
1 parent 3914c0b commit 745a8b9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ public let DECL_NODES: [Node] = [
8282
base: .decl,
8383
nameForDiagnostics: "accessor",
8484
parserFunction: "parseAccessorDecl",
85-
traits: ["WithAttributes"],
85+
traits: [
86+
"WithOptionalCodeBlock",
87+
"WithAttributes",
88+
],
8689
children: [
8790
Child(
8891
name: "attributes",
@@ -493,6 +496,7 @@ public let DECL_NODES: [Node] = [
493496
traits: [
494497
"WithAttributes",
495498
"WithModifiers",
499+
"WithOptionalCodeBlock",
496500
],
497501
children: [
498502
Child(
@@ -879,6 +883,7 @@ public let DECL_NODES: [Node] = [
879883
"WithAttributes",
880884
"WithGenericParameters",
881885
"WithModifiers",
886+
"WithOptionalCodeBlock",
882887
],
883888
children: [
884889
Child(
@@ -1217,6 +1222,7 @@ public let DECL_NODES: [Node] = [
12171222
"WithAttributes",
12181223
"WithGenericParameters",
12191224
"WithModifiers",
1225+
"WithOptionalCodeBlock",
12201226
],
12211227
children: [
12221228
Child(

CodeGeneration/Sources/SyntaxSupport/Traits.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ public let TRAITS: [Trait] = [
151151
Child(name: "modifiers", kind: .node(kind: .declModifierList))
152152
]
153153
),
154+
Trait(
155+
traitName: "WithOptionalCodeBlock",
156+
children: [
157+
Child(name: "body", kind: .node(kind: .codeBlock), isOptional: true)
158+
]
159+
),
154160
Trait(
155161
traitName: "WithStatements",
156162
children: [

0 commit comments

Comments
 (0)