Skip to content

Commit 9218888

Browse files
committed
Fix-ups to some of the syntax node renames
1 parent 5b07043 commit 9218888

Some content is hidden

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

43 files changed

+338
-351
lines changed

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ public let EXPR_NODES: [Node] = [
726726

727727
// expression segment in a string interpolation expression.
728728
Node(
729-
kind: .exprSegment,
729+
kind: .expressionSegment,
730730
base: .syntax,
731731
nameForDiagnostics: nil,
732732
traits: [
@@ -1514,7 +1514,7 @@ public let EXPR_NODES: [Node] = [
15141514
kind: .stringLiteralSegmentList,
15151515
base: .syntaxCollection,
15161516
nameForDiagnostics: nil,
1517-
elementChoices: [.stringSegment, .exprSegment]
1517+
elementChoices: [.stringSegment, .expressionSegment]
15181518
),
15191519

15201520
// string literal segment in a string interpolation expression.
@@ -1624,9 +1624,10 @@ public let EXPR_NODES: [Node] = [
16241624
traits: ["WithStatements"],
16251625
children: [
16261626
Child(
1627-
name: "UnknownAttribute",
1627+
name: "Attribute",
16281628
deprecatedName: "UnknownAttr",
16291629
kind: .node(kind: .attribute),
1630+
documentation: "The `@unknown` attribute of a default label, if present.",
16301631
isOptional: true
16311632
),
16321633
Child(

CodeGeneration/Sources/SyntaxSupport/PatternNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public let PATTERN_NODES: [Node] = [
1414
// expr-pattern -> expr
1515
Node(
16-
kind: .exprPattern,
16+
kind: .expressionPattern,
1717
base: .pattern,
1818
nameForDiagnostics: "pattern",
1919
children: [

CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public let STMT_NODES: [Node] = [
261261

262262
// fallthrough-stmt -> 'fallthrough' ';'?
263263
Node(
264-
kind: .fallThroughtStmt,
264+
kind: .fallThroughStmt,
265265
base: .stmt,
266266
nameForDiagnostics: "'fallthrough' statement",
267267
children: [

CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ public enum SyntaxNodeKind: String, CaseIterable {
128128
case exposeAttributeArguments
129129
case exprList
130130
case expr
131-
case exprPattern
132-
case exprSegment
131+
case expressionPattern
132+
case expressionSegment
133133
case expressionStmt
134134
case extensionDecl
135-
case fallThroughtStmt
135+
case fallThroughStmt
136136
case floatLiteralExpr
137137
case forStmt
138138
case forceUnwrapExpr
@@ -401,8 +401,6 @@ public enum SyntaxNodeKind: String, CaseIterable {
401401
case .differentiabilityArguments: return "differentiabilityParams"
402402
case .differentiabilityArgument: return "differentiabilityParam"
403403
case .dynamicReplacementAttributeArguments: return "dynamicReplacementArguments"
404-
case .exprPattern: return "expressionPattern"
405-
case .exprSegment: return "expressionSegment"
406404
case .forceUnwrapExpr: return "forcedValueExpr"
407405
case .forStmt: return "forInStmt"
408406
case .labeledSpecializeArgument: return "labeledSpecializeEntry"
@@ -432,7 +430,7 @@ public enum SyntaxNodeKind: String, CaseIterable {
432430
case .switchCaseItem: return "caseItem"
433431
case .closureCaptureClause: return "closureCaptureSignature"
434432
case .designatedType: return "designatedTypeElement"
435-
case .fallThroughtStmt: return "fallthroughStmt"
433+
case .fallThroughStmt: return "fallthroughStmt"
436434
case .patternExpr: return "unresolvedPatternExpr"
437435
case .subscriptCallExpr: return "subscriptExpr"
438436
case .unresolvedInfixOperatorExpr: return "binaryOperatorExpr"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ let rawSyntaxNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
113113
let cases = SwitchCaseItemListSyntax {
114114
for n in SYNTAX_NODES where n.base == node.kind {
115115
SwitchCaseItemSyntax(
116-
pattern: ExprPatternSyntax(
116+
pattern: ExpressionPatternSyntax(
117117
expression: ExprSyntax(".\(raw: n.varOrCaseName)")
118118
)
119119
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
111111
SwitchCaseLabelSyntax {
112112
for childNode in SYNTAX_NODES where childNode.base == node.kind {
113113
SwitchCaseItemSyntax(
114-
pattern: ExprPatternSyntax(
114+
pattern: ExpressionPatternSyntax(
115115
expression: ExprSyntax(".\(childNode.varOrCaseName)")
116116
)
117117
)
@@ -144,7 +144,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
144144
SwitchCaseLabelSyntax {
145145
for childNode in SYNTAX_NODES where childNode.base == node.kind {
146146
SwitchCaseItemSyntax(
147-
pattern: ExprPatternSyntax(
147+
pattern: ExpressionPatternSyntax(
148148
expression: ExprSyntax(".\(childNode.varOrCaseName)")
149149
)
150150
)

CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class ValidateSyntaxNodes: XCTestCase {
292292
message: "child 'ClosingPounds' has a token as its only token choice and should thus be named 'RawStringPoundDelimiter'"
293293
),
294294
ValidationFailure(
295-
node: .exprSegment,
295+
node: .expressionSegment,
296296
message: "child 'Pounds' has a token as its only token choice and should thus be named 'RawStringPoundDelimiter'"
297297
),
298298

Sources/SwiftBasicFormat/BasicFormat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ open class BasicFormat: SyntaxRewriter {
109109
var ancestor: Syntax = Syntax(token)
110110
while let parent = ancestor.parent {
111111
ancestor = parent
112-
if ancestor.is(ExprSegmentSyntax.self) {
112+
if ancestor.is(ExpressionSegmentSyntax.self) {
113113
return true
114114
}
115115
}

Sources/SwiftParser/Expressions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ extension Parser {
21962196
elements.append(
21972197
.switchCase(
21982198
RawSwitchCaseSyntax(
2199-
unknownAttribute: nil,
2199+
attribute: nil,
22002200
label: .case(
22012201
RawSwitchCaseLabelSyntax(
22022202
caseKeyword: missingToken(.case),
@@ -2290,7 +2290,7 @@ extension Parser {
22902290
let statements = parseSwitchCaseBody()
22912291

22922292
return RawSwitchCaseSyntax(
2293-
unknownAttribute: unknownAttr,
2293+
attribute: unknownAttr,
22942294
label: label,
22952295
statements: statements,
22962296
arena: self.arena

Sources/SwiftParser/Patterns.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ extension Parser {
252252
return RawPatternSyntax(pat.pattern)
253253
}
254254
let expr = RawExprSyntax(patternSyntax)
255-
return RawPatternSyntax(RawExprPatternSyntax(expression: expr, arena: self.arena))
255+
return RawPatternSyntax(RawExpressionPatternSyntax(expression: expr, arena: self.arena))
256256
}
257257
}
258258
}

0 commit comments

Comments
 (0)