Skip to content

Commit d8eaf70

Browse files
committed
Add supporting code.
1 parent bc1a469 commit d8eaf70

18 files changed

+477
-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/Documentation.docc/generated/SwiftSyntax.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
355355
- <doc:SwiftSyntax/GenericParameterClauseSyntax>
356356
- <doc:SwiftSyntax/InheritanceClauseSyntax>
357357
- <doc:SwiftSyntax/InitializerClauseSyntax>
358+
- <doc:SwiftSyntax/KeyPathMethodComponentSyntax>
358359
- <doc:SwiftSyntax/KeyPathOptionalComponentSyntax>
359360
- <doc:SwiftSyntax/KeyPathPropertyComponentSyntax>
360361
- <doc:SwiftSyntax/KeyPathSubscriptComponentSyntax>

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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,14 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
12921292
visitAnyPost(node._syntaxNode)
12931293
}
12941294

1295+
override open func visit(_ node: KeyPathMethodComponentSyntax) -> SyntaxVisitorContinueKind {
1296+
return visitAny(node._syntaxNode)
1297+
}
1298+
1299+
override open func visitPost(_ node: KeyPathMethodComponentSyntax) {
1300+
visitAnyPost(node._syntaxNode)
1301+
}
1302+
12951303
override open func visit(_ node: KeyPathOptionalComponentSyntax) -> SyntaxVisitorContinueKind {
12961304
return visitAny(node._syntaxNode)
12971305
}

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/SyntaxCollections.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ public struct KeyPathComponentListSyntax: SyntaxCollection, SyntaxHashable {
10141014
/// - ``AttributeSyntax``.``AttributeSyntax/arguments``
10151015
/// - ``ExpressionSegmentSyntax``.``ExpressionSegmentSyntax/expressions``
10161016
/// - ``FunctionCallExprSyntax``.``FunctionCallExprSyntax/arguments``
1017+
/// - ``KeyPathMethodComponentSyntax``.``KeyPathMethodComponentSyntax/arguments``
10171018
/// - ``KeyPathSubscriptComponentSyntax``.``KeyPathSubscriptComponentSyntax/arguments``
10181019
/// - ``MacroExpansionDeclSyntax``.``MacroExpansionDeclSyntax/arguments``
10191020
/// - ``MacroExpansionExprSyntax``.``MacroExpansionExprSyntax/arguments``

Sources/SwiftSyntax/generated/SyntaxEnum.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public enum SyntaxEnum: Sendable {
174174
case keyPathComponentList(KeyPathComponentListSyntax)
175175
case keyPathComponent(KeyPathComponentSyntax)
176176
case keyPathExpr(KeyPathExprSyntax)
177+
case keyPathMethodComponent(KeyPathMethodComponentSyntax)
177178
case keyPathOptionalComponent(KeyPathOptionalComponentSyntax)
178179
case keyPathPropertyComponent(KeyPathPropertyComponentSyntax)
179180
case keyPathSubscriptComponent(KeyPathSubscriptComponentSyntax)
@@ -635,6 +636,8 @@ extension Syntax {
635636
return .keyPathComponent(KeyPathComponentSyntax(self)!)
636637
case .keyPathExpr:
637638
return .keyPathExpr(KeyPathExprSyntax(self)!)
639+
case .keyPathMethodComponent:
640+
return .keyPathMethodComponent(KeyPathMethodComponentSyntax(self)!)
638641
case .keyPathOptionalComponent:
639642
return .keyPathOptionalComponent(KeyPathOptionalComponentSyntax(self)!)
640643
case .keyPathPropertyComponent:

Sources/SwiftSyntax/generated/SyntaxKind.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public enum SyntaxKind: Sendable {
174174
case keyPathComponentList
175175
case keyPathComponent
176176
case keyPathExpr
177+
case keyPathMethodComponent
177178
case keyPathOptionalComponent
178179
case keyPathPropertyComponent
179180
case keyPathSubscriptComponent
@@ -760,6 +761,8 @@ public enum SyntaxKind: Sendable {
760761
return KeyPathComponentSyntax.self
761762
case .keyPathExpr:
762763
return KeyPathExprSyntax.self
764+
case .keyPathMethodComponent:
765+
return KeyPathMethodComponentSyntax.self
763766
case .keyPathOptionalComponent:
764767
return KeyPathOptionalComponentSyntax.self
765768
case .keyPathPropertyComponent:

0 commit comments

Comments
 (0)