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
}

Sources/SwiftParser/Statements.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,9 @@ extension Parser {
776776
}
777777

778778
/// Parse a fallthrough statement.
779-
mutating func parseFallThroughStatement(fallthroughHandle: RecoveryConsumptionHandle) -> RawFallThroughtStmtSyntax {
779+
mutating func parseFallThroughStatement(fallthroughHandle: RecoveryConsumptionHandle) -> RawFallThroughStmtSyntax {
780780
let (unexpectedBeforeFallthroughKeyword, fallthroughKeyword) = self.eat(fallthroughHandle)
781-
return RawFallThroughtStmtSyntax(
781+
return RawFallThroughStmtSyntax(
782782
unexpectedBeforeFallthroughKeyword,
783783
fallthroughKeyword: fallthroughKeyword,
784784
arena: self.arena

Sources/SwiftParser/StringLiteralRepresentedLiteralValue.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension StringLiteralExprSyntax {
3636
delimiterLength: delimiterLength,
3737
to: &result
3838
)
39-
case .exprSegment:
39+
case .expressionSegment:
4040
// Bail out if there are any interpolation segments.
4141
return nil
4242
}

Sources/SwiftParser/StringLiterals.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fileprivate class StringLiteralExpressionIndentationChecker {
2222
self.arena = arena
2323
}
2424

25-
func checkIndentation(of expressionSegment: RawExprSegmentSyntax) -> RawExprSegmentSyntax? {
25+
func checkIndentation(of expressionSegment: RawExpressionSegmentSyntax) -> RawExpressionSegmentSyntax? {
2626
if let rewrittenSegment = self.visit(node: RawSyntax(expressionSegment)) {
27-
return rewrittenSegment.as(RawExprSegmentSyntax.self)
27+
return rewrittenSegment.as(RawExpressionSegmentSyntax.self)
2828
} else {
2929
return nil
3030
}
@@ -215,7 +215,7 @@ extension Parser {
215215
} else {
216216
return false
217217
}
218-
case .exprSegment:
218+
case .expressionSegment:
219219
return false
220220
case nil:
221221
return openQuoteHasTrailingNewline
@@ -275,11 +275,11 @@ extension Parser {
275275
|| (segment.content.trailingTriviaPieces.last?.isNewline ?? false)
276276

277277
middleSegments[index] = .stringSegment(segment)
278-
case .exprSegment(let segment):
278+
case .expressionSegment(let segment):
279279
isSegmentOnNewLine = segment.rightParen.trailingTriviaPieces.contains(where: { $0.isNewline })
280280

281281
if let rewrittenSegment = expressionIndentationChecker.checkIndentation(of: segment) {
282-
middleSegments[index] = .exprSegment(rewrittenSegment)
282+
middleSegments[index] = .expressionSegment(rewrittenSegment)
283283
}
284284
}
285285
}
@@ -531,8 +531,8 @@ extension Parser {
531531
self.lexemes.perform(stateTransition: .pop, currentToken: &self.currentToken)
532532
}
533533
segments.append(
534-
.exprSegment(
535-
RawExprSegmentSyntax(
534+
.expressionSegment(
535+
RawExpressionSegmentSyntax(
536536
backslash: backslash,
537537
unexpectedBeforeDelimiter,
538538
pounds: delimiter,

Sources/SwiftParserDiagnostics/MissingTokenError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ extension ParseDiagnosticsGenerator {
138138
) -> Bool {
139139
let isTooMany = invalidToken.trimmedLength > missingToken.trimmedLength
140140
let message: DiagnosticMessage
141-
if missingToken.parent?.is(ExprSegmentSyntax.self) == true {
141+
if missingToken.parent?.is(ExpressionSegmentSyntax.self) == true {
142142
message = .tooManyRawStringDelimitersToStartInterpolation
143143
} else {
144144
let parent = missingToken.parent!

Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
16271627
if shouldSkip(node) {
16281628
return .skipChildren
16291629
}
1630-
if node.unknownAttribute?.isMissingAllTokens != false && node.label.isMissingAllTokens {
1630+
if node.attribute?.isMissingAllTokens != false && node.label.isMissingAllTokens {
16311631
addDiagnostic(
16321632
node.statements,
16331633
.allStatementsInSwitchMustBeCoveredByCase,

Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ extension SyntaxKind {
161161
return "enum"
162162
case .exposeAttributeArguments:
163163
return "@_expose arguments"
164-
case .exprPattern:
164+
case .expressionPattern:
165165
return "pattern"
166166
case .expressionStmt:
167167
return "expression"
168168
case .extensionDecl:
169169
return "extension"
170-
case .fallThroughtStmt:
170+
case .fallThroughStmt:
171171
return "'fallthrough' statement"
172172
case .floatLiteralExpr:
173173
return "floating literal"

Sources/SwiftRefactor/FormatRawStringLiteral.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public struct FormatRawStringLiteral: SyntaxRefactoringProvider {
3535
var maximumHashes = 0
3636
for segment in lit.segments {
3737
switch segment {
38-
case .exprSegment(let expr):
38+
case .expressionSegment(let expr):
3939
if let rawStringDelimiter = expr.pounds {
4040
// Pick up any delimiters in interpolation segments \#...#(...)
4141
maximumHashes = max(maximumHashes, rawStringDelimiter.text.longestRun(of: "#"))

Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
149149
- <doc:SwiftSyntax/PatternSyntax>
150150
- <doc:SwiftSyntax/PatternSyntaxProtocol>
151151
- <doc:SwiftSyntax/MissingPatternSyntax>
152-
- <doc:SwiftSyntax/ExprPatternSyntax>
152+
- <doc:SwiftSyntax/ExpressionPatternSyntax>
153153
- <doc:SwiftSyntax/IdentifierPatternSyntax>
154154
- <doc:SwiftSyntax/IsTypePatternSyntax>
155155
- <doc:SwiftSyntax/TuplePatternSyntax>
@@ -167,7 +167,7 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
167167
- <doc:SwiftSyntax/DiscardStmtSyntax>
168168
- <doc:SwiftSyntax/DoStmtSyntax>
169169
- <doc:SwiftSyntax/ExpressionStmtSyntax>
170-
- <doc:SwiftSyntax/FallThroughtStmtSyntax>
170+
- <doc:SwiftSyntax/FallThroughStmtSyntax>
171171
- <doc:SwiftSyntax/ForStmtSyntax>
172172
- <doc:SwiftSyntax/GuardStmtSyntax>
173173
- <doc:SwiftSyntax/LabeledStmtSyntax>
@@ -286,7 +286,7 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
286286
- <doc:SwiftSyntax/GenericWhereClauseSyntax>
287287
- <doc:SwiftSyntax/StringLiteralSegmentListSyntax>
288288
- <doc:SwiftSyntax/StringSegmentSyntax>
289-
- <doc:SwiftSyntax/ExprSegmentSyntax>
289+
- <doc:SwiftSyntax/ExpressionSegmentSyntax>
290290
- <doc:SwiftSyntax/SwitchCaseItemListSyntax>
291291
- <doc:SwiftSyntax/SwitchCaseItemSyntax>
292292
- <doc:SwiftSyntax/SwitchCaseListSyntax>

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,33 +1221,33 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
12211221
return "cxxName"
12221222
case \ExposeAttributeArgumentsSyntax.unexpectedAfterCxxName:
12231223
return "unexpectedAfterCxxName"
1224-
case \ExprPatternSyntax.unexpectedBeforeExpression:
1224+
case \ExpressionPatternSyntax.unexpectedBeforeExpression:
12251225
return "unexpectedBeforeExpression"
1226-
case \ExprPatternSyntax.expression:
1226+
case \ExpressionPatternSyntax.expression:
12271227
return "expression"
1228-
case \ExprPatternSyntax.unexpectedAfterExpression:
1228+
case \ExpressionPatternSyntax.unexpectedAfterExpression:
12291229
return "unexpectedAfterExpression"
1230-
case \ExprSegmentSyntax.unexpectedBeforeBackslash:
1230+
case \ExpressionSegmentSyntax.unexpectedBeforeBackslash:
12311231
return "unexpectedBeforeBackslash"
1232-
case \ExprSegmentSyntax.backslash:
1232+
case \ExpressionSegmentSyntax.backslash:
12331233
return "backslash"
1234-
case \ExprSegmentSyntax.unexpectedBetweenBackslashAndPounds:
1234+
case \ExpressionSegmentSyntax.unexpectedBetweenBackslashAndPounds:
12351235
return "unexpectedBetweenBackslashAndPounds"
1236-
case \ExprSegmentSyntax.pounds:
1236+
case \ExpressionSegmentSyntax.pounds:
12371237
return "pounds"
1238-
case \ExprSegmentSyntax.unexpectedBetweenPoundsAndLeftParen:
1238+
case \ExpressionSegmentSyntax.unexpectedBetweenPoundsAndLeftParen:
12391239
return "unexpectedBetweenPoundsAndLeftParen"
1240-
case \ExprSegmentSyntax.leftParen:
1240+
case \ExpressionSegmentSyntax.leftParen:
12411241
return "leftParen"
1242-
case \ExprSegmentSyntax.unexpectedBetweenLeftParenAndExpressions:
1242+
case \ExpressionSegmentSyntax.unexpectedBetweenLeftParenAndExpressions:
12431243
return "unexpectedBetweenLeftParenAndExpressions"
1244-
case \ExprSegmentSyntax.expressions:
1244+
case \ExpressionSegmentSyntax.expressions:
12451245
return "expressions"
1246-
case \ExprSegmentSyntax.unexpectedBetweenExpressionsAndRightParen:
1246+
case \ExpressionSegmentSyntax.unexpectedBetweenExpressionsAndRightParen:
12471247
return "unexpectedBetweenExpressionsAndRightParen"
1248-
case \ExprSegmentSyntax.rightParen:
1248+
case \ExpressionSegmentSyntax.rightParen:
12491249
return "rightParen"
1250-
case \ExprSegmentSyntax.unexpectedAfterRightParen:
1250+
case \ExpressionSegmentSyntax.unexpectedAfterRightParen:
12511251
return "unexpectedAfterRightParen"
12521252
case \ExpressionStmtSyntax.unexpectedBeforeExpression:
12531253
return "unexpectedBeforeExpression"
@@ -1285,11 +1285,11 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
12851285
return "memberBlock"
12861286
case \ExtensionDeclSyntax.unexpectedAfterMemberBlock:
12871287
return "unexpectedAfterMemberBlock"
1288-
case \FallThroughtStmtSyntax.unexpectedBeforeFallthroughKeyword:
1288+
case \FallThroughStmtSyntax.unexpectedBeforeFallthroughKeyword:
12891289
return "unexpectedBeforeFallthroughKeyword"
1290-
case \FallThroughtStmtSyntax.fallthroughKeyword:
1290+
case \FallThroughStmtSyntax.fallthroughKeyword:
12911291
return "fallthroughKeyword"
1292-
case \FallThroughtStmtSyntax.unexpectedAfterFallthroughKeyword:
1292+
case \FallThroughStmtSyntax.unexpectedAfterFallthroughKeyword:
12931293
return "unexpectedAfterFallthroughKeyword"
12941294
case \FloatLiteralExprSyntax.unexpectedBeforeLiteral:
12951295
return "unexpectedBeforeLiteral"
@@ -3033,12 +3033,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
30333033
return "colon"
30343034
case \SwitchCaseLabelSyntax.unexpectedAfterColon:
30353035
return "unexpectedAfterColon"
3036-
case \SwitchCaseSyntax.unexpectedBeforeUnknownAttribute:
3037-
return "unexpectedBeforeUnknownAttribute"
3038-
case \SwitchCaseSyntax.unknownAttribute:
3039-
return "unknownAttribute"
3040-
case \SwitchCaseSyntax.unexpectedBetweenUnknownAttributeAndLabel:
3041-
return "unexpectedBetweenUnknownAttributeAndLabel"
3036+
case \SwitchCaseSyntax.unexpectedBeforeAttribute:
3037+
return "unexpectedBeforeAttribute"
3038+
case \SwitchCaseSyntax.attribute:
3039+
return "attribute"
3040+
case \SwitchCaseSyntax.unexpectedBetweenAttributeAndLabel:
3041+
return "unexpectedBetweenAttributeAndLabel"
30423042
case \SwitchCaseSyntax.label:
30433043
return "label"
30443044
case \SwitchCaseSyntax.unexpectedBetweenLabelAndStatements:

0 commit comments

Comments
 (0)