mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Model type expressions as regions (#4698)
This is a precondition for enabling the new pattern-matching subsystem to support binding patterns that have `if` expressions in the type position. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
95c9634c60
commit
a112cbde5c
@@ -28,7 +28,7 @@ auto HandleParseNode(Context& context, Parse::IfConditionId node_id) -> bool {
|
||||
// Start emitting the `then` block.
|
||||
context.inst_block_stack().Pop();
|
||||
context.inst_block_stack().Push(then_block_id);
|
||||
context.AddCurrentCodeBlockToFunction();
|
||||
context.AddToRegion(then_block_id, node_id);
|
||||
|
||||
context.node_stack().Push(node_id, else_block_id);
|
||||
return true;
|
||||
@@ -40,7 +40,7 @@ auto HandleParseNode(Context& context, Parse::IfStatementElseId node_id)
|
||||
|
||||
// Switch to emitting the `else` block.
|
||||
context.inst_block_stack().Push(else_block_id);
|
||||
context.AddCurrentCodeBlockToFunction();
|
||||
context.AddToRegion(else_block_id, node_id);
|
||||
|
||||
context.node_stack().Push(node_id);
|
||||
return true;
|
||||
@@ -56,6 +56,7 @@ auto HandleParseNode(Context& context, Parse::IfStatementId node_id) -> bool {
|
||||
context.AddInst<SemIR::Branch>(node_id, {.target_id = else_block_id});
|
||||
context.inst_block_stack().Pop();
|
||||
context.inst_block_stack().Push(else_block_id);
|
||||
context.AddToRegion(else_block_id, node_id);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -72,7 +73,6 @@ auto HandleParseNode(Context& context, Parse::IfStatementId node_id) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
context.AddCurrentCodeBlockToFunction();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user