Switch File functions, classes, and types to ValueStores (#3316)

Building on #3313, start using ValueStore on File. Functions and classes
are straightforward. Types here I present as a borderline case where
maybe we want a more bespoke API, but maybe this is okay? Most other
things probably need a slightly different API, which although I might do
that for a consistent interface, felt more out-of-scope for this change.
This commit is contained in:
Jon Ross-Perkins
2023-10-20 22:40:18 +00:00
committed by GitHub
parent 843dd40f22
commit 7e9d644e1f
14 changed files with 76 additions and 126 deletions
+3 -2
View File
@@ -246,7 +246,8 @@ auto Context::AddCurrentCodeBlockToFunction() -> void {
.GetNodeAs<SemIR::FunctionDeclaration>(return_scope_stack().back())
.function_id;
semantics_ir()
.GetFunction(function_id)
.functions()
.Get(function_id)
.body_block_ids.push_back(node_block_stack().PeekOrAdd());
}
@@ -709,7 +710,7 @@ auto Context::CanonicalizeTypeImpl(
}
auto node_id = make_node();
auto type_id = semantics_ir_->AddType(node_id);
auto type_id = semantics_ir_->types().Add({.node_id = node_id});
CARBON_CHECK(canonical_types_.insert({node_id, type_id}).second);
type_node_storage_.push_back(
std::make_unique<TypeNode>(canonical_id, type_id));