Skip to content

Commit 0386d87

Browse files
authored
Merge pull request #2888 from beccadax/history-is-childs-play
[NFC-ish] Rework compatibility layer generation
2 parents aa7c3d8 + f1fcb10 commit 0386d87

27 files changed

+1653
-656
lines changed

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

+86-32
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public let ATTRIBUTE_NODES: [Node] = [
4141
children: [
4242
Child(
4343
name: "atSign",
44-
deprecatedName: "atSignToken",
4544
kind: .token(choices: [.token(.atSign)]),
4645
documentation: "The `@` sign."
4746
),
@@ -59,7 +58,6 @@ public let ATTRIBUTE_NODES: [Node] = [
5958
),
6059
Child(
6160
name: "arguments",
62-
deprecatedName: "argument",
6361
kind: .nodeChoices(choices: [
6462
Child(
6563
name: "argumentList",
@@ -156,6 +154,12 @@ public let ATTRIBUTE_NODES: [Node] = [
156154
documentation: "If the attribute takes arguments, the closing parenthesis.",
157155
isOptional: true
158156
),
157+
],
158+
childHistory: [
159+
[
160+
"atSign": .renamed(from: "atSignToken"),
161+
"arguments": .renamed(from: "argument"),
162+
]
159163
]
160164
),
161165

@@ -167,7 +171,6 @@ public let ATTRIBUTE_NODES: [Node] = [
167171
children: [
168172
Child(
169173
name: "availabilityLabel",
170-
deprecatedName: "label",
171174
kind: .token(choices: [.keyword(.availability)]),
172175
nameForDiagnostics: "label",
173176
documentation: "The label of the argument"
@@ -179,7 +182,6 @@ public let ATTRIBUTE_NODES: [Node] = [
179182
),
180183
Child(
181184
name: "availabilityArguments",
182-
deprecatedName: "availabilityList",
183185
kind: .collection(
184186
kind: .availabilityArgumentList,
185187
collectionElementName: "AvailabilityArgument",
@@ -190,6 +192,12 @@ public let ATTRIBUTE_NODES: [Node] = [
190192
name: "semicolon",
191193
kind: .token(choices: [.token(.semicolon)])
192194
),
195+
],
196+
childHistory: [
197+
[
198+
"availabilityLabel": .renamed(from: "label"),
199+
"availabilityArguments": .renamed(from: "availabilityList"),
200+
]
193201
]
194202
),
195203

@@ -202,7 +210,6 @@ public let ATTRIBUTE_NODES: [Node] = [
202210
children: [
203211
Child(
204212
name: "platformVersion",
205-
deprecatedName: "availabilityVersionRestriction",
206213
kind: .node(kind: .platformVersion),
207214
documentation: "The platform/version pair, e.g. `iOS 10.1`"
208215
),
@@ -212,6 +219,11 @@ public let ATTRIBUTE_NODES: [Node] = [
212219
documentation: "A trailing comma if the argument is followed by another argument",
213220
isOptional: true
214221
),
222+
],
223+
childHistory: [
224+
[
225+
"platformVersion": .renamed(from: "availabilityVersionRestriction")
226+
]
215227
]
216228
),
217229

@@ -240,14 +252,18 @@ public let ATTRIBUTE_NODES: [Node] = [
240252
),
241253
Child(
242254
name: "platforms",
243-
deprecatedName: "versionList",
244255
kind: .collection(
245256
kind: .platformVersionItemList,
246257
collectionElementName: "Platform",
247258
deprecatedCollectionElementName: "Availability"
248259
),
249260
documentation: "The list of OS versions in which the declaration became ABI stable."
250261
),
262+
],
263+
childHistory: [
264+
[
265+
"platforms": .renamed(from: "versionList")
266+
]
251267
]
252268
),
253269

@@ -340,7 +356,6 @@ public let ATTRIBUTE_NODES: [Node] = [
340356
),
341357
Child(
342358
name: "accessorSpecifier",
343-
deprecatedName: "accessorKind",
344359
kind: .token(choices: [.keyword(.get), .keyword(.set)]),
345360
documentation: "The accessor name.",
346361
isOptional: true
@@ -352,10 +367,15 @@ public let ATTRIBUTE_NODES: [Node] = [
352367
),
353368
Child(
354369
name: "arguments",
355-
deprecatedName: "diffParams",
356370
kind: .node(kind: .differentiabilityWithRespectToArgument),
357371
isOptional: true
358372
),
373+
],
374+
childHistory: [
375+
[
376+
"accessorSpecifier": .renamed(from: "accessorKind"),
377+
"arguments": .renamed(from: "diffParams"),
378+
]
359379
]
360380
),
361381

@@ -378,14 +398,18 @@ public let ATTRIBUTE_NODES: [Node] = [
378398
children: [
379399
Child(
380400
name: "argument",
381-
deprecatedName: "parameter",
382401
kind: .token(choices: [.token(.identifier), .token(.integerLiteral), .keyword(.self)])
383402
),
384403
Child(
385404
name: "trailingComma",
386405
kind: .token(choices: [.token(.comma)]),
387406
isOptional: true
388407
),
408+
],
409+
childHistory: [
410+
[
411+
"argument": .renamed(from: "parameter")
412+
]
389413
]
390414
),
391415

@@ -407,21 +431,31 @@ public let ATTRIBUTE_NODES: [Node] = [
407431
),
408432
Child(
409433
name: "arguments",
410-
deprecatedName: "parameters",
411-
kind: .nodeChoices(choices: [
412-
Child(
413-
name: "argument",
414-
deprecatedName: "parameter",
415-
kind: .node(kind: .differentiabilityArgument)
416-
),
417-
Child(
418-
name: "argumentList",
419-
deprecatedName: "parameterList",
420-
kind: .node(kind: .differentiabilityArguments)
421-
),
422-
]),
434+
kind: .nodeChoices(
435+
choices: [
436+
Child(
437+
name: "argument",
438+
kind: .node(kind: .differentiabilityArgument)
439+
),
440+
Child(
441+
name: "argumentList",
442+
kind: .node(kind: .differentiabilityArguments)
443+
),
444+
],
445+
childHistory: [
446+
[
447+
"argument": .renamed(from: "parameter"),
448+
"argumentList": .renamed(from: "parameterList"),
449+
]
450+
]
451+
),
423452
nameForDiagnostics: "arguments"
424453
),
454+
],
455+
childHistory: [
456+
[
457+
"arguments": .renamed(from: "parameters")
458+
]
425459
]
426460
),
427461

@@ -437,14 +471,18 @@ public let ATTRIBUTE_NODES: [Node] = [
437471
),
438472
Child(
439473
name: "arguments",
440-
deprecatedName: "differentiabilityParameters",
441474
kind: .collection(kind: .differentiabilityArgumentList, collectionElementName: "Argument"),
442475
documentation: "The parameters for differentiation."
443476
),
444477
Child(
445478
name: "rightParen",
446479
kind: .token(choices: [.token(.rightParen)])
447480
),
481+
],
482+
childHistory: [
483+
[
484+
"arguments": .renamed(from: "differentiabilityParameters")
485+
]
448486
]
449487
),
450488

@@ -457,40 +495,44 @@ public let ATTRIBUTE_NODES: [Node] = [
457495
children: [
458496
Child(
459497
name: "kindSpecifier",
460-
deprecatedName: "diffKind",
461498
kind: .token(choices: [.keyword(._forward), .keyword(.reverse), .keyword(._linear)]),
462499
documentation: "The differentiability kind, if it exists.",
463500
isOptional: true
464501
),
465502
Child(
466503
name: "kindSpecifierComma",
467-
deprecatedName: "diffKindComma",
468504
kind: .token(choices: [.token(.comma)]),
469505
documentation: "The comma following the differentiability kind, if it exists.",
470506
isOptional: true
471507
),
472508
Child(
473509
name: "arguments",
474-
deprecatedName: "diffParams",
475510
kind: .node(kind: .differentiabilityWithRespectToArgument),
476511
documentation: "The differentiability arguments, if any exists.",
477512
isOptional: true
478513
),
479514
Child(
480515
name: "argumentsComma",
481-
deprecatedName: "diffParamsComma",
482516
kind: .token(choices: [.token(.comma)]),
483517
documentation: "The comma following the differentiability arguments clause, if it exists.",
484518
isOptional: true
485519
),
486520
Child(
487521
name: "genericWhereClause",
488-
deprecatedName: "whereClause",
489522
kind: .node(kind: .genericWhereClause),
490523
documentation:
491524
"A `where` clause that places additional constraints on generic parameters like `where T: Differentiable`.",
492525
isOptional: true
493526
),
527+
],
528+
childHistory: [
529+
[
530+
"kindSpecifier": .renamed(from: "diffKind"),
531+
"kindSpecifierComma": .renamed(from: "diffKindComma"),
532+
"arguments": .renamed(from: "diffParams"),
533+
"argumentsComma": .renamed(from: "diffParamsComma"),
534+
"genericWhereClause": .renamed(from: "whereClause"),
535+
]
494536
]
495537
),
496538

@@ -564,9 +606,13 @@ public let ATTRIBUTE_NODES: [Node] = [
564606
),
565607
Child(
566608
name: "declName",
567-
deprecatedName: "declname",
568609
kind: .node(kind: .declReferenceExpr)
569610
),
611+
],
612+
childHistory: [
613+
[
614+
"declName": .renamed(from: "declname")
615+
]
570616
]
571617
),
572618

@@ -621,11 +667,15 @@ public let ATTRIBUTE_NODES: [Node] = [
621667
),
622668
Child(
623669
name: "declName",
624-
deprecatedName: "declname",
625670
kind: .node(kind: .declReferenceExpr),
626671
nameForDiagnostics: "declaration name",
627672
documentation: "The value for this argument"
628673
),
674+
],
675+
childHistory: [
676+
[
677+
"declName": .renamed(from: "declname")
678+
]
629679
]
630680
),
631681

@@ -776,7 +826,6 @@ public let ATTRIBUTE_NODES: [Node] = [
776826
children: [
777827
Child(
778828
name: "targetLabel",
779-
deprecatedName: "label",
780829
kind: .token(choices: [.keyword(.target)]),
781830
nameForDiagnostics: "label",
782831
documentation: "The label of the argument"
@@ -788,7 +837,6 @@ public let ATTRIBUTE_NODES: [Node] = [
788837
),
789838
Child(
790839
name: "declName",
791-
deprecatedName: "declname",
792840
kind: .node(kind: .declReferenceExpr),
793841
nameForDiagnostics: "declaration name",
794842
documentation: "The value for this argument"
@@ -799,6 +847,12 @@ public let ATTRIBUTE_NODES: [Node] = [
799847
documentation: "A trailing comma if this argument is followed by another one",
800848
isOptional: true
801849
),
850+
],
851+
childHistory: [
852+
[
853+
"targetLabel": .renamed(from: "label"),
854+
"declName": .renamed(from: "declname"),
855+
]
802856
]
803857
),
804858

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public let AVAILABILITY_NODES: [Node] = [
2121
children: [
2222
Child(
2323
name: "argument",
24-
deprecatedName: "entry",
2524
kind: .nodeChoices(choices: [
2625
Child(
2726
name: "token",
@@ -48,6 +47,11 @@ public let AVAILABILITY_NODES: [Node] = [
4847
documentation: "A trailing comma if the argument is followed by another argument.",
4948
isOptional: true
5049
),
50+
],
51+
childHistory: [
52+
[
53+
"argument": .renamed(from: "entry")
54+
]
5155
]
5256
),
5357

0 commit comments

Comments
 (0)