Allocate CallParamIndexes eagerly (#6540)

This approach is more robust because there's no intermediate state where
the `ParamPattern` insts have been created, but don't yet have their
final values.
This commit is contained in:
Geoff Romer
2026-01-05 19:38:52 +00:00
committed by GitHub
parent 08051393dc
commit b72bfb918b
10 changed files with 41 additions and 38 deletions
+2 -2
View File
@@ -237,13 +237,13 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
context, node_id,
{.type_id = type_id,
.subpattern_id = result_inst_id,
.index = SemIR::CallParamIndex::None});
.index = context.full_pattern_stack().NextCallParamIndex()});
} else {
result_inst_id = AddPatternInst<SemIR::ValueParamPattern>(
context, node_id,
{.type_id = type_id,
.subpattern_id = result_inst_id,
.index = SemIR::CallParamIndex::None});
.index = context.full_pattern_stack().NextCallParamIndex()});
}
}
context.node_stack().Push(node_id, result_inst_id);