Skip to content

Commit e8bbace

Browse files
committed
Don't interleave UexpectedNodes in UnexpectedCodeDeclSyntax
1 parent 161643b commit e8bbace

File tree

6 files changed

+16
-55
lines changed

6 files changed

+16
-55
lines changed

CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ public let COMMON_NODES: [Node] = [
412412
// NOTE: This is not .collection() on purpose. We don't need collection related functions for this.
413413
kind: .node(kind: .unexpectedNodes)
414414
)
415-
]
415+
],
416+
noInterleaveUnexpected: true
416417
),
417418
]

CodeGeneration/Sources/SyntaxSupport/Node.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ public class Node: NodeChoiceConvertible {
127127
parserFunction: TokenSyntax? = nil,
128128
traits: [String] = [],
129129
children: [Child] = [],
130-
childHistory: Child.History = []
130+
childHistory: Child.History = [],
131+
noInterleaveUnexpected: Bool = false
131132
) {
132133
precondition(base != .syntaxCollection)
133134
precondition(base.isBase, "unknown base kind '\(base)' for node '\(kind)'")
@@ -140,7 +141,7 @@ public class Node: NodeChoiceConvertible {
140141
self.documentation = SwiftSyntax.Trivia.docCommentTrivia(from: documentation)
141142
self.parserFunction = parserFunction
142143

143-
let childrenWithUnexpected = kind.isBase ? children : interleaveUnexpectedChildren(children)
144+
let childrenWithUnexpected = (kind.isBase || noInterleaveUnexpected) ? children : interleaveUnexpectedChildren(children)
144145

145146
self.data = .layout(children: childrenWithUnexpected, childHistory: childHistory, traits: traits)
146147
}

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/raw/RawSyntaxNodesTUVWXYZ.swift

Lines changed: 4 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesTUVWXYZ.swift

Lines changed: 5 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)