mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 17:31:07 +01:00
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:
@@ -156,11 +156,12 @@ auto AddParamPattern(Context& context, SemIR::LocId loc_id,
|
||||
pattern_id = AddPatternInst(
|
||||
context,
|
||||
SemIR::LocIdAndInst::UncheckedLoc(
|
||||
loc_id, SemIR::AnyParamPattern{
|
||||
.kind = param_pattern_kind,
|
||||
.type_id = context.insts().Get(pattern_id).type_id(),
|
||||
.subpattern_id = pattern_id,
|
||||
.index = SemIR::CallParamIndex::None}));
|
||||
loc_id,
|
||||
SemIR::AnyParamPattern{
|
||||
.kind = param_pattern_kind,
|
||||
.type_id = context.insts().Get(pattern_id).type_id(),
|
||||
.subpattern_id = pattern_id,
|
||||
.index = context.full_pattern_stack().NextCallParamIndex()}));
|
||||
|
||||
return pattern_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user