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:
Geoff Romer
2024-12-19 21:41:06 +00:00
committed by GitHub
co-authored by Richard Smith
parent 95c9634c60
commit a112cbde5c
504 changed files with 5699 additions and 8719 deletions
+4 -2
View File
@@ -378,9 +378,9 @@ static auto HandleFunctionDefinitionAfterSignature(
// Create the function scope and the entry block.
context.return_scope_stack().push_back({.decl_id = decl_id});
context.inst_block_stack().Push();
context.PushRegion(context.inst_block_stack().PeekOrAdd());
context.scope_stack().Push(decl_id);
StartGenericDefinition(context);
context.AddCurrentCodeBlockToFunction();
CheckFunctionDefinitionSignature(context, function);
@@ -441,8 +441,10 @@ auto HandleParseNode(Context& context, Parse::FunctionDefinitionId node_id)
context.return_scope_stack().pop_back();
context.decl_name_stack().PopScope();
// If this is a generic function, collect information about the definition.
auto& function = context.functions().Get(function_id);
function.body_block_ids = context.PopRegion();
// If this is a generic function, collect information about the definition.
FinishGenericDefinition(context, function.generic_id);
return true;