mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Track params in the parser (#4777)
This change splits `NodeKind::IdentifierName` into separate node kinds depending on whether the identifier is followed by parameters, and similarly splits `NameQualifier` based on whether the qualifier has parameters. This enables us to only push a pattern block when it's actually needed, rather than "defensively" pushing one when it might be needed. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
8f685b6953
commit
4f10735751
+3
-3
@@ -16,7 +16,7 @@ fn C() -> const (i32*) { return C(); }
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'A'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'A'},
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
@@ -31,7 +31,7 @@ fn C() -> const (i32*) { return C(); }
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 15},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'B'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'B'},
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'ParenExprStart', text: '('},
|
||||
@@ -48,7 +48,7 @@ fn C() -> const (i32*) { return C(); }
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'C'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'C'},
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'ParenExprStart', text: '('},
|
||||
|
||||
Reference in New Issue
Block a user