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 authored and GitHub committed 2024-02-27 19:58:19 +00:00
1 parent 85ce06f854
commit 2fee4d072f
10 files changed
+138 -95

No files matched your search

+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();