Refactor subpattern logic out of Context (#4929)

Note this is building on #4927 which factors out RegionStack, because
this heavily uses the region stack. However, it's a more complex level
of logic that appears specific to pattern handling.

I've moved InsertHere to pattern_match.cpp because it appears to be in
specific use there.
This commit is contained in:
Jon Ross-Perkins
2025-02-12 19:14:37 +00:00
committed by GitHub
parent d6ce8f192d
commit 71c91eaf14
9 changed files with 138 additions and 107 deletions
+2 -1
View File
@@ -7,6 +7,7 @@
#include "toolchain/check/handle.h"
#include "toolchain/check/interface.h"
#include "toolchain/check/return.h"
#include "toolchain/check/subpattern.h"
#include "toolchain/check/type_completion.h"
#include "toolchain/diagnostics/format_providers.h"
#include "toolchain/sem_ir/ids.h"
@@ -24,7 +25,7 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
// TODO: Handle `_` bindings.
SemIR::ExprRegionId type_expr_region_id =
context.EndSubpatternAsExpr(cast_type_inst_id);
EndSubpatternAsExpr(context, cast_type_inst_id);
// Every other kind of pattern binding has a name.
auto [name_node, name_id] = context.node_stack().PopNameWithNodeId();