mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[libSyntax] Fix parsing for KeyPath
This commit is contained in:
@@ -300,7 +300,9 @@ EXPR_NODES = [
|
||||
# a.b
|
||||
Node('MemberAccessExpr', kind='Expr',
|
||||
children=[
|
||||
Child("Base", kind='Expr'),
|
||||
# The base needs to be optional to parse expressions in key paths
|
||||
# like \.a
|
||||
Child("Base", kind='Expr', is_optional=True),
|
||||
Child("Dot", kind='PeriodToken'),
|
||||
Child("Name", kind='Token'),
|
||||
Child('DeclNameArguments', kind='DeclNameArguments',
|
||||
@@ -496,9 +498,17 @@ EXPR_NODES = [
|
||||
Node('KeyPathExpr', kind='Expr',
|
||||
children=[
|
||||
Child('Backslash', kind='BackslashToken'),
|
||||
Child('RootExpr', kind='IdentifierExpr', is_optional=True),
|
||||
Child('Expression', kind='Expr'),
|
||||
]),
|
||||
|
||||
# The period in the key path serves as the base on which the
|
||||
# right-hand-side of the key path is evaluated
|
||||
Node('KeyPathBaseExpr', kind='Expr',
|
||||
children=[
|
||||
Child('Period', kind='PeriodToken'),
|
||||
]),
|
||||
|
||||
# e.g. "a." or "a"
|
||||
Node('ObjcNamePiece', kind='Syntax',
|
||||
children=[
|
||||
|
||||
Reference in New Issue
Block a user