Skip to content

Commit 9b5dc51

Browse files
committed
Add supporting code.
1 parent b97ca6e commit 9b5dc51

File tree

14 files changed

+495
-3
lines changed

14 files changed

+495
-3
lines changed

Sources/SwiftParser/generated/ExperimentalFeatures.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ extension Parser.ExperimentalFeatures {
4848
/// Whether to enable the parsing of @abi attribute.
4949
public static let abiAttribute = Self (rawValue: 1 << 7)
5050

51+
/// Whether to enable the parsing of keypaths with method members.
52+
public static let keypathWithMethodMembers = Self (rawValue: 1 << 8)
53+
5154
/// Creates a new value representing the experimental feature with the
5255
/// given name, or returns nil if the name is not recognized.
5356
public init?(name: String) {
@@ -68,6 +71,8 @@ extension Parser.ExperimentalFeatures {
6871
self = .valueGenerics
6972
case "ABIAttribute":
7073
self = .abiAttribute
74+
case "KeypathWithMethodMembers":
75+
self = .keypathWithMethodMembers
7176
default:
7277
return nil
7378
}

Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? {
206206
return "generic where clause"
207207
case \KeyPathExprSyntax.root:
208208
return "root"
209+
case \KeyPathMethodComponentSyntax.arguments:
210+
return "arguments"
209211
case \KeyPathSubscriptComponentSyntax.arguments:
210212
return "arguments"
211213
case \LabeledExprSyntax.label:

Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ extension SyntaxKind {
249249
return "key path component"
250250
case .keyPathExpr:
251251
return "key path"
252+
case .keyPathMethodComponent:
253+
return "key path method component"
252254
case .keyPathOptionalComponent:
253255
return "key path optional component"
254256
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,24 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
19511951
return "components"
19521952
case \KeyPathExprSyntax.unexpectedAfterComponents:
19531953
return "unexpectedAfterComponents"
1954+
case \KeyPathMethodComponentSyntax.unexpectedBeforeDeclName:
1955+
return "unexpectedBeforeDeclName"
1956+
case \KeyPathMethodComponentSyntax.declName:
1957+
return "declName"
1958+
case \KeyPathMethodComponentSyntax.unexpectedBetweenDeclNameAndLeftParen:
1959+
return "unexpectedBetweenDeclNameAndLeftParen"
1960+
case \KeyPathMethodComponentSyntax.leftParen:
1961+
return "leftParen"
1962+
case \KeyPathMethodComponentSyntax.unexpectedBetweenLeftParenAndArguments:
1963+
return "unexpectedBetweenLeftParenAndArguments"
1964+
case \KeyPathMethodComponentSyntax.arguments:
1965+
return "arguments"
1966+
case \KeyPathMethodComponentSyntax.unexpectedBetweenArgumentsAndRightParen:
1967+
return "unexpectedBetweenArgumentsAndRightParen"
1968+
case \KeyPathMethodComponentSyntax.rightParen:
1969+
return "rightParen"
1970+
case \KeyPathMethodComponentSyntax.unexpectedAfterRightParen:
1971+
return "unexpectedAfterRightParen"
19541972
case \KeyPathOptionalComponentSyntax.unexpectedBeforeQuestionOrExclamationMark:
19551973
return "unexpectedBeforeQuestionOrExclamationMark"
19561974
case \KeyPathOptionalComponentSyntax.questionOrExclamationMark:

Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,16 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
13241324
visitAnyPost(node._syntaxNode)
13251325
}
13261326

1327+
@_spi(ExperimentalLanguageFeatures)
1328+
override open func visit(_ node: KeyPathMethodComponentSyntax) -> SyntaxVisitorContinueKind {
1329+
return visitAny(node._syntaxNode)
1330+
}
1331+
1332+
@_spi(ExperimentalLanguageFeatures)
1333+
override open func visitPost(_ node: KeyPathMethodComponentSyntax) {
1334+
visitAnyPost(node._syntaxNode)
1335+
}
1336+
13271337
override open func visit(_ node: KeyPathOptionalComponentSyntax) -> SyntaxVisitorContinueKind {
13281338
return visitAny(node._syntaxNode)
13291339
}

Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,7 @@ extension Syntax {
16761676
.node(KeyPathComponentListSyntax.self),
16771677
.node(KeyPathComponentSyntax.self),
16781678
.node(KeyPathExprSyntax.self),
1679+
.node(KeyPathMethodComponentSyntax.self),
16791680
.node(KeyPathOptionalComponentSyntax.self),
16801681
.node(KeyPathPropertyComponentSyntax.self),
16811682
.node(KeyPathSubscriptComponentSyntax.self),

Sources/SwiftSyntax/generated/SyntaxEnum.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ public enum SyntaxEnum: Sendable {
178178
case keyPathComponentList(KeyPathComponentListSyntax)
179179
case keyPathComponent(KeyPathComponentSyntax)
180180
case keyPathExpr(KeyPathExprSyntax)
181+
@_spi(ExperimentalLanguageFeatures)
182+
case keyPathMethodComponent(KeyPathMethodComponentSyntax)
181183
case keyPathOptionalComponent(KeyPathOptionalComponentSyntax)
182184
case keyPathPropertyComponent(KeyPathPropertyComponentSyntax)
183185
case keyPathSubscriptComponent(KeyPathSubscriptComponentSyntax)
@@ -638,6 +640,8 @@ extension Syntax {
638640
return .keyPathComponent(KeyPathComponentSyntax(self)!)
639641
case .keyPathExpr:
640642
return .keyPathExpr(KeyPathExprSyntax(self)!)
643+
case .keyPathMethodComponent:
644+
return .keyPathMethodComponent(KeyPathMethodComponentSyntax(self)!)
641645
case .keyPathOptionalComponent:
642646
return .keyPathOptionalComponent(KeyPathOptionalComponentSyntax(self)!)
643647
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxKind.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ public enum SyntaxKind: Sendable {
178178
case keyPathComponentList
179179
case keyPathComponent
180180
case keyPathExpr
181+
@_spi(ExperimentalLanguageFeatures)
182+
case keyPathMethodComponent
181183
case keyPathOptionalComponent
182184
case keyPathPropertyComponent
183185
case keyPathSubscriptComponent
@@ -763,6 +765,8 @@ public enum SyntaxKind: Sendable {
763765
return KeyPathComponentSyntax.self
764766
case .keyPathExpr:
765767
return KeyPathExprSyntax.self
768+
case .keyPathMethodComponent:
769+
return KeyPathMethodComponentSyntax.self
766770
case .keyPathOptionalComponent:
767771
return KeyPathOptionalComponentSyntax.self
768772
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxRewriter.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,14 @@ open class SyntaxRewriter {
12031203
return ExprSyntax(KeyPathExprSyntax(unsafeCasting: visitChildren(node._syntaxNode)))
12041204
}
12051205

1206+
/// Visit a `KeyPathMethodComponentSyntax`.
1207+
/// - Parameter node: the node that is being visited
1208+
/// - Returns: the rewritten node
1209+
@_spi(ExperimentalLanguageFeatures)
1210+
open func visit(_ node: KeyPathMethodComponentSyntax) -> KeyPathMethodComponentSyntax {
1211+
return KeyPathMethodComponentSyntax(unsafeCasting: visitChildren(node._syntaxNode))
1212+
}
1213+
12061214
/// Visit a ``KeyPathOptionalComponentSyntax``.
12071215
/// - Parameter node: the node that is being visited
12081216
/// - Returns: the rewritten node
@@ -2964,6 +2972,11 @@ open class SyntaxRewriter {
29642972
Syntax(visit(KeyPathExprSyntax(unsafeCasting: node)))
29652973
}
29662974

2975+
@inline(never)
2976+
private func visitKeyPathMethodComponentSyntaxImpl(_ node: Syntax) -> Syntax {
2977+
Syntax(visit(KeyPathMethodComponentSyntax(unsafeCasting: node)))
2978+
}
2979+
29672980
@inline(never)
29682981
private func visitKeyPathOptionalComponentSyntaxImpl(_ node: Syntax) -> Syntax {
29692982
Syntax(visit(KeyPathOptionalComponentSyntax(unsafeCasting: node)))
@@ -3971,6 +3984,8 @@ open class SyntaxRewriter {
39713984
return self.visitKeyPathComponentSyntaxImpl(_:)
39723985
case .keyPathExpr:
39733986
return self.visitKeyPathExprSyntaxImpl(_:)
3987+
case .keyPathMethodComponent:
3988+
return self.visitKeyPathMethodComponentSyntaxImpl(_:)
39743989
case .keyPathOptionalComponent:
39753990
return self.visitKeyPathOptionalComponentSyntaxImpl(_:)
39763991
case .keyPathPropertyComponent:
@@ -4561,6 +4576,8 @@ open class SyntaxRewriter {
45614576
return visitKeyPathComponentSyntaxImpl(node)
45624577
case .keyPathExpr:
45634578
return visitKeyPathExprSyntaxImpl(node)
4579+
case .keyPathMethodComponent:
4580+
return visitKeyPathMethodComponentSyntaxImpl(node)
45644581
case .keyPathOptionalComponent:
45654582
return visitKeyPathOptionalComponentSyntaxImpl(node)
45664583
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxVisitor.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,20 @@ open class SyntaxVisitor {
19301930
open func visitPost(_ node: KeyPathExprSyntax) {
19311931
}
19321932

1933+
/// Visiting `KeyPathMethodComponentSyntax` specifically.
1934+
/// - Parameter node: the node we are visiting.
1935+
/// - Returns: how should we continue visiting.
1936+
@_spi(ExperimentalLanguageFeatures)
1937+
open func visit(_ node: KeyPathMethodComponentSyntax) -> SyntaxVisitorContinueKind {
1938+
return .visitChildren
1939+
}
1940+
1941+
/// The function called after visiting `KeyPathMethodComponentSyntax` and its descendants.
1942+
/// - node: the node we just finished visiting.
1943+
@_spi(ExperimentalLanguageFeatures)
1944+
open func visitPost(_ node: KeyPathMethodComponentSyntax) {
1945+
}
1946+
19331947
/// Visiting ``KeyPathOptionalComponentSyntax`` specifically.
19341948
/// - Parameter node: the node we are visiting.
19351949
/// - Returns: how should we continue visiting.
@@ -4811,6 +4825,14 @@ open class SyntaxVisitor {
48114825
visitPost(KeyPathExprSyntax(unsafeCasting: node))
48124826
}
48134827

4828+
@inline(never)
4829+
private func visitKeyPathMethodComponentSyntaxImpl(_ node: Syntax) {
4830+
if visit(KeyPathMethodComponentSyntax(unsafeCasting: node)) == .visitChildren {
4831+
visitChildren(node)
4832+
}
4833+
visitPost(KeyPathMethodComponentSyntax(unsafeCasting: node))
4834+
}
4835+
48144836
@inline(never)
48154837
private func visitKeyPathOptionalComponentSyntaxImpl(_ node: Syntax) {
48164838
if visit(KeyPathOptionalComponentSyntax(unsafeCasting: node)) == .visitChildren {
@@ -6217,6 +6239,8 @@ open class SyntaxVisitor {
62176239
return self.visitKeyPathComponentSyntaxImpl(_:)
62186240
case .keyPathExpr:
62196241
return self.visitKeyPathExprSyntaxImpl(_:)
6242+
case .keyPathMethodComponent:
6243+
return self.visitKeyPathMethodComponentSyntaxImpl(_:)
62206244
case .keyPathOptionalComponent:
62216245
return self.visitKeyPathOptionalComponentSyntaxImpl(_:)
62226246
case .keyPathPropertyComponent:
@@ -6807,6 +6831,8 @@ open class SyntaxVisitor {
68076831
self.visitKeyPathComponentSyntaxImpl(node)
68086832
case .keyPathExpr:
68096833
self.visitKeyPathExprSyntaxImpl(node)
6834+
case .keyPathMethodComponent:
6835+
self.visitKeyPathMethodComponentSyntaxImpl(node)
68106836
case .keyPathOptionalComponent:
68116837
self.visitKeyPathOptionalComponentSyntaxImpl(node)
68126838
case .keyPathPropertyComponent:

0 commit comments

Comments
 (0)