mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Refactor name lookup logic out of Context (#4930)
This is a pretty straight move of name lookup functionality to name_lookup.*
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "toolchain/check/generic.h"
|
||||
#include "toolchain/check/merge.h"
|
||||
#include "toolchain/check/name_component.h"
|
||||
#include "toolchain/check/name_lookup.h"
|
||||
#include "toolchain/diagnostics/diagnostic.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
#include "toolchain/sem_ir/name_scope.h"
|
||||
@@ -134,8 +135,8 @@ auto DeclNameStack::AddName(NameContext name_context, SemIR::InstId target_id,
|
||||
|
||||
case NameContext::State::Unresolved:
|
||||
if (!name_context.parent_scope_id.has_value()) {
|
||||
context_->AddNameToLookup(name_context.unresolved_name_id, target_id,
|
||||
name_context.initial_scope_index);
|
||||
AddNameToLookup(*context_, name_context.unresolved_name_id, target_id,
|
||||
name_context.initial_scope_index);
|
||||
} else {
|
||||
auto& name_scope =
|
||||
context_->name_scopes().Get(name_context.parent_scope_id);
|
||||
@@ -264,9 +265,9 @@ auto DeclNameStack::ApplyAndLookupName(NameContext& name_context,
|
||||
}
|
||||
|
||||
// For identifier nodes, we need to perform a lookup on the identifier.
|
||||
auto lookup_result = context_->LookupNameInDecl(
|
||||
name_context.loc_id, name_id, name_context.parent_scope_id,
|
||||
name_context.initial_scope_index);
|
||||
auto lookup_result = LookupNameInDecl(*context_, name_context.loc_id, name_id,
|
||||
name_context.parent_scope_id,
|
||||
name_context.initial_scope_index);
|
||||
if (lookup_result.is_poisoned()) {
|
||||
name_context.unresolved_name_id = name_id;
|
||||
name_context.poisoning_loc_id = lookup_result.poisoning_loc_id();
|
||||
|
||||
Reference in New Issue
Block a user