Support tuple patterns outside parameter lists (#4923)

Parameter lists need substantially different treatment than tuple
patterns in other contexts, so this change splits them into separate
parse node kinds.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Geoff Romer
2025-02-20 03:17:45 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 35f5a7f115
commit 74e1a9949f
201 changed files with 1680 additions and 860 deletions
+4 -2
View File
@@ -35,11 +35,13 @@ auto EndSubpatternAsExpr(Context& context, SemIR::InstId result_id)
.result_id = result_id});
}
auto EndSubpatternAsEmpty(Context& context) -> void {
auto EndSubpatternAsNonExpr(Context& context) -> void {
auto block_id = context.inst_block_stack().Pop();
CARBON_CHECK(block_id == context.region_stack().PeekRegion().back());
CARBON_CHECK(context.region_stack().PeekRegion().size() == 1);
CARBON_CHECK(context.inst_blocks().Get(block_id).empty());
// TODO: Add `CARBON_CHECK(inst_blocks().Get(block_id).empty())`.
// Currently that can fail when ending a tuple pattern in a name binding
// decl in a class or interface.
context.region_stack().PopAndDiscardRegion();
}