mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-21 23:16:38 +00:00
Start node stack push/pop setting IdT based on ParseNodeKind. (#2985)
I think there's more we can do here, but this seemed like a good checkpoint to make sure the path I'm going down is roughly what you expected. There's one actual edit in if expression structure to match the increased enforcement.
This commit is contained in:
1 parent
c0d18a62eb
commit
9751b4701d
16 files changed
+167
-66
No files matched your search
@@ -32,8 +32,7 @@ auto SemanticsHandleStructFieldType(SemanticsContext& context,
|
||||
SemanticsTypeId cast_type_id = context.ExpressionAsType(type_node, type_id);
|
||||
|
||||
auto [name_node, name_id] =
|
||||
context.node_stack().PopWithParseNode<SemanticsStringId>(
|
||||
ParseNodeKind::Name);
|
||||
context.node_stack().PopWithParseNode<ParseNodeKind::Name>();
|
||||
|
||||
context.AddNode(
|
||||
SemanticsNode::StructTypeField::Make(name_node, cast_type_id, name_id));
|
||||
@@ -50,8 +49,7 @@ 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::Name);
|
||||
SemanticsStringId name_id = context.node_stack().Pop<ParseNodeKind::Name>();
|
||||
|
||||
// Store the name for the type.
|
||||
auto type_block_id = context.args_type_info_stack().PeekForAdd();
|
||||
@@ -72,8 +70,9 @@ auto SemanticsHandleStructLiteral(SemanticsContext& context,
|
||||
/*for_args=*/true, ParseNodeKind::StructLiteralOrStructTypeLiteralStart);
|
||||
|
||||
context.PopScope();
|
||||
context.node_stack().PopAndDiscardSoloParseNode(
|
||||
ParseNodeKind::StructLiteralOrStructTypeLiteralStart);
|
||||
context.node_stack()
|
||||
.PopAndDiscardSoloParseNode<
|
||||
ParseNodeKind::StructLiteralOrStructTypeLiteralStart>();
|
||||
auto type_block_id = context.args_type_info_stack().Pop();
|
||||
|
||||
auto type_id = context.CanonicalizeStructType(parse_node, type_block_id);
|
||||
@@ -102,8 +101,9 @@ auto SemanticsHandleStructTypeLiteral(SemanticsContext& context,
|
||||
/*for_args=*/false, ParseNodeKind::StructLiteralOrStructTypeLiteralStart);
|
||||
|
||||
context.PopScope();
|
||||
context.node_stack().PopAndDiscardSoloParseNode(
|
||||
ParseNodeKind::StructLiteralOrStructTypeLiteralStart);
|
||||
context.node_stack()
|
||||
.PopAndDiscardSoloParseNode<
|
||||
ParseNodeKind::StructLiteralOrStructTypeLiteralStart>();
|
||||
// This is only used for value literals.
|
||||
context.args_type_info_stack().Pop();
|
||||
|
||||
|
||||
Reference in new issue
Block a user