mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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:
+11
-10
@@ -9,6 +9,7 @@
|
||||
#include "toolchain/check/eval.h"
|
||||
#include "toolchain/check/generic_region_stack.h"
|
||||
#include "toolchain/check/subst.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/check/type_completion.h"
|
||||
#include "toolchain/sem_ir/generic.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
@@ -179,7 +180,7 @@ static auto AddGenericTypeToEvalBlock(
|
||||
SubstInst(context, context.types().GetInstId(type_id),
|
||||
RebuildGenericConstantInEvalBlockCallbacks(
|
||||
context, generic_id, region, loc_id, constants_in_generic));
|
||||
return context.GetTypeIdForTypeInst(type_inst_id);
|
||||
return context.types().GetTypeIdForTypeInstId(type_inst_id);
|
||||
}
|
||||
|
||||
// Adds instructions to compute the substituted value of `inst_id` in each
|
||||
@@ -500,20 +501,20 @@ auto GetInstForSpecific(Context& context, SemIR::SpecificId specific_id)
|
||||
CARBON_KIND_SWITCH(decl) {
|
||||
case CARBON_KIND(SemIR::ClassDecl class_decl): {
|
||||
return context.types().GetInstId(
|
||||
context.GetClassType(class_decl.class_id, specific_id));
|
||||
GetClassType(context, class_decl.class_id, specific_id));
|
||||
}
|
||||
case CARBON_KIND(SemIR::InterfaceDecl interface_decl): {
|
||||
return context.types().GetInstId(
|
||||
context.GetInterfaceType(interface_decl.interface_id, specific_id));
|
||||
GetInterfaceType(context, interface_decl.interface_id, specific_id));
|
||||
}
|
||||
case SemIR::FunctionDecl::Kind: {
|
||||
return context.constant_values().GetInstId(
|
||||
TryEvalInst(context, SemIR::InstId::None,
|
||||
SemIR::SpecificFunction{
|
||||
.type_id = context.GetSingletonType(
|
||||
SemIR::SpecificFunctionType::SingletonInstId),
|
||||
.callee_id = generic.decl_id,
|
||||
.specific_id = specific_id}));
|
||||
return context.constant_values().GetInstId(TryEvalInst(
|
||||
context, SemIR::InstId::None,
|
||||
SemIR::SpecificFunction{
|
||||
.type_id = GetSingletonType(
|
||||
context, SemIR::SpecificFunctionType::SingletonInstId),
|
||||
.callee_id = generic.decl_id,
|
||||
.specific_id = specific_id}));
|
||||
}
|
||||
case SemIR::AssociatedConstantDecl::Kind: {
|
||||
// TODO: We don't have a good instruction to use here.
|
||||
|
||||
Reference in New Issue
Block a user