Factor param/arg ref logic to a class. (#3728)

Just segmenting out a chunk of logic while I'm thinking about function
parameters.
This commit is contained in:
Jon Ross-Perkins
2024-02-27 19:58:19 +00:00
committed by GitHub
parent 85ce06f854
commit 2fee4d072f
10 changed files with 138 additions and 95 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ auto InstBlockStack::PushGlobalInit() -> void {
}
auto InstBlockStack::PeekOrAdd(int depth) -> SemIR::InstBlockId {
CARBON_CHECK(size() > depth) << "no such block";
int index = size() - depth - 1;
CARBON_CHECK(size_ > depth) << "no such block";
int index = size_ - depth - 1;
auto& slot = stack_[index];
if (!slot.id.is_valid()) {
slot.id = sem_ir_->inst_blocks().AddDefaultValue();