mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 11:45:49 +01:00
Unify DeclaredName and DesignatedName as just Identifier (#2939)
This is just a simplification: I think these different forms are getting in the way more than they're helping, particularly as I was looking into namespace functionality. The handling in semantics can be identical, providing a more uniform behavior.
This commit is contained in:
@@ -49,7 +49,7 @@ static auto ParserHandlePattern(ParserContext& context,
|
||||
// The first item should be an identifier or, for deduced parameters, `self`.
|
||||
bool has_name = false;
|
||||
if (auto identifier = context.ConsumeIf(TokenKind::Identifier)) {
|
||||
context.AddLeafNode(ParseNodeKind::DeclaredName, *identifier);
|
||||
context.AddLeafNode(ParseNodeKind::Identifier, *identifier);
|
||||
has_name = true;
|
||||
} else if (pattern_kind == ParserContext::PatternKind::DeducedParameter) {
|
||||
if (auto self = context.ConsumeIf(TokenKind::SelfValueIdentifier)) {
|
||||
@@ -59,7 +59,7 @@ static auto ParserHandlePattern(ParserContext& context,
|
||||
}
|
||||
if (!has_name) {
|
||||
// Add a placeholder for the name.
|
||||
context.AddLeafNode(ParseNodeKind::DeclaredName, *context.position(),
|
||||
context.AddLeafNode(ParseNodeKind::Identifier, *context.position(),
|
||||
/*has_error=*/true);
|
||||
on_error();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user