mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 07:31:04 +01:00
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:
co-authored by
Jon Ross-Perkins
parent
35f5a7f115
commit
74e1a9949f
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user