Track the list of blocks that form the body of a function. (#2941)

Use that list for lowering in lexical order, instead of rediscovering
the list based on which blocks are referenced as branch targets.
This commit is contained in:
Richard Smith
2023-06-23 08:36:13 -07:00
committed by GitHub
parent 5a90f660b9
commit b908c6e274
61 changed files with 145 additions and 176 deletions
+2
View File
@@ -184,6 +184,7 @@ auto SemanticsHandleInfixOperator(SemanticsContext& context,
context.AddNodeToBlock(rhs_block_id,
SemanticsNode::BranchWithArg::Make(
parse_node, resume_block_id, rhs_id));
context.AddCurrentCodeBlockToFunction();
// Collect the result from either the first or second operand.
context.AddNodeAndPush(
@@ -539,6 +540,7 @@ auto SemanticsHandleShortCircuitOperand(SemanticsContext& context,
context.AddNodeToBlock(
lhs_block_id, SemanticsNode::BranchWithArg::Make(
parse_node, end_block_id, short_circuit_result_id));
context.AddCurrentCodeBlockToFunction();
// Put the condition back on the stack for SemanticsHandleInfixOperator.
context.node_stack().Push(parse_node, cond_value_id);