Skip to content

Commit 227b0d6

Browse files
committed
Rename traits 'Attributed' to 'WithAttributes', introduce 'WithModifiers'
(cherry picked from commit 992a9da)
1 parent 8b4d93c commit 227b0d6

File tree

10 files changed

+171
-101
lines changed

10 files changed

+171
-101
lines changed

CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ public let COMMON_NODES: [Node] = [
147147
description: "In case the source code is missing a declaration, this node stands in place of the missing declaration.",
148148
kind: "Decl",
149149
traits: [
150-
"Attributed"
150+
"WithAttributes",
151+
"WithModifiers",
151152
],
152153
children: [
153154
Child(

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public let DECL_NODES: [Node] = [
6868
nameForDiagnostics: "accessor",
6969
kind: "Decl",
7070
traits: [
71-
"Attributed"
71+
"WithAttributes"
7272
],
7373
parserFunction: "parseAccessorDecl",
7474
children: [
@@ -154,7 +154,8 @@ public let DECL_NODES: [Node] = [
154154
traits: [
155155
"DeclGroup",
156156
"IdentifiedDecl",
157-
"Attributed",
157+
"WithAttributes",
158+
"WithModifiers",
158159
],
159160
children: [
160161
Child(
@@ -213,7 +214,8 @@ public let DECL_NODES: [Node] = [
213214
kind: "Decl",
214215
traits: [
215216
"IdentifiedDecl",
216-
"Attributed",
217+
"WithAttributes",
218+
"WithModifiers",
217219
],
218220
children: [
219221
Child(
@@ -270,7 +272,8 @@ public let DECL_NODES: [Node] = [
270272
traits: [
271273
"DeclGroup",
272274
"IdentifiedDecl",
273-
"Attributed",
275+
"WithAttributes",
276+
"WithModifiers",
274277
],
275278
children: [
276279
Child(
@@ -401,7 +404,8 @@ public let DECL_NODES: [Node] = [
401404
nameForDiagnostics: "deinitializer",
402405
kind: "Decl",
403406
traits: [
404-
"Attributed"
407+
"WithAttributes",
408+
"WithModifiers",
405409
],
406410
children: [
407411
Child(
@@ -505,7 +509,8 @@ public let DECL_NODES: [Node] = [
505509
nameForDiagnostics: "parameter",
506510
kind: "Syntax",
507511
traits: [
508-
"WithTrailingComma"
512+
"WithTrailingComma",
513+
"WithModifiers",
509514
],
510515
parserFunction: "parseEnumCaseParameter",
511516
children: [
@@ -559,7 +564,8 @@ public let DECL_NODES: [Node] = [
559564
description: "A `case` declaration of a Swift `enum`. It can have 1 or more `EnumCaseElement`s inside, each declaring a different case of the enum.",
560565
kind: "Decl",
561566
traits: [
562-
"Attributed"
567+
"WithAttributes",
568+
"WithModifiers",
563569
],
564570
children: [
565571
Child(
@@ -642,7 +648,8 @@ public let DECL_NODES: [Node] = [
642648
traits: [
643649
"DeclGroup",
644650
"IdentifiedDecl",
645-
"Attributed",
651+
"WithAttributes",
652+
"WithModifiers",
646653
],
647654
children: [
648655
Child(
@@ -710,7 +717,8 @@ public let DECL_NODES: [Node] = [
710717
kind: "Decl",
711718
traits: [
712719
"DeclGroup",
713-
"Attributed",
720+
"WithAttributes",
721+
"WithModifiers",
714722
],
715723
children: [
716724
Child(
@@ -758,7 +766,8 @@ public let DECL_NODES: [Node] = [
758766
kind: "Decl",
759767
traits: [
760768
"IdentifiedDecl",
761-
"Attributed",
769+
"WithAttributes",
770+
"WithModifiers",
762771
],
763772
children: [
764773
Child(
@@ -822,7 +831,8 @@ public let DECL_NODES: [Node] = [
822831
kind: "Syntax",
823832
traits: [
824833
"WithTrailingComma",
825-
"Attributed",
834+
"WithAttributes",
835+
"WithModifiers",
826836
],
827837
parserFunction: "parseFunctionParameter",
828838
children: [
@@ -983,7 +993,8 @@ public let DECL_NODES: [Node] = [
983993
nameForDiagnostics: "import",
984994
kind: "Decl",
985995
traits: [
986-
"Attributed"
996+
"WithAttributes",
997+
"WithModifiers",
987998
],
988999
children: [
9891000
Child(
@@ -1073,7 +1084,8 @@ public let DECL_NODES: [Node] = [
10731084
""",
10741085
kind: "Decl",
10751086
traits: [
1076-
"Attributed"
1087+
"WithAttributes",
1088+
"WithModifiers",
10771089
],
10781090
children: [
10791091
Child(
@@ -1136,7 +1148,8 @@ public let DECL_NODES: [Node] = [
11361148
kind: "Decl",
11371149
traits: [
11381150
"IdentifiedDecl",
1139-
"Attributed",
1151+
"WithAttributes",
1152+
"WithModifiers",
11401153
],
11411154
children: [
11421155
Child(
@@ -1191,7 +1204,9 @@ public let DECL_NODES: [Node] = [
11911204
nameForDiagnostics: "macro expansion",
11921205
kind: "Decl",
11931206
traits: [
1194-
"FreestandingMacroExpansion"
1207+
"FreestandingMacroExpansion",
1208+
"WithAttributes",
1209+
"WithModifiers",
11951210
],
11961211
children: [
11971212
Child(
@@ -1343,7 +1358,8 @@ public let DECL_NODES: [Node] = [
13431358
kind: "Decl",
13441359
traits: [
13451360
"IdentifiedDecl",
1346-
"Attributed",
1361+
"WithAttributes",
1362+
"WithModifiers",
13471363
],
13481364
children: [
13491365
Child(
@@ -1619,7 +1635,8 @@ public let DECL_NODES: [Node] = [
16191635
kind: "Decl",
16201636
traits: [
16211637
"IdentifiedDecl",
1622-
"Attributed",
1638+
"WithAttributes",
1639+
"WithModifiers",
16231640
],
16241641
children: [
16251642
Child(
@@ -1721,7 +1738,8 @@ public let DECL_NODES: [Node] = [
17211738
traits: [
17221739
"DeclGroup",
17231740
"IdentifiedDecl",
1724-
"Attributed",
1741+
"WithAttributes",
1742+
"WithModifiers",
17251743
],
17261744
children: [
17271745
Child(
@@ -1823,7 +1841,8 @@ public let DECL_NODES: [Node] = [
18231841
traits: [
18241842
"DeclGroup",
18251843
"IdentifiedDecl",
1826-
"Attributed",
1844+
"WithAttributes",
1845+
"WithModifiers",
18271846
],
18281847
children: [
18291848
Child(
@@ -1876,7 +1895,8 @@ public let DECL_NODES: [Node] = [
18761895
nameForDiagnostics: "subscript",
18771896
kind: "Decl",
18781897
traits: [
1879-
"Attributed"
1898+
"WithAttributes",
1899+
"WithModifiers",
18801900
],
18811901
children: [
18821902
Child(
@@ -1977,7 +1997,7 @@ public let DECL_NODES: [Node] = [
19771997
kind: "Decl",
19781998
traits: [
19791999
"IdentifiedDecl",
1980-
"Attributed",
2000+
"WithAttributes",
19812001
],
19822002
children: [
19832003
Child(
@@ -2024,7 +2044,8 @@ public let DECL_NODES: [Node] = [
20242044
nameForDiagnostics: "variable",
20252045
kind: "Decl",
20262046
traits: [
2027-
"Attributed"
2047+
"WithAttributes",
2048+
"WithModifiers",
20282049
],
20292050
children: [
20302051
Child(

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ public let EXPR_NODES: [Node] = [
306306
nameForDiagnostics: "parameter",
307307
kind: "Syntax",
308308
traits: [
309-
"WithTrailingComma"
309+
"WithTrailingComma",
310+
"WithAttributes",
311+
"WithModifiers",
310312
],
311313
parserFunction: "parseClosureParameter",
312314
children: [
@@ -461,7 +463,7 @@ public let EXPR_NODES: [Node] = [
461463
nameForDiagnostics: "closure signature",
462464
kind: "Syntax",
463465
traits: [
464-
"Attributed"
466+
"WithAttributes"
465467
],
466468
children: [
467469
Child(

CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public let GENERIC_NODES: [Node] = [
7575
kind: "Syntax",
7676
traits: [
7777
"WithTrailingComma",
78-
"Attributed",
78+
"WithAttributes",
7979
],
8080
children: [
8181
Child(

CodeGeneration/Sources/SyntaxSupport/Traits.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ public class Trait {
2323
}
2424

2525
public let TRAITS: [Trait] = [
26-
Trait(
27-
traitName: "Attributed",
28-
children: [
29-
Child(name: "Attributes", kind: .node(kind: "AttributeList"), isOptional: true)
30-
]
31-
),
3226
Trait(
3327
traitName: "Braced",
3428
children: [
@@ -80,12 +74,24 @@ public let TRAITS: [Trait] = [
8074
Child(name: "RightParen", kind: .token(choices: [.token(tokenKind: "RightParenToken")])),
8175
]
8276
),
77+
Trait(
78+
traitName: "WithAttributes",
79+
children: [
80+
Child(name: "Attributes", kind: .node(kind: "AttributeList"), isOptional: true)
81+
]
82+
),
8383
Trait(
8484
traitName: "WithCodeBlock",
8585
children: [
8686
Child(name: "Body", kind: .node(kind: "CodeBlock"))
8787
]
8888
),
89+
Trait(
90+
traitName: "WithModifiers",
91+
children: [
92+
Child(name: "Modifiers", kind: .node(kind: "ModifierList"), isOptional: true)
93+
]
94+
),
8995
Trait(
9096
traitName: "WithStatements",
9197
children: [

CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public let TYPE_NODES: [Node] = [
3939
nameForDiagnostics: "type",
4040
kind: "Type",
4141
traits: [
42-
"Attributed"
42+
"WithAttributes"
4343
],
4444
children: [
4545
Child(

Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,15 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
358358

359359
### Traits
360360

361-
- <doc:SwiftSyntax/Attributed>
362361
- <doc:SwiftSyntax/Braced>
363362
- <doc:SwiftSyntax/DeclGroup>
364363
- <doc:SwiftSyntax/EffectSpecifiers>
365364
- <doc:SwiftSyntax/FreestandingMacroExpansion>
366365
- <doc:SwiftSyntax/IdentifiedDecl>
367366
- <doc:SwiftSyntax/Parenthesized>
367+
- <doc:SwiftSyntax/WithAttributes>
368368
- <doc:SwiftSyntax/WithCodeBlock>
369+
- <doc:SwiftSyntax/WithModifiers>
369370
- <doc:SwiftSyntax/WithStatements>
370371
- <doc:SwiftSyntax/WithTrailingComma>
371372

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ public extension DeclGroupSyntax {
1919
return self.memberBlock
2020
}
2121
}
22+
23+
@available(*, deprecated, renamed: "WithAttributesSyntax")
24+
public typealias AttributedSyntax = WithAttributesSyntax

0 commit comments

Comments
 (0)