Skip to content

Commit 44c4cca

Browse files
committed
Rename TupleExprElement -> LabeledExpr
1 parent 6397ce3 commit 44c4cca

File tree

67 files changed

+999
-980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+999
-980
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public let ATTRIBUTE_NODES: [Node] = [
6060
kind: .nodeChoices(choices: [
6161
Child(
6262
name: "ArgumentList",
63-
kind: .node(kind: .tupleExprElementList)
63+
kind: .node(kind: .labeledExprList)
6464
),
6565
Child(
6666
name: "Token",

CodeGeneration/Sources/SyntaxSupport/BuilderInitializableTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public let BUILDER_INITIALIZABLE_TYPES: [SyntaxNodeKind: SyntaxNodeKind?] = [
2525
.genericParameterList: nil,
2626
.genericRequirementList: nil,
2727
.inheritedTypeList: nil,
28+
.labeledExprList: nil,
2829
.memberBlock: .memberBlockItemList,
2930
.memberBlockItemList: nil,
3031
.patternBindingList: nil,
3132
.switchCaseItemList: nil,
3233
.switchCaseList: nil,
33-
.tupleExprElementList: nil,
3434
.tuplePatternElementList: nil,
3535
]

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public let DECL_NODES: [Node] = [
8181
Child(
8282
name: "Properties",
8383
deprecatedName: "PropertyList",
84-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Property"),
84+
kind: .collection(kind: .labeledExprList, collectionElementName: "Property"),
8585
nameForDiagnostics: "properties"
8686
),
8787
Child(
@@ -107,7 +107,7 @@ public let DECL_NODES: [Node] = [
107107
Child(
108108
name: "Properties",
109109
deprecatedName: "PropertyList",
110-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Property"),
110+
kind: .collection(kind: .labeledExprList, collectionElementName: "Property"),
111111
nameForDiagnostics: "properties"
112112
),
113113
Child(
@@ -1487,7 +1487,7 @@ public let DECL_NODES: [Node] = [
14871487
Child(
14881488
name: "Arguments",
14891489
deprecatedName: "ArgumentList",
1490-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument")
1490+
kind: .collection(kind: .labeledExprList, collectionElementName: "Argument")
14911491
),
14921492
Child(
14931493
name: "RightParen",

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ public let EXPR_NODES: [Node] = [
749749
),
750750
Child(
751751
name: "Expressions",
752-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Expression")
752+
kind: .collection(kind: .labeledExprList, collectionElementName: "Expression")
753753
),
754754
Child(
755755
name: "RightParen",
@@ -812,7 +812,7 @@ public let EXPR_NODES: [Node] = [
812812
Child(
813813
name: "Arguments",
814814
deprecatedName: "ArgumentList",
815-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument"),
815+
kind: .collection(kind: .labeledExprList, collectionElementName: "Argument"),
816816
nameForDiagnostics: "arguments"
817817
),
818818
Child(
@@ -1128,7 +1128,7 @@ public let EXPR_NODES: [Node] = [
11281128
Child(
11291129
name: "Arguments",
11301130
deprecatedName: "ArgumentList",
1131-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument"),
1131+
kind: .collection(kind: .labeledExprList, collectionElementName: "Argument"),
11321132
nameForDiagnostics: "arguments"
11331133
),
11341134
Child(
@@ -1173,7 +1173,7 @@ public let EXPR_NODES: [Node] = [
11731173
Child(
11741174
name: "Arguments",
11751175
deprecatedName: "ArgumentList",
1176-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument")
1176+
kind: .collection(kind: .labeledExprList, collectionElementName: "Argument")
11771177
),
11781178
Child(
11791179
name: "RightParen",
@@ -1549,7 +1549,7 @@ public let EXPR_NODES: [Node] = [
15491549
Child(
15501550
name: "Arguments",
15511551
deprecatedName: "ArgumentList",
1552-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument"),
1552+
kind: .collection(kind: .labeledExprList, collectionElementName: "Argument"),
15531553
nameForDiagnostics: "arguments"
15541554
),
15551555
Child(
@@ -1770,15 +1770,15 @@ public let EXPR_NODES: [Node] = [
17701770
),
17711771

17721772
Node(
1773-
kind: .tupleExprElementList,
1773+
kind: .labeledExprList,
17741774
base: .syntaxCollection,
17751775
nameForDiagnostics: nil,
1776-
elementChoices: [.tupleExprElement]
1776+
elementChoices: [.labeledExpr]
17771777
),
17781778

17791779
// An element inside a tuple element list
17801780
Node(
1781-
kind: .tupleExprElement,
1781+
kind: .labeledExpr,
17821782
base: .syntax,
17831783
nameForDiagnostics: nil,
17841784
traits: [
@@ -1824,7 +1824,7 @@ public let EXPR_NODES: [Node] = [
18241824
Child(
18251825
name: "Elements",
18261826
deprecatedName: "ElementList",
1827-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Element")
1827+
kind: .collection(kind: .labeledExprList, collectionElementName: "Element")
18281828
),
18291829
Child(
18301830
name: "RightParen",

CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ public enum SyntaxNodeKind: String, CaseIterable {
180180
case keyPathOptionalComponent
181181
case keyPathPropertyComponent
182182
case keyPathSubscriptComponent
183+
case labeledExpr
184+
case labeledExprList
183185
case labeledSpecializeArgument
184186
case labeledStmt
185187
case layoutRequirement
@@ -271,8 +273,6 @@ public enum SyntaxNodeKind: String, CaseIterable {
271273
case throwStmt
272274
case tryExpr
273275
case tupleExpr
274-
case tupleExprElement
275-
case tupleExprElementList
276276
case tuplePattern
277277
case tuplePatternElement
278278
case tuplePatternElementList
@@ -407,6 +407,8 @@ public enum SyntaxNodeKind: String, CaseIterable {
407407
case .importPathComponent: return "accessPathComponent"
408408
case .importPathComponentList: return "accessPath"
409409
case .inheritanceClause: return "typeInheritanceClause"
410+
case .labeledExpr: return "tupleExprElement"
411+
case .labeledExprList: return "tupleExprElementList"
410412
case .labeledSpecializeArgument: return "labeledSpecializeEntry"
411413
case .memberBlock: return "memberDeclBlock"
412414
case .memberBlockItem: return "memberDeclListItem"

CodeGeneration/Sources/SyntaxSupport/Traits.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public let TRAITS: [Trait] = [
6666
Child(name: "Macro", kind: .token(choices: [.token(tokenKind: "IdentifierToken")])),
6767
Child(name: "GenericArgumentClause", kind: .node(kind: .genericArgumentClause), isOptional: true),
6868
Child(name: "LeftParen", kind: .token(choices: [.token(tokenKind: "LeftParenToken")]), isOptional: true),
69-
Child(name: "ArgumentList", kind: .node(kind: .tupleExprElementList)),
69+
Child(name: "ArgumentList", kind: .node(kind: .labeledExprList)),
7070
Child(name: "RightParen", kind: .token(choices: [.token(tokenKind: "RightParenToken")]), isOptional: true),
7171
Child(name: "TrailingClosure", kind: .node(kind: .closureExpr), isOptional: true),
7272
Child(name: "AdditionalTrailingClosures", kind: .node(kind: .multipleTrailingClosureElementList), isOptional: true),

CodeGeneration/Sources/Utils/CodeGenerationFormat.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public class CodeGenerationFormat: BasicFormat {
7979
}
8080
}
8181

82-
public override func visit(_ node: TupleExprElementListSyntax) -> TupleExprElementListSyntax {
82+
public override func visit(_ node: LabeledExprListSyntax) -> LabeledExprListSyntax {
8383
let children = node.children(viewMode: .all)
8484
// Short tuple element list literals are presented on one line, list each element on a different line.
8585
if children.count > 3 {
86-
return TupleExprElementListSyntax(formatChildrenSeparatedByNewline(children: children, elementType: TupleExprElementSyntax.self))
86+
return LabeledExprListSyntax(formatChildrenSeparatedByNewline(children: children, elementType: LabeledExprSyntax.self))
8787
} else {
8888
return super.visit(node)
8989
}

CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public extension Child {
151151
}
152152
let disjunction = ExprListSyntax(preconditionChoices.flatMap { [$0, ExprSyntax(BinaryOperatorExprSyntax(text: "||"))] }.dropLast())
153153
return FunctionCallExprSyntax(callee: ExprSyntax("precondition")) {
154-
TupleExprElementSyntax(expression: SequenceExprSyntax(elements: disjunction))
154+
LabeledExprSyntax(expression: SequenceExprSyntax(elements: disjunction))
155155
}
156156
}
157157
}

CodeGeneration/Sources/generate-swiftsyntax/LayoutNode+Extensions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ extension LayoutNode {
106106
// they can use trailing closure syntax.
107107
var normalParameters: [FunctionParameterSyntax] = []
108108
var builderParameters: [FunctionParameterSyntax] = []
109-
var delegatedInitArgs: [TupleExprElementSyntax] = []
109+
var delegatedInitArgs: [LabeledExprSyntax] = []
110110

111111
for child in children {
112112
/// The expression that is used to call the default initializer defined above.
@@ -150,7 +150,7 @@ extension LayoutNode {
150150
)
151151
}
152152
delegatedInitArgs.append(
153-
TupleExprElementSyntax(
153+
LabeledExprSyntax(
154154
label: child.isUnexpectedNodes ? nil : child.varOrCaseName,
155155
colon: child.isUnexpectedNodes ? nil : .colonToken(),
156156
expression: produceExpr
@@ -177,11 +177,11 @@ extension LayoutNode {
177177
"""
178178
) {
179179
FunctionCallExprSyntax(callee: ExprSyntax("try self.init")) {
180-
TupleExprElementSyntax(label: "leadingTrivia", expression: ExprSyntax("leadingTrivia"))
180+
LabeledExprSyntax(label: "leadingTrivia", expression: ExprSyntax("leadingTrivia"))
181181
for arg in delegatedInitArgs {
182182
arg
183183
}
184-
TupleExprElementSyntax(label: "trailingTrivia", expression: ExprSyntax("trailingTrivia"))
184+
LabeledExprSyntax(label: "trailingTrivia", expression: ExprSyntax("trailingTrivia"))
185185
}
186186
}
187187
}

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RenamedChildrenCompatibilityFile.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ let renamedChildrenCompatibilityFile = try! SourceFileSyntax(leadingTrivia: copy
6868
"""
6969
) {
7070
FunctionCallExprSyntax(callee: ExprSyntax("self.init")) {
71-
TupleExprElementSyntax(label: "leadingTrivia", expression: ExprSyntax("leadingTrivia"))
71+
LabeledExprSyntax(label: "leadingTrivia", expression: ExprSyntax("leadingTrivia"))
7272
for child in layoutNode.children {
7373
if child.isUnexpectedNodes {
74-
TupleExprElementSyntax(expression: ExprSyntax("\(raw: child.deprecatedVarName ?? child.varOrCaseName)"))
74+
LabeledExprSyntax(expression: ExprSyntax("\(raw: child.deprecatedVarName ?? child.varOrCaseName)"))
7575
} else {
76-
TupleExprElementSyntax(
76+
LabeledExprSyntax(
7777
label: child.varOrCaseName,
7878
colon: .colonToken(),
7979
expression: IdentifierExprSyntax(identifier: child.deprecatedVarName ?? child.varOrCaseName)
8080
)
8181
}
8282
}
83-
TupleExprElementSyntax(label: "trailingTrivia", expression: ExprSyntax("trailingTrivia"))
83+
LabeledExprSyntax(label: "trailingTrivia", expression: ExprSyntax("trailingTrivia"))
8484
}
8585
}
8686
}

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ func syntaxNode(emitKind: SyntaxNodeKind) -> SourceFileSyntax {
113113
let initializer = FunctionCallExprSyntax(
114114
calledExpression: ExprSyntax("withExtendedLifetime"),
115115
leftParen: .leftParenToken(),
116-
arguments: TupleExprElementListSyntax {
117-
TupleExprElementSyntax(expression: ExprSyntax("(SyntaxArena(), (\(parameters)))"))
116+
arguments: LabeledExprListSyntax {
117+
LabeledExprSyntax(expression: ExprSyntax("(SyntaxArena(), (\(parameters)))"))
118118
},
119119
rightParen: .rightParenToken(),
120120
trailingClosure: ClosureExprSyntax(signature: closureSignature) {

Sources/SwiftParser/Attributes.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ extension Parser {
319319
case .attached:
320320
return parseAttribute(argumentMode: .customAttribute) { parser in
321321
let arguments = parser.parseAttachedArguments()
322-
return .argumentList(RawTupleExprElementListSyntax(elements: arguments, arena: parser.arena))
322+
return .argumentList(RawLabeledExprListSyntax(elements: arguments, arena: parser.arena))
323323
}
324324
case .rethrows:
325325
let (unexpectedBeforeAtSign, atSign) = self.expect(.atSign)
@@ -339,17 +339,17 @@ extension Parser {
339339
case nil:
340340
return parseAttribute(argumentMode: .customAttribute) { parser in
341341
let arguments = parser.parseArgumentListElements(pattern: .none)
342-
return .argumentList(RawTupleExprElementListSyntax(elements: arguments, arena: parser.arena))
342+
return .argumentList(RawLabeledExprListSyntax(elements: arguments, arena: parser.arena))
343343
}
344344
}
345345
}
346346
}
347347

348348
extension Parser {
349-
mutating func parseAttachedArguments() -> [RawTupleExprElementSyntax] {
349+
mutating func parseAttachedArguments() -> [RawLabeledExprSyntax] {
350350
let (unexpectedBeforeRole, role) = self.expect(.identifier, TokenSpec(.extension, remapping: .identifier), default: .identifier)
351351
let roleTrailingComma = self.consume(if: .comma)
352-
let roleElement = RawTupleExprElementSyntax(
352+
let roleElement = RawLabeledExprSyntax(
353353
label: nil,
354354
colon: nil,
355355
expression: RawExprSyntax(

Sources/SwiftParser/Declarations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ extension Parser {
19151915

19161916
// Parse the optional parenthesized argument list.
19171917
let leftParen = self.consume(if: TokenSpec(.leftParen, allowAtStartOfLine: false))
1918-
let args: [RawTupleExprElementSyntax]
1918+
let args: [RawLabeledExprSyntax]
19191919
let unexpectedBeforeRightParen: RawUnexpectedNodesSyntax?
19201920
let rightParen: RawTokenSyntax?
19211921
if leftParen != nil {
@@ -1949,7 +1949,7 @@ extension Parser {
19491949
macroName: macro,
19501950
genericArgumentClause: generics,
19511951
leftParen: leftParen,
1952-
arguments: RawTupleExprElementListSyntax(
1952+
arguments: RawLabeledExprListSyntax(
19531953
elements: args,
19541954
arena: self.arena
19551955
),

0 commit comments

Comments
 (0)