Skip to content

Commit a7b91e6

Browse files
committed
[CodeGeneration] removed Node.base by coupling base with SyntaxNodeKind
1 parent 918c260 commit a7b91e6

12 files changed

+84
-296
lines changed

Diff for: CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

-29
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
public let ATTRIBUTE_NODES: [Node] = [
1414
Node(
1515
kind: .attributeList,
16-
base: .syntaxCollection,
1716
nameForDiagnostics: "attributes",
1817
documentation: """
1918
A list of attributes that can be attached to a declaration.
@@ -34,7 +33,6 @@ public let ATTRIBUTE_NODES: [Node] = [
3433

3534
Node(
3635
kind: .attribute,
37-
base: .syntax,
3836
nameForDiagnostics: "attribute",
3937
documentation: "An `@` attribute.",
4038
parserFunction: "parseAttribute",
@@ -161,7 +159,6 @@ public let ATTRIBUTE_NODES: [Node] = [
161159

162160
Node(
163161
kind: .specializeAvailabilityArgument,
164-
base: .syntax,
165162
nameForDiagnostics: "availability entry",
166163
documentation: "The availability argument for the _specialize attribute",
167164
children: [
@@ -195,7 +192,6 @@ public let ATTRIBUTE_NODES: [Node] = [
195192

196193
Node(
197194
kind: .platformVersionItem,
198-
base: .syntax,
199195
nameForDiagnostics: "version",
200196
documentation: "A single platform/version pair in an attribute, e.g. `iOS 10.1`.",
201197
traits: ["WithTrailingComma"],
@@ -217,14 +213,12 @@ public let ATTRIBUTE_NODES: [Node] = [
217213

218214
Node(
219215
kind: .platformVersionItemList,
220-
base: .syntaxCollection,
221216
nameForDiagnostics: "version list",
222217
elementChoices: [.platformVersionItem]
223218
),
224219

225220
Node(
226221
kind: .backDeployedAttributeArguments,
227-
base: .syntax,
228222
nameForDiagnostics: "'@backDeployed' arguments",
229223
documentation: "A collection of arguments for the `@backDeployed` attribute",
230224
children: [
@@ -253,7 +247,6 @@ public let ATTRIBUTE_NODES: [Node] = [
253247

254248
Node(
255249
kind: .conventionAttributeArguments,
256-
base: .syntax,
257250
nameForDiagnostics: "@convention(...) arguments",
258251
documentation: "The arguments for the '@convention(...)'.",
259252
children: [
@@ -287,7 +280,6 @@ public let ATTRIBUTE_NODES: [Node] = [
287280

288281
Node(
289282
kind: .conventionWitnessMethodAttributeArguments,
290-
base: .syntax,
291283
nameForDiagnostics: "@convention(...) arguments for witness methods",
292284
documentation: "The arguments for the '@convention(witness_method: ...)'.",
293285
children: [
@@ -312,7 +304,6 @@ public let ATTRIBUTE_NODES: [Node] = [
312304

313305
Node(
314306
kind: .derivativeAttributeArguments,
315-
base: .syntax,
316307
nameForDiagnostics: "attribute arguments",
317308
documentation:
318309
"The arguments for the '@derivative(of:)' and '@transpose(of:)' attributes: the 'of:' label, the original declaration name, and an optional differentiability parameter list.",
@@ -361,14 +352,12 @@ public let ATTRIBUTE_NODES: [Node] = [
361352

362353
Node(
363354
kind: .differentiabilityArgumentList,
364-
base: .syntaxCollection,
365355
nameForDiagnostics: "differentiability parameters",
366356
elementChoices: [.differentiabilityArgument]
367357
),
368358

369359
Node(
370360
kind: .differentiabilityArgument,
371-
base: .syntax,
372361
nameForDiagnostics: "differentiability argument",
373362
documentation:
374363
"A differentiability argument: either the \"self\" identifier, a function parameter name, or a function parameter index.",
@@ -391,7 +380,6 @@ public let ATTRIBUTE_NODES: [Node] = [
391380

392381
Node(
393382
kind: .differentiabilityWithRespectToArgument,
394-
base: .syntax,
395383
nameForDiagnostics: "'@differentiable' argument",
396384
documentation: "A clause containing differentiability parameters.",
397385
children: [
@@ -427,7 +415,6 @@ public let ATTRIBUTE_NODES: [Node] = [
427415

428416
Node(
429417
kind: .differentiabilityArguments,
430-
base: .syntax,
431418
nameForDiagnostics: "differentiability arguments",
432419
documentation: "The differentiability arguments.",
433420
children: [
@@ -450,7 +437,6 @@ public let ATTRIBUTE_NODES: [Node] = [
450437

451438
Node(
452439
kind: .differentiableAttributeArguments,
453-
base: .syntax,
454440
nameForDiagnostics: "'@differentiable' arguments",
455441
documentation:
456442
"The arguments for the `@differentiable` attribute: an optional differentiability kind, an optional differentiability parameter clause, and an optional 'where' clause.",
@@ -496,7 +482,6 @@ public let ATTRIBUTE_NODES: [Node] = [
496482

497483
Node(
498484
kind: .documentationAttributeArgument,
499-
base: .syntax,
500485
nameForDiagnostics: "@_documentation argument",
501486
traits: [
502487
"WithTrailingComma"
@@ -542,15 +527,13 @@ public let ATTRIBUTE_NODES: [Node] = [
542527

543528
Node(
544529
kind: .documentationAttributeArgumentList,
545-
base: .syntaxCollection,
546530
nameForDiagnostics: "@_documentation arguments",
547531
documentation: "The arguments of the '@_documentation' attribute",
548532
elementChoices: [.documentationAttributeArgument]
549533
),
550534

551535
Node(
552536
kind: .dynamicReplacementAttributeArguments,
553-
base: .syntax,
554537
nameForDiagnostics: "@_dynamicReplacement argument",
555538
documentation: "The arguments for the '@_dynamicReplacement' attribute",
556539
children: [
@@ -572,15 +555,13 @@ public let ATTRIBUTE_NODES: [Node] = [
572555

573556
Node(
574557
kind: .effectsAttributeArgumentList,
575-
base: .syntaxCollection,
576558
nameForDiagnostics: "@_effects arguments",
577559
documentation: "The arguments of the '@_effects' attribute. These will be parsed during the SIL stage.",
578560
elementChoices: [.token]
579561
),
580562

581563
Node(
582564
kind: .exposeAttributeArguments,
583-
base: .syntax,
584565
nameForDiagnostics: "@_expose arguments",
585566
documentation: "The arguments for the '@_expose' attribute",
586567
children: [
@@ -603,7 +584,6 @@ public let ATTRIBUTE_NODES: [Node] = [
603584

604585
Node(
605586
kind: .implementsAttributeArguments,
606-
base: .syntax,
607587
nameForDiagnostics: "@_implements arguemnts",
608588
documentation:
609589
"The arguments for the `@_implements` attribute of the form `Type, methodName(arg1Label:arg2Label:)`",
@@ -631,7 +611,6 @@ public let ATTRIBUTE_NODES: [Node] = [
631611

632612
Node(
633613
kind: .labeledSpecializeArgument,
634-
base: .syntax,
635614
nameForDiagnostics: "attribute argument",
636615
documentation: "A labeled argument for the `@_specialize` attribute like `exported: true`",
637616
traits: [
@@ -673,7 +652,6 @@ public let ATTRIBUTE_NODES: [Node] = [
673652

674653
Node(
675654
kind: .objCSelectorPiece,
676-
base: .syntax,
677655
nameForDiagnostics: "Objective-C selector piece",
678656
documentation:
679657
"A piece of an Objective-C selector. Either consisting of just an identifier for a nullary selector, an identifier and a colon for a labeled argument or just a colon for an unlabeled argument",
@@ -696,14 +674,12 @@ public let ATTRIBUTE_NODES: [Node] = [
696674

697675
Node(
698676
kind: .objCSelectorPieceList,
699-
base: .syntaxCollection,
700677
nameForDiagnostics: "Objective-C selector",
701678
elementChoices: [.objCSelectorPiece]
702679
),
703680

704681
Node(
705682
kind: .opaqueReturnTypeOfAttributeArguments,
706-
base: .syntax,
707683
nameForDiagnostics: "opaque return type arguments",
708684
documentation: "The arguments for the '@_opaqueReturnTypeOf()'.",
709685
children: [
@@ -726,7 +702,6 @@ public let ATTRIBUTE_NODES: [Node] = [
726702

727703
Node(
728704
kind: .originallyDefinedInAttributeArguments,
729-
base: .syntax,
730705
nameForDiagnostics: "@_originallyDefinedIn arguments",
731706
documentation: "The arguments for the '@_originallyDefinedIn' attribute",
732707
children: [
@@ -755,7 +730,6 @@ public let ATTRIBUTE_NODES: [Node] = [
755730

756731
Node(
757732
kind: .specializeAttributeArgumentList,
758-
base: .syntaxCollection,
759733
nameForDiagnostics: "argument to '@_specialize",
760734
documentation: "A collection of arguments for the `@_specialize` attribute",
761735
elementChoices: [
@@ -766,7 +740,6 @@ public let ATTRIBUTE_NODES: [Node] = [
766740

767741
Node(
768742
kind: .specializeTargetFunctionArgument,
769-
base: .syntax,
770743
nameForDiagnostics: "attribute argument",
771744
documentation:
772745
"A labeled argument for the `@_specialize` attribute with a function decl value like `target: myFunc(_:)`",
@@ -804,7 +777,6 @@ public let ATTRIBUTE_NODES: [Node] = [
804777

805778
Node(
806779
kind: .unavailableFromAsyncAttributeArguments,
807-
base: .syntax,
808780
nameForDiagnostics: "@_unavailableFromAsync argument",
809781
documentation: "The arguments for the '@_unavailableFromAsync' attribute",
810782
children: [
@@ -825,7 +797,6 @@ public let ATTRIBUTE_NODES: [Node] = [
825797

826798
Node(
827799
kind: .underscorePrivateAttributeArguments,
828-
base: .syntax,
829800
nameForDiagnostics: "@_private argument",
830801
documentation: "The arguments for the '@_private' attribute",
831802
children: [

Diff for: CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift

-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
public let AVAILABILITY_NODES: [Node] = [
1414
Node(
1515
kind: .availabilityArgument,
16-
base: .syntax,
1716
nameForDiagnostics: "availability argument",
1817
documentation:
1918
"A single argument to an `@available` argument like `*`, `iOS 10.1`, or `message: \"This has been deprecated\"`.",
@@ -53,7 +52,6 @@ public let AVAILABILITY_NODES: [Node] = [
5352

5453
Node(
5554
kind: .availabilityLabeledArgument,
56-
base: .syntax,
5755
nameForDiagnostics: "availability argument",
5856
documentation:
5957
"An argument to an `@available` attribute that consists of a label and a value, e.g. `message: \"This has been deprecated\"`.",
@@ -95,14 +93,12 @@ public let AVAILABILITY_NODES: [Node] = [
9593

9694
Node(
9795
kind: .availabilityArgumentList,
98-
base: .syntaxCollection,
9996
nameForDiagnostics: "'@availability' arguments",
10097
elementChoices: [.availabilityArgument]
10198
),
10299

103100
Node(
104101
kind: .platformVersion,
105-
base: .syntax,
106102
nameForDiagnostics: "version restriction",
107103
documentation:
108104
"An argument to `@available` that restricts the availability on a certain platform to a version, e.g. `iOS 10` or `swift 3.4`.",
@@ -132,7 +128,6 @@ public let AVAILABILITY_NODES: [Node] = [
132128

133129
Node(
134130
kind: .versionComponent,
135-
base: .syntax,
136131
nameForDiagnostics: nil,
137132
documentation: "An element to represent a single component in a version, like `.1`.",
138133
children: [
@@ -151,14 +146,12 @@ public let AVAILABILITY_NODES: [Node] = [
151146

152147
Node(
153148
kind: .versionComponentList,
154-
base: .syntaxCollection,
155149
nameForDiagnostics: nil,
156150
elementChoices: [.versionComponent]
157151
),
158152

159153
Node(
160154
kind: .versionTuple,
161-
base: .syntax,
162155
nameForDiagnostics: "version tuple",
163156
documentation:
164157
"A version number like `1.2.0`. Only the first version component is required. There might be an arbitrary number of following components.",

0 commit comments

Comments
 (0)