mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Parse self in expressions. (#2697)
`self` wasn't being handled in expression logic, only parameter logic. This is needed for `self.x`. Also renames SelfDeducedParameter to SelfIdentifier because it's parsed fairly consistently with Identifier; this better represents the situations where `self` will need to be handled, it's where `Identifier` is allowed (although `Identifier` could also refer to a type... but I still think `SelfDeducedParameter` is a more difficult to understand name).
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Sub'},
|
||||
// CHECK:STDOUT: {kind: 'DeducedParameterListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'SelfDeducedParameter', text: 'self'},
|
||||
// CHECK:STDOUT: {kind: 'SelfIdentifier', text: 'self'},
|
||||
// CHECK:STDOUT: {kind: 'SelfType', text: 'Self'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 4},
|
||||
@@ -28,7 +28,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Sub'},
|
||||
// CHECK:STDOUT: {kind: 'DeducedParameterListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'SelfDeducedParameter', text: 'self'},
|
||||
// CHECK:STDOUT: {kind: 'SelfIdentifier', text: 'self'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 4},
|
||||
|
||||
Reference in New Issue
Block a user