mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01: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:
@@ -37,11 +37,10 @@ auto SemanticsHandleIfExpressionElse(SemanticsContext& context,
|
||||
ParseTree::Node else_node) -> bool {
|
||||
auto else_value_id = context.node_stack().Pop<SemanticsNodeId>();
|
||||
auto [then_node, then_end_block_id] =
|
||||
context.node_stack().PopWithParseNode<SemanticsNodeBlockId>(
|
||||
ParseNodeKind::IfExpressionThen);
|
||||
context.node_stack().PopWithParseNode<ParseNodeKind::IfExpressionThen>();
|
||||
auto then_value_id = context.node_stack().Pop<SemanticsNodeId>();
|
||||
auto if_node =
|
||||
context.node_stack().PopForSoloParseNode(ParseNodeKind::IfExpressionIf);
|
||||
context.node_stack().PopForSoloParseNode<ParseNodeKind::IfExpressionIf>();
|
||||
|
||||
// Convert the `else` value to the `then` value's type, and finish the `else`
|
||||
// block.
|
||||
@@ -58,7 +57,7 @@ auto SemanticsHandleIfExpressionElse(SemanticsContext& context,
|
||||
context.AddCurrentCodeBlockToFunction();
|
||||
|
||||
// Push the result value.
|
||||
context.node_stack().Push(if_node, chosen_value_id);
|
||||
context.node_stack().Push(else_node, chosen_value_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user