Emit VarStorages eagerly (#7468)

We used to have to batch these at the end of pattern traversal in order
to avoid accidentally adding them to a block that was speculatively
pushed for an expression within a pattern, but that's no longer a
concern with the more precise handling of those speculative blocks in
#7445.
This commit is contained in:
Geoff Romer
2026-07-08 19:33:46 +00:00
committed by GitHub
parent 4261bb2dd2
commit 96c7cfe41c
6 changed files with 77 additions and 93 deletions
+1 -9
View File
@@ -30,6 +30,7 @@ auto FullPatternStack::StartPatternInitializer() -> void {
std::swap(lookup_result.back().inst_id, inst_id);
}
}
next_var_index_stack_.back() = 0;
}
auto FullPatternStack::EndPatternInitializer() -> void {
@@ -46,13 +47,4 @@ auto FullPatternStack::EndPatternInitializer() -> void {
}
}
auto FullPatternStack::BuildLocalVarStorage(Context& context,
bool is_returned_var) -> void {
for (auto& var_info : var_pattern_stack_.PeekArray()) {
var_info.storage_id =
GetOrAddVarStorage(context, var_info.pattern_id, is_returned_var);
}
next_var_index_stack_.back() = 0;
}
} // namespace Carbon::Check