mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Move type functions off Context (#4951)
This creates a new check/type.h for most logic, and also moves some functions to TypeStore in sem_ir/type.h. My approach for TypeStore is to focus on moving the read-only functions there.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/check/deduce.h"
|
||||
#include "toolchain/check/function.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/diagnostics/format_providers.h"
|
||||
#include "toolchain/sem_ir/builtin_function_kind.h"
|
||||
#include "toolchain/sem_ir/entity_with_params_base.h"
|
||||
@@ -118,8 +119,9 @@ static auto PerformCallToGenericInterface(
|
||||
if (!callee_specific_id) {
|
||||
return SemIR::ErrorInst::SingletonInstId;
|
||||
}
|
||||
return context.GetOrAddInst(loc_id, context.FacetTypeFromInterface(
|
||||
interface_id, *callee_specific_id));
|
||||
return context.GetOrAddInst(
|
||||
loc_id,
|
||||
FacetTypeFromInterface(context, interface_id, *callee_specific_id));
|
||||
}
|
||||
|
||||
auto PerformCall(Context& context, SemIR::LocId loc_id, SemIR::InstId callee_id,
|
||||
@@ -164,8 +166,8 @@ auto PerformCall(Context& context, SemIR::LocId loc_id, SemIR::InstId callee_id,
|
||||
callee_id = context.GetOrAddInst(
|
||||
context.insts().GetLocId(callee_id),
|
||||
SemIR::SpecificFunction{
|
||||
.type_id = context.GetSingletonType(
|
||||
SemIR::SpecificFunctionType::SingletonInstId),
|
||||
.type_id = GetSingletonType(
|
||||
context, SemIR::SpecificFunctionType::SingletonInstId),
|
||||
.callee_id = callee_id,
|
||||
.specific_id = *callee_specific_id});
|
||||
if (callee_function.self_type_id.has_value()) {
|
||||
@@ -201,7 +203,7 @@ auto PerformCall(Context& context, SemIR::LocId loc_id, SemIR::InstId callee_id,
|
||||
// For functions with an implicit return type, the return type is the
|
||||
// empty tuple type.
|
||||
if (!return_info.type_id.has_value()) {
|
||||
return_info.type_id = context.GetTupleType({});
|
||||
return_info.type_id = GetTupleType(context, {});
|
||||
}
|
||||
break;
|
||||
case SemIR::InitRepr::ByCopy:
|
||||
|
||||
Reference in New Issue
Block a user