Skip to content

Commit

Permalink
Improve decl_name_stack comments (carbon-language#4977)
Browse files Browse the repository at this point in the history
Trying to make it clearer what these correspond to. Had suggested a
small edit on
https://github.com/carbon-language/carbon-lang/pull/4902/files#r1960682518,
but since that was missed, suggesting an incrementally larger edit since
`name_id` and `loc_id` are now more tied.
  • Loading branch information
jonmeow authored Feb 19, 2025
1 parent 186ca0e commit 524a633
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions toolchain/check/decl_name_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions toolchain/check/decl_name_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 524a633

Please sign in to comment.