mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 14:11:04 +01:00
Remove InstId::Builtin members (#4632)
- `InstId::Builtin<Inst>` -> `<Inst>::SingletonInstId` - `InstId::PackageNamespace` -> `Namespace::PackageInstId`
This commit is contained in:
@@ -93,7 +93,7 @@ auto CheckReturnedVar(Context& context, Parse::NodeId returned_node,
|
||||
context.emitter().Build(returned_node, ReturnedVarWithNoReturnType);
|
||||
NoteNoReturnTypeProvided(diag, function);
|
||||
diag.Emit();
|
||||
return SemIR::InstId::BuiltinErrorInst;
|
||||
return SemIR::ErrorInst::SingletonInstId;
|
||||
}
|
||||
|
||||
// The declared type of the var must match the return type of the function.
|
||||
@@ -106,7 +106,7 @@ auto CheckReturnedVar(Context& context, Parse::NodeId returned_node,
|
||||
context.emitter().Build(type_node, ReturnedVarWrongType, type_id);
|
||||
NoteReturnType(context, diag, function);
|
||||
diag.Emit();
|
||||
return SemIR::InstId::BuiltinErrorInst;
|
||||
return SemIR::ErrorInst::SingletonInstId;
|
||||
}
|
||||
|
||||
// The variable aliases the return slot if there is one. If not, it has its
|
||||
@@ -161,7 +161,7 @@ auto BuildReturnWithExpr(Context& context, Parse::ReturnStatementId node_id,
|
||||
auto diag = context.emitter().Build(node_id, ReturnStatementDisallowExpr);
|
||||
NoteNoReturnTypeProvided(diag, function);
|
||||
diag.Emit();
|
||||
expr_id = SemIR::InstId::BuiltinErrorInst;
|
||||
expr_id = SemIR::ErrorInst::SingletonInstId;
|
||||
} else if (returned_var_id.is_valid()) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
ReturnExprWithReturnedVar, Error,
|
||||
@@ -169,11 +169,11 @@ auto BuildReturnWithExpr(Context& context, Parse::ReturnStatementId node_id,
|
||||
auto diag = context.emitter().Build(node_id, ReturnExprWithReturnedVar);
|
||||
NoteReturnedVar(diag, returned_var_id);
|
||||
diag.Emit();
|
||||
expr_id = SemIR::InstId::BuiltinErrorInst;
|
||||
expr_id = SemIR::ErrorInst::SingletonInstId;
|
||||
} else if (!return_info.is_valid()) {
|
||||
// We already diagnosed that the return type is invalid. Don't try to
|
||||
// convert to it.
|
||||
expr_id = SemIR::InstId::BuiltinErrorInst;
|
||||
expr_id = SemIR::ErrorInst::SingletonInstId;
|
||||
} else if (return_info.has_return_slot()) {
|
||||
return_slot_id = GetCurrentReturnSlot(context);
|
||||
// Note that this can import a function and invalidate `function`.
|
||||
@@ -196,7 +196,7 @@ auto BuildReturnVar(Context& context, Parse::ReturnStatementId node_id)
|
||||
CARBON_DIAGNOSTIC(ReturnVarWithNoReturnedVar, Error,
|
||||
"`return var;` with no `returned var` in scope");
|
||||
context.emitter().Emit(node_id, ReturnVarWithNoReturnedVar);
|
||||
returned_var_id = SemIR::InstId::BuiltinErrorInst;
|
||||
returned_var_id = SemIR::ErrorInst::SingletonInstId;
|
||||
}
|
||||
|
||||
auto return_slot_id = GetCurrentReturnSlot(context);
|
||||
|
||||
Reference in New Issue
Block a user