diff --git a/toolchain/check/decl_name_stack.cpp b/toolchain/check/decl_name_stack.cpp index ac1d299fc917..9045065f46a9 100644 --- a/toolchain/check/decl_name_stack.cpp +++ b/toolchain/check/decl_name_stack.cpp @@ -255,10 +255,8 @@ auto DeclNameStack::ApplyNameQualifier(const NameComponent& name) -> void { auto DeclNameStack::ApplyAndLookupName(NameContext& name_context, SemIR::LocId loc_id, SemIR::NameId name_id) -> void { - // The location of the name is the location of the last name token we've - // processed so far. + // Update the final name component. name_context.loc_id = loc_id; - name_context.name_id = name_id; // Don't perform any more lookups after we hit an error. We still track the diff --git a/toolchain/check/decl_name_stack.h b/toolchain/check/decl_name_stack.h index 74b60811e430..a7988d714414 100644 --- a/toolchain/check/decl_name_stack.h +++ b/toolchain/check/decl_name_stack.h @@ -145,9 +145,12 @@ class DeclNameStack { // should be used. SemIR::NameScopeId parent_scope_id; - // The last location ID used. + // The location of the final name component. SemIR::LocId loc_id = SemIR::LocId::None; + // The name of the final name component. + SemIR::NameId name_id = SemIR::NameId::None; + union { // The ID of a resolved qualifier, including both identifiers and // expressions. `None` indicates resolution failed. @@ -157,9 +160,6 @@ class DeclNameStack { // the poisoning location. SemIR::LocId poisoning_loc_id = SemIR::LocId::None; }; - - // The ID of an identifier. - SemIR::NameId name_id = SemIR::NameId::None; }; // Information about a declaration name that has been temporarily removed from