mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
Split IdentifierId and StringLiteralId from StringId (#3352)
Following up on discussion yesterday regarding this split. Note, I'm expecting #3341 to do IdentifierId -> NameId in SemIR. It might be worth adding NameId creation directly to StringStore if you're content with this setup though.
This commit is contained in:
@@ -101,7 +101,7 @@ static auto BuildFunctionDeclaration(Context& context, bool is_definition)
|
||||
{.name_id = name_context.state ==
|
||||
DeclarationNameStack::NameContext::State::Unresolved
|
||||
? name_context.unresolved_name_id
|
||||
: StringId::Invalid,
|
||||
: IdentifierId::Invalid,
|
||||
.implicit_param_refs_id = implicit_param_refs_id,
|
||||
.param_refs_id = param_refs_id,
|
||||
.return_type_id = return_type_id,
|
||||
@@ -174,7 +174,7 @@ auto HandleFunctionDefinitionStart(Context& context, Parse::Node parse_node)
|
||||
"Previous definition was here.");
|
||||
context.emitter()
|
||||
.Build(parse_node, FunctionRedefinition,
|
||||
context.strings().Get(function.name_id))
|
||||
context.identifiers().Get(function.name_id))
|
||||
.Note(context.insts().Get(function.definition_id).parse_node(),
|
||||
FunctionPreviousDefinition)
|
||||
.Emit();
|
||||
@@ -212,9 +212,9 @@ auto HandleFunctionDefinitionStart(Context& context, Parse::Node parse_node)
|
||||
// TODO: This will shadow a local variable named `r#self`, but should
|
||||
// not. See #2984 and the corresponding code in
|
||||
// HandleSelfTypeNameExpression.
|
||||
context.AddNameToLookup(self_param->parse_node,
|
||||
context.strings().Add(SemIR::SelfParameter::Name),
|
||||
param_id);
|
||||
context.AddNameToLookup(
|
||||
self_param->parse_node,
|
||||
context.identifiers().Add(SemIR::SelfParameter::Name), param_id);
|
||||
} else {
|
||||
CARBON_FATAL() << "Unexpected kind of parameter in function definition "
|
||||
<< param;
|
||||
@@ -244,8 +244,8 @@ auto HandleReturnType(Context& context, Parse::Node parse_node) -> bool {
|
||||
auto type_id = ExpressionAsType(context, type_parse_node, type_inst_id);
|
||||
// TODO: Use a dedicated instruction rather than VarStorage here.
|
||||
context.AddInstAndPush(
|
||||
parse_node,
|
||||
SemIR::VarStorage{parse_node, type_id, context.strings().Add("return")});
|
||||
parse_node, SemIR::VarStorage{parse_node, type_id,
|
||||
context.identifiers().Add("return")});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user