mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 09:42:55 +00:00
Add more value store types to File. (#3317)
Finishing what #3316 started, add more bespoke ValueStore-like structures to File. With this, the things which previously had somewhat boilerplate Add/Get functions are now all on side classes, giving a uniform style of API for calling. Note, I was on the fence about making things public on ValueStore. If it's preferred that I make some things there protected I certainly can, there's just a trade-off that may mean more distinct child/wrapper types.
This commit is contained in:
1 parent
1b0e2d3a4b
commit
1d6298290f
31 files changed
+476
-381
No files matched your search
@@ -27,7 +27,7 @@ auto NodeBlockStack::PeekOrAdd(int depth) -> SemIR::NodeBlockId {
|
||||
int index = size() - depth - 1;
|
||||
auto& slot = stack_[index];
|
||||
if (!slot.id.is_valid()) {
|
||||
slot.id = semantics_ir_->AddNodeBlockId();
|
||||
slot.id = semantics_ir_->node_blocks().AddDefaultValue();
|
||||
}
|
||||
return slot.id;
|
||||
}
|
||||
@@ -40,9 +40,9 @@ auto NodeBlockStack::Pop() -> SemIR::NodeBlockId {
|
||||
// Finalize the block.
|
||||
if (!back.content.empty() && back.id != SemIR::NodeBlockId::Unreachable) {
|
||||
if (back.id.is_valid()) {
|
||||
semantics_ir_->SetNodeBlock(back.id, back.content);
|
||||
semantics_ir_->node_blocks().Set(back.id, back.content);
|
||||
} else {
|
||||
back.id = semantics_ir_->AddNodeBlock(back.content);
|
||||
back.id = semantics_ir_->node_blocks().Add(back.content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user