Get rid of AddPatternInst (#7075)

Instead, use the inst category to select the right block stack. This
simplifies the API for adding insts, and in subsequent changes it will
enable certain inst kinds like `SpliceInst` to seamlessly function as
either procedural insts or pattern insts.
This commit is contained in:
Geoff Romer
2026-04-16 23:31:31 +00:00
committed by GitHub
parent af04d08965
commit e7626f46cc
10 changed files with 40 additions and 58 deletions
+2 -2
View File
@@ -45,11 +45,11 @@ auto AddReturnPatterns(Context& context, SemIR::LocId loc_id,
case CARBON_KIND(SemIR::InitForm _): {
auto pattern_type_id =
GetPatternType(context, form_expr.type_component_id);
auto out_param_id = AddPatternInst<SemIR::OutParamPattern>(
auto out_param_id = AddInst<SemIR::OutParamPattern>(
context, SemIR::LocId(form_expr.form_inst_id),
{.type_id = pattern_type_id,
.pretty_name_id = SemIR::NameId::ReturnSlot});
return_patterns.push_back(AddPatternInst<SemIR::ReturnSlotPattern>(
return_patterns.push_back(AddInst<SemIR::ReturnSlotPattern>(
context, SemIR::LocId(form_expr.form_inst_id),
{.type_id = pattern_type_id,
.subpattern_id = out_param_id,