mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 10:51:05 +01:00
Distinguish between name IDs and string IDs in the type system. (#3341)
Add a `NameId` that is effectively just a wrapper around a `StringId`, with some additional predefined values for names that don't correspond to strings, such as the name of `self` or the function's return slot.
This commit is contained in:
@@ -14,7 +14,7 @@ auto DeclarationNameStack::MakeEmptyNameContext() -> NameContext {
|
||||
}
|
||||
|
||||
auto DeclarationNameStack::MakeUnqualifiedName(Parse::Node parse_node,
|
||||
IdentifierId name_id)
|
||||
SemIR::NameId name_id)
|
||||
-> NameContext {
|
||||
NameContext context = MakeEmptyNameContext();
|
||||
ApplyNameQualifierTo(context, parse_node, name_id);
|
||||
@@ -103,13 +103,13 @@ auto DeclarationNameStack::AddNameToLookup(NameContext name_context,
|
||||
}
|
||||
|
||||
auto DeclarationNameStack::ApplyNameQualifier(Parse::Node parse_node,
|
||||
IdentifierId name_id) -> void {
|
||||
SemIR::NameId name_id) -> void {
|
||||
ApplyNameQualifierTo(declaration_name_stack_.back(), parse_node, name_id);
|
||||
}
|
||||
|
||||
auto DeclarationNameStack::ApplyNameQualifierTo(NameContext& name_context,
|
||||
Parse::Node parse_node,
|
||||
IdentifierId name_id) -> void {
|
||||
SemIR::NameId name_id) -> void {
|
||||
if (CanResolveQualifier(name_context, parse_node)) {
|
||||
// For identifier nodes, we need to perform a lookup on the identifier.
|
||||
auto resolved_inst_id = context_->LookupNameInDeclaration(
|
||||
|
||||
Reference in New Issue
Block a user