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
+7 -7
View File
@@ -297,17 +297,17 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
auto pattern_type_id =
GetPatternType(context, type_expr.type_component_id);
if (is_ref) {
param_pattern_id = AddPatternInst<SemIR::RefParamPattern>(
param_pattern_id = AddInst<SemIR::RefParamPattern>(
context, node_id,
{.type_id = pattern_type_id, .pretty_name_id = name_id});
} else if (node_kind == Parse::NodeKind::FormBindingPattern) {
param_pattern_id = AddPatternInst<SemIR::FormParamPattern>(
context, node_id,
{.type_id = pattern_type_id,
.pretty_name_id = name_id,
.form_id = form_id});
param_pattern_id =
AddInst<SemIR::FormParamPattern>(context, node_id,
{.type_id = pattern_type_id,
.pretty_name_id = name_id,
.form_id = form_id});
} else {
param_pattern_id = AddPatternInst<SemIR::ValueParamPattern>(
param_pattern_id = AddInst<SemIR::ValueParamPattern>(
context, node_id,
{.type_id = pattern_type_id, .pretty_name_id = name_id});
}