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:
Jon Ross-Perkins
2025-02-13 23:02:38 +00:00
committed by GitHub
parent 23e5677c8e
commit dc8f47e6ad
39 changed files with 506 additions and 393 deletions
+3 -2
View File
@@ -6,6 +6,7 @@
#include "toolchain/check/context.h"
#include "toolchain/check/convert.h"
#include "toolchain/check/handle.h"
#include "toolchain/check/type.h"
#include "toolchain/diagnostics/format_providers.h"
namespace Carbon::Check {
@@ -141,8 +142,8 @@ auto HandleParseNode(Context& context, Parse::StructLiteralId node_id) -> bool {
/*is_struct_type_literal=*/false)) {
context.node_stack().Push(node_id, SemIR::ErrorInst::SingletonInstId);
} else {
auto type_id = context.GetStructType(
context.struct_type_fields().AddCanonical(fields));
auto type_id = GetStructType(
context, context.struct_type_fields().AddCanonical(fields));
auto value_id = context.AddInst<SemIR::StructLiteral>(
node_id, {.type_id = type_id, .elements_id = elements_id});