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:
Jon Ross-Perkins
2023-06-22 16:20:06 -07:00
committed by GitHub
parent 2e7ce09c34
commit 5a90f660b9
188 changed files with 487 additions and 498 deletions
+2 -2
View File
@@ -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;