Skip to content

Commit 14dcd7b

Browse files
committed
Add supporting code.
1 parent 0dad1b1 commit 14dcd7b

File tree

14 files changed

+513
-3
lines changed

14 files changed

+513
-3
lines changed

Sources/SwiftParser/generated/ExperimentalFeatures.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ extension Parser.ExperimentalFeatures {
5151
/// Whether to enable the parsing of 'unsafe' expression.
5252
public static let unsafeExpression = Self (rawValue: 1 << 8)
5353

54+
/// Whether to enable the parsing of keypaths with method members.
55+
public static let keypathWithMethodMembers = Self (rawValue: 1 << 9)
56+
5457
/// Creates a new value representing the experimental feature with the
5558
/// given name, or returns nil if the name is not recognized.
5659
public init?(name: String) {
@@ -73,6 +76,8 @@ extension Parser.ExperimentalFeatures {
7376
self = .abiAttribute
7477
case "WarnUnsafe":
7578
self = .unsafeExpression
79+
case "KeypathWithMethodMembers":
80+
self = .keypathWithMethodMembers
7681
default:
7782
return nil
7883
}

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
@@ -241,6 +241,8 @@ extension SyntaxKind {
241241
return "key path component"
242242
case .keyPathExpr:
243243
return "key path"
244+
case .keyPathMethodComponent:
245+
return "key path method component"
244246
case .keyPathOptionalComponent:
245247
return "key path optional component"
246248
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,24 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
18871887
return "components"
18881888
case \KeyPathExprSyntax.unexpectedAfterComponents:
18891889
return "unexpectedAfterComponents"
1890+
case \KeyPathMethodComponentSyntax.unexpectedBeforeDeclName:
1891+
return "unexpectedBeforeDeclName"
1892+
case \KeyPathMethodComponentSyntax.declName:
1893+
return "declName"
1894+
case \KeyPathMethodComponentSyntax.unexpectedBetweenDeclNameAndLeftParen:
1895+
return "unexpectedBetweenDeclNameAndLeftParen"
1896+
case \KeyPathMethodComponentSyntax.leftParen:
1897+
return "leftParen"
1898+
case \KeyPathMethodComponentSyntax.unexpectedBetweenLeftParenAndArguments:
1899+
return "unexpectedBetweenLeftParenAndArguments"
1900+
case \KeyPathMethodComponentSyntax.arguments:
1901+
return "arguments"
1902+
case \KeyPathMethodComponentSyntax.unexpectedBetweenArgumentsAndRightParen:
1903+
return "unexpectedBetweenArgumentsAndRightParen"
1904+
case \KeyPathMethodComponentSyntax.rightParen:
1905+
return "rightParen"
1906+
case \KeyPathMethodComponentSyntax.unexpectedAfterRightParen:
1907+
return "unexpectedAfterRightParen"
18901908
case \KeyPathOptionalComponentSyntax.unexpectedBeforeQuestionOrExclamationMark:
18911909
return "unexpectedBeforeQuestionOrExclamationMark"
18921910
case \KeyPathOptionalComponentSyntax.questionOrExclamationMark:

Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,20 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
12921292
visitAnyPost(node._syntaxNode)
12931293
}
12941294

1295+
#if compiler(>=5.8)
1296+
@_spi(ExperimentalLanguageFeatures)
1297+
#endif
1298+
override open func visit(_ node: KeyPathMethodComponentSyntax) -> SyntaxVisitorContinueKind {
1299+
return visitAny(node._syntaxNode)
1300+
}
1301+
1302+
#if compiler(>=5.8)
1303+
@_spi(ExperimentalLanguageFeatures)
1304+
#endif
1305+
override open func visitPost(_ node: KeyPathMethodComponentSyntax) {
1306+
visitAnyPost(node._syntaxNode)
1307+
}
1308+
12951309
override open func visit(_ node: KeyPathOptionalComponentSyntax) -> SyntaxVisitorContinueKind {
12961310
return visitAny(node._syntaxNode)
12971311
}

Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,7 @@ extension Syntax {
16711671
.node(KeyPathComponentListSyntax.self),
16721672
.node(KeyPathComponentSyntax.self),
16731673
.node(KeyPathExprSyntax.self),
1674+
.node(KeyPathMethodComponentSyntax.self),
16741675
.node(KeyPathOptionalComponentSyntax.self),
16751676
.node(KeyPathPropertyComponentSyntax.self),
16761677
.node(KeyPathSubscriptComponentSyntax.self),

Sources/SwiftSyntax/generated/SyntaxEnum.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ public enum SyntaxEnum: Sendable {
174174
case keyPathComponentList(KeyPathComponentListSyntax)
175175
case keyPathComponent(KeyPathComponentSyntax)
176176
case keyPathExpr(KeyPathExprSyntax)
177+
#if compiler(>=5.8)
178+
@_spi(ExperimentalLanguageFeatures)
179+
#endif
180+
case keyPathMethodComponent(KeyPathMethodComponentSyntax)
177181
case keyPathOptionalComponent(KeyPathOptionalComponentSyntax)
178182
case keyPathPropertyComponent(KeyPathPropertyComponentSyntax)
179183
case keyPathSubscriptComponent(KeyPathSubscriptComponentSyntax)
@@ -635,6 +639,8 @@ extension Syntax {
635639
return .keyPathComponent(KeyPathComponentSyntax(self)!)
636640
case .keyPathExpr:
637641
return .keyPathExpr(KeyPathExprSyntax(self)!)
642+
case .keyPathMethodComponent:
643+
return .keyPathMethodComponent(KeyPathMethodComponentSyntax(self)!)
638644
case .keyPathOptionalComponent:
639645
return .keyPathOptionalComponent(KeyPathOptionalComponentSyntax(self)!)
640646
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxKind.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ public enum SyntaxKind: Sendable {
174174
case keyPathComponentList
175175
case keyPathComponent
176176
case keyPathExpr
177+
#if compiler(>=5.8)
178+
@_spi(ExperimentalLanguageFeatures)
179+
#endif
180+
case keyPathMethodComponent
177181
case keyPathOptionalComponent
178182
case keyPathPropertyComponent
179183
case keyPathSubscriptComponent
@@ -760,6 +764,8 @@ public enum SyntaxKind: Sendable {
760764
return KeyPathComponentSyntax.self
761765
case .keyPathExpr:
762766
return KeyPathExprSyntax.self
767+
case .keyPathMethodComponent:
768+
return KeyPathMethodComponentSyntax.self
763769
case .keyPathOptionalComponent:
764770
return KeyPathOptionalComponentSyntax.self
765771
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxRewriter.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,16 @@ open class SyntaxRewriter {
11751175
return ExprSyntax(KeyPathExprSyntax(unsafeCasting: visitChildren(node._syntaxNode)))
11761176
}
11771177

1178+
/// Visit a `KeyPathMethodComponentSyntax`.
1179+
/// - Parameter node: the node that is being visited
1180+
/// - Returns: the rewritten node
1181+
#if compiler(>=5.8)
1182+
@_spi(ExperimentalLanguageFeatures)
1183+
#endif
1184+
open func visit(_ node: KeyPathMethodComponentSyntax) -> KeyPathMethodComponentSyntax {
1185+
return KeyPathMethodComponentSyntax(unsafeCasting: visitChildren(node._syntaxNode))
1186+
}
1187+
11781188
/// Visit a ``KeyPathOptionalComponentSyntax``.
11791189
/// - Parameter node: the node that is being visited
11801190
/// - Returns: the rewritten node
@@ -2919,6 +2929,11 @@ open class SyntaxRewriter {
29192929
Syntax(visit(KeyPathExprSyntax(unsafeCasting: node)))
29202930
}
29212931

2932+
@inline(never)
2933+
private func visitKeyPathMethodComponentSyntaxImpl(_ node: Syntax) -> Syntax {
2934+
Syntax(visit(KeyPathMethodComponentSyntax(unsafeCasting: node)))
2935+
}
2936+
29222937
@inline(never)
29232938
private func visitKeyPathOptionalComponentSyntaxImpl(_ node: Syntax) -> Syntax {
29242939
Syntax(visit(KeyPathOptionalComponentSyntax(unsafeCasting: node)))
@@ -3913,6 +3928,8 @@ open class SyntaxRewriter {
39133928
return self.visitKeyPathComponentSyntaxImpl(_:)
39143929
case .keyPathExpr:
39153930
return self.visitKeyPathExprSyntaxImpl(_:)
3931+
case .keyPathMethodComponent:
3932+
return self.visitKeyPathMethodComponentSyntaxImpl(_:)
39163933
case .keyPathOptionalComponent:
39173934
return self.visitKeyPathOptionalComponentSyntaxImpl(_:)
39183935
case .keyPathPropertyComponent:
@@ -4493,6 +4510,8 @@ open class SyntaxRewriter {
44934510
return visitKeyPathComponentSyntaxImpl(node)
44944511
case .keyPathExpr:
44954512
return visitKeyPathExprSyntaxImpl(node)
4513+
case .keyPathMethodComponent:
4514+
return visitKeyPathMethodComponentSyntaxImpl(node)
44964515
case .keyPathOptionalComponent:
44974516
return visitKeyPathOptionalComponentSyntaxImpl(node)
44984517
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxVisitor.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,24 @@ open class SyntaxVisitor {
18821882
open func visitPost(_ node: KeyPathExprSyntax) {
18831883
}
18841884

1885+
/// Visiting `KeyPathMethodComponentSyntax` specifically.
1886+
/// - Parameter node: the node we are visiting.
1887+
/// - Returns: how should we continue visiting.
1888+
#if compiler(>=5.8)
1889+
@_spi(ExperimentalLanguageFeatures)
1890+
#endif
1891+
open func visit(_ node: KeyPathMethodComponentSyntax) -> SyntaxVisitorContinueKind {
1892+
return .visitChildren
1893+
}
1894+
1895+
/// The function called after visiting `KeyPathMethodComponentSyntax` and its descendants.
1896+
/// - node: the node we just finished visiting.
1897+
#if compiler(>=5.8)
1898+
@_spi(ExperimentalLanguageFeatures)
1899+
#endif
1900+
open func visitPost(_ node: KeyPathMethodComponentSyntax) {
1901+
}
1902+
18851903
/// Visiting ``KeyPathOptionalComponentSyntax`` specifically.
18861904
/// - Parameter node: the node we are visiting.
18871905
/// - Returns: how should we continue visiting.
@@ -4739,6 +4757,14 @@ open class SyntaxVisitor {
47394757
visitPost(KeyPathExprSyntax(unsafeCasting: node))
47404758
}
47414759

4760+
@inline(never)
4761+
private func visitKeyPathMethodComponentSyntaxImpl(_ node: Syntax) {
4762+
if visit(KeyPathMethodComponentSyntax(unsafeCasting: node)) == .visitChildren {
4763+
visitChildren(node)
4764+
}
4765+
visitPost(KeyPathMethodComponentSyntax(unsafeCasting: node))
4766+
}
4767+
47424768
@inline(never)
47434769
private func visitKeyPathOptionalComponentSyntaxImpl(_ node: Syntax) {
47444770
if visit(KeyPathOptionalComponentSyntax(unsafeCasting: node)) == .visitChildren {
@@ -6129,6 +6155,8 @@ open class SyntaxVisitor {
61296155
return self.visitKeyPathComponentSyntaxImpl(_:)
61306156
case .keyPathExpr:
61316157
return self.visitKeyPathExprSyntaxImpl(_:)
6158+
case .keyPathMethodComponent:
6159+
return self.visitKeyPathMethodComponentSyntaxImpl(_:)
61326160
case .keyPathOptionalComponent:
61336161
return self.visitKeyPathOptionalComponentSyntaxImpl(_:)
61346162
case .keyPathPropertyComponent:
@@ -6709,6 +6737,8 @@ open class SyntaxVisitor {
67096737
self.visitKeyPathComponentSyntaxImpl(node)
67106738
case .keyPathExpr:
67116739
self.visitKeyPathExprSyntaxImpl(node)
6740+
case .keyPathMethodComponent:
6741+
self.visitKeyPathMethodComponentSyntaxImpl(node)
67126742
case .keyPathOptionalComponent:
67136743
self.visitKeyPathOptionalComponentSyntaxImpl(node)
67146744
case .keyPathPropertyComponent:

0 commit comments

Comments
 (0)