Skip to content

Commit 992a9da

Browse files
committed
Rename traits 'Attributed' to 'WithAttributes', introduce 'WithModifiers'
1 parent 5ebcc29 commit 992a9da

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
@@ -66,7 +66,7 @@ public let DECL_NODES: [Node] = [
6666
nameForDiagnostics: "accessor",
6767
kind: "Decl",
6868
traits: [
69-
"Attributed"
69+
"WithAttributes"
7070
],
7171
parserFunction: "parseAccessorDecl",
7272
children: [
@@ -151,7 +151,8 @@ public let DECL_NODES: [Node] = [
151151
traits: [
152152
"DeclGroup",
153153
"IdentifiedDecl",
154-
"Attributed",
154+
"WithAttributes",
155+
"WithModifiers",
155156
],
156157
children: [
157158
Child(
@@ -235,7 +236,8 @@ public let DECL_NODES: [Node] = [
235236
kind: "Decl",
236237
traits: [
237238
"IdentifiedDecl",
238-
"Attributed",
239+
"WithAttributes",
240+
"WithModifiers",
239241
],
240242
children: [
241243
Child(
@@ -322,7 +324,8 @@ public let DECL_NODES: [Node] = [
322324
traits: [
323325
"DeclGroup",
324326
"IdentifiedDecl",
325-
"Attributed",
327+
"WithAttributes",
328+
"WithModifiers",
326329
],
327330
children: [
328331
Child(
@@ -469,7 +472,8 @@ public let DECL_NODES: [Node] = [
469472
""",
470473
kind: "Decl",
471474
traits: [
472-
"Attributed"
475+
"WithAttributes",
476+
"WithModifiers",
473477
],
474478
children: [
475479
Child(
@@ -577,7 +581,8 @@ public let DECL_NODES: [Node] = [
577581
nameForDiagnostics: "parameter",
578582
kind: "Syntax",
579583
traits: [
580-
"WithTrailingComma"
584+
"WithTrailingComma",
585+
"WithModifiers",
581586
],
582587
parserFunction: "parseEnumCaseParameter",
583588
children: [
@@ -631,7 +636,8 @@ public let DECL_NODES: [Node] = [
631636
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.",
632637
kind: "Decl",
633638
traits: [
634-
"Attributed"
639+
"WithAttributes",
640+
"WithModifiers",
635641
],
636642
children: [
637643
Child(
@@ -714,7 +720,8 @@ public let DECL_NODES: [Node] = [
714720
traits: [
715721
"DeclGroup",
716722
"IdentifiedDecl",
717-
"Attributed",
723+
"WithAttributes",
724+
"WithModifiers",
718725
],
719726
children: [
720727
Child(
@@ -782,7 +789,8 @@ public let DECL_NODES: [Node] = [
782789
kind: "Decl",
783790
traits: [
784791
"DeclGroup",
785-
"Attributed",
792+
"WithAttributes",
793+
"WithModifiers",
786794
],
787795
children: [
788796
Child(
@@ -830,7 +838,8 @@ public let DECL_NODES: [Node] = [
830838
kind: "Decl",
831839
traits: [
832840
"IdentifiedDecl",
833-
"Attributed",
841+
"WithAttributes",
842+
"WithModifiers",
834843
],
835844
children: [
836845
Child(
@@ -894,7 +903,8 @@ public let DECL_NODES: [Node] = [
894903
kind: "Syntax",
895904
traits: [
896905
"WithTrailingComma",
897-
"Attributed",
906+
"WithAttributes",
907+
"WithModifiers",
898908
],
899909
parserFunction: "parseFunctionParameter",
900910
children: [
@@ -1062,7 +1072,8 @@ public let DECL_NODES: [Node] = [
10621072
""",
10631073
kind: "Decl",
10641074
traits: [
1065-
"Attributed"
1075+
"WithAttributes",
1076+
"WithModifiers",
10661077
],
10671078
children: [
10681079
Child(
@@ -1157,7 +1168,8 @@ public let DECL_NODES: [Node] = [
11571168
""",
11581169
kind: "Decl",
11591170
traits: [
1160-
"Attributed"
1171+
"WithAttributes",
1172+
"WithModifiers",
11611173
],
11621174
children: [
11631175
Child(
@@ -1220,7 +1232,8 @@ public let DECL_NODES: [Node] = [
12201232
kind: "Decl",
12211233
traits: [
12221234
"IdentifiedDecl",
1223-
"Attributed",
1235+
"WithAttributes",
1236+
"WithModifiers",
12241237
],
12251238
children: [
12261239
Child(
@@ -1275,7 +1288,9 @@ public let DECL_NODES: [Node] = [
12751288
nameForDiagnostics: "macro expansion",
12761289
kind: "Decl",
12771290
traits: [
1278-
"FreestandingMacroExpansion"
1291+
"FreestandingMacroExpansion",
1292+
"WithAttributes",
1293+
"WithModifiers",
12791294
],
12801295
children: [
12811296
Child(
@@ -1426,7 +1441,8 @@ public let DECL_NODES: [Node] = [
14261441
kind: "Decl",
14271442
traits: [
14281443
"IdentifiedDecl",
1429-
"Attributed",
1444+
"WithAttributes",
1445+
"WithModifiers",
14301446
],
14311447
children: [
14321448
Child(
@@ -1702,7 +1718,8 @@ public let DECL_NODES: [Node] = [
17021718
kind: "Decl",
17031719
traits: [
17041720
"IdentifiedDecl",
1705-
"Attributed",
1721+
"WithAttributes",
1722+
"WithModifiers",
17061723
],
17071724
children: [
17081725
Child(
@@ -1813,7 +1830,8 @@ public let DECL_NODES: [Node] = [
18131830
traits: [
18141831
"DeclGroup",
18151832
"IdentifiedDecl",
1816-
"Attributed",
1833+
"WithAttributes",
1834+
"WithModifiers",
18171835
],
18181836
children: [
18191837
Child(
@@ -1980,7 +1998,8 @@ public let DECL_NODES: [Node] = [
19801998
traits: [
19811999
"DeclGroup",
19822000
"IdentifiedDecl",
1983-
"Attributed",
2001+
"WithAttributes",
2002+
"WithModifiers",
19842003
],
19852004
children: [
19862005
Child(
@@ -2041,7 +2060,8 @@ public let DECL_NODES: [Node] = [
20412060
nameForDiagnostics: "subscript",
20422061
kind: "Decl",
20432062
traits: [
2044-
"Attributed"
2063+
"WithAttributes",
2064+
"WithModifiers",
20452065
],
20462066
children: [
20472067
Child(
@@ -2142,7 +2162,7 @@ public let DECL_NODES: [Node] = [
21422162
kind: "Decl",
21432163
traits: [
21442164
"IdentifiedDecl",
2145-
"Attributed",
2165+
"WithAttributes",
21462166
],
21472167
children: [
21482168
Child(
@@ -2189,7 +2209,8 @@ public let DECL_NODES: [Node] = [
21892209
nameForDiagnostics: "variable",
21902210
kind: "Decl",
21912211
traits: [
2192-
"Attributed"
2212+
"WithAttributes",
2213+
"WithModifiers",
21932214
],
21942215
children: [
21952216
Child(

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ public let EXPR_NODES: [Node] = [
360360
nameForDiagnostics: "parameter",
361361
kind: "Syntax",
362362
traits: [
363-
"WithTrailingComma"
363+
"WithTrailingComma",
364+
"WithAttributes",
365+
"WithModifiers",
364366
],
365367
parserFunction: "parseClosureParameter",
366368
children: [
@@ -515,7 +517,7 @@ public let EXPR_NODES: [Node] = [
515517
nameForDiagnostics: "closure signature",
516518
kind: "Syntax",
517519
traits: [
518-
"Attributed"
520+
"WithAttributes"
519521
],
520522
children: [
521523
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
@@ -362,14 +362,15 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
362362

363363
### Traits
364364

365-
- <doc:SwiftSyntax/Attributed>
366365
- <doc:SwiftSyntax/Braced>
367366
- <doc:SwiftSyntax/DeclGroup>
368367
- <doc:SwiftSyntax/EffectSpecifiers>
369368
- <doc:SwiftSyntax/FreestandingMacroExpansion>
370369
- <doc:SwiftSyntax/IdentifiedDecl>
371370
- <doc:SwiftSyntax/Parenthesized>
371+
- <doc:SwiftSyntax/WithAttributes>
372372
- <doc:SwiftSyntax/WithCodeBlock>
373+
- <doc:SwiftSyntax/WithModifiers>
373374
- <doc:SwiftSyntax/WithStatements>
374375
- <doc:SwiftSyntax/WithTrailingComma>
375376

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ public typealias AccessPathSyntax = ImportPathSyntax
2525

2626
@available(*, deprecated, renamed: "ImportPathComponentSyntax")
2727
public typealias AccessPathComponentSyntax = ImportPathComponentSyntax
28+
29+
@available(*, deprecated, renamed: "WithAttributesSyntax")
30+
public typealias AttributedSyntax = WithAttributesSyntax

0 commit comments

Comments
 (0)