mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01: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:
@@ -65,7 +65,7 @@ auto DeclarationNameStack::LookupOrAddName(NameContext name_context,
|
||||
} else {
|
||||
// TODO: Reject unless the scope is a namespace scope or the name is
|
||||
// unqualified.
|
||||
bool success = context_->semantics_ir().AddNameScopeEntry(
|
||||
bool success = context_->semantics_ir().name_scopes().AddEntry(
|
||||
name_context.target_scope_id, name_context.unresolved_name_id,
|
||||
target_id);
|
||||
CARBON_CHECK(success)
|
||||
@@ -122,7 +122,7 @@ auto DeclarationNameStack::UpdateScopeIfNeeded(NameContext& name_context)
|
||||
// This will only be reached for resolved nodes. We update the target
|
||||
// scope based on the resolved type.
|
||||
auto resolved_node =
|
||||
context_->semantics_ir().GetNode(name_context.resolved_node_id);
|
||||
context_->semantics_ir().nodes().Get(name_context.resolved_node_id);
|
||||
switch (resolved_node.kind()) {
|
||||
case SemIR::ClassDeclaration::Kind: {
|
||||
const auto& class_info = context_->semantics_ir().classes().Get(
|
||||
@@ -166,7 +166,8 @@ auto DeclarationNameStack::CanResolveQualifier(NameContext& name_context,
|
||||
// Because more qualifiers were found, we diagnose that the earlier
|
||||
// qualifier didn't resolve to a scoped entity.
|
||||
if (auto class_decl = context_->semantics_ir()
|
||||
.GetNode(name_context.resolved_node_id)
|
||||
.nodes()
|
||||
.Get(name_context.resolved_node_id)
|
||||
.TryAs<SemIR::ClassDeclaration>()) {
|
||||
CARBON_DIAGNOSTIC(QualifiedDeclarationInIncompleteClassScope, Error,
|
||||
"Cannot declare a member of incomplete class `{0}`.",
|
||||
|
||||
Reference in New Issue
Block a user