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
@@ -21,7 +21,7 @@ auto SemanticsHandleStructFieldDesignator(SemanticsContext& context,
// This leaves the designated name on top because the `.` isn't interesting.
CARBON_CHECK(
context.parse_tree().node_kind(context.node_stack().PeekParseNode()) ==
ParseNodeKind::DesignatedName);
ParseNodeKind::Identifier);
return true;
}
@@ -33,7 +33,7 @@ auto SemanticsHandleStructFieldType(SemanticsContext& context,
auto [name_node, name_id] =
context.node_stack().PopWithParseNode<SemanticsStringId>(
ParseNodeKind::DesignatedName);
ParseNodeKind::Identifier);
context.AddNode(
SemanticsNode::StructTypeField::Make(name_node, cast_type_id, name_id));
@@ -50,8 +50,8 @@ auto SemanticsHandleStructFieldValue(SemanticsContext& context,
ParseTree::Node parse_node) -> bool {
auto [value_parse_node, value_node_id] =
context.node_stack().PopWithParseNode<SemanticsNodeId>();
auto name_id = context.node_stack().Pop<SemanticsStringId>(
ParseNodeKind::DesignatedName);
auto name_id =
context.node_stack().Pop<SemanticsStringId>(ParseNodeKind::Identifier);
// Store the name for the type.
auto type_block_id = context.args_type_info_stack().PeekForAdd();