mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +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:
@@ -7,6 +7,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/eval.h"
|
||||
#include "toolchain/check/generic.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
@@ -34,7 +35,7 @@ auto BuildAssociatedEntity(Context& context, SemIR::InterfaceId interface_id,
|
||||
|
||||
// Name lookup for the declaration's name should name the associated entity,
|
||||
// not the declaration itself.
|
||||
auto type_id = context.GetAssociatedEntityType(self_type_id);
|
||||
auto type_id = GetAssociatedEntityType(context, self_type_id);
|
||||
return context.AddInst<SemIR::AssociatedEntity>(
|
||||
context.insts().GetLocId(decl_id),
|
||||
{.type_id = type_id, .index = index, .decl_id = decl_id});
|
||||
@@ -173,8 +174,9 @@ auto GetTypeForSpecificAssociatedEntity(Context& context, SemIRLoc loc,
|
||||
GetSelfFacet(context, interface_specific_id,
|
||||
context.functions().Get(fn->function_id).generic_id,
|
||||
self_type_id, self_witness_id);
|
||||
return context.GetFunctionTypeWithSelfType(
|
||||
context.types().GetInstId(interface_fn_type_id), self_facet_id);
|
||||
return GetFunctionTypeWithSelfType(
|
||||
context, context.types().GetInstId(interface_fn_type_id),
|
||||
self_facet_id);
|
||||
} else {
|
||||
CARBON_FATAL("Unexpected kind for associated constant {0}", decl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user