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:
@@ -172,7 +172,7 @@ static auto PopOperand(Context& context, Worklist& worklist, SemIR::IdKind kind,
|
||||
if (!type_id.has_value()) {
|
||||
return arg;
|
||||
}
|
||||
return context.GetTypeIdForTypeInst(worklist.Pop()).index;
|
||||
return context.types().GetTypeIdForTypeInstId(worklist.Pop()).index;
|
||||
}
|
||||
case SemIR::IdKind::For<SemIR::InstBlockId>: {
|
||||
return pop_block_id(SemIR::InstBlockId(arg)).index;
|
||||
@@ -183,9 +183,9 @@ static auto PopOperand(Context& context, Worklist& worklist, SemIR::IdKind kind,
|
||||
SemIR::CopyOnWriteStructTypeFieldsBlock new_fields(context.sem_ir(),
|
||||
old_fields_id);
|
||||
for (auto i : llvm::reverse(llvm::seq(old_fields.size()))) {
|
||||
new_fields.Set(
|
||||
i, {.name_id = old_fields[i].name_id,
|
||||
.type_id = context.GetTypeIdForTypeInst(worklist.Pop())});
|
||||
new_fields.Set(i, {.name_id = old_fields[i].name_id,
|
||||
.type_id = context.types().GetTypeIdForTypeInstId(
|
||||
worklist.Pop())});
|
||||
}
|
||||
return new_fields.GetCanonical().index;
|
||||
}
|
||||
@@ -195,7 +195,8 @@ static auto PopOperand(Context& context, Worklist& worklist, SemIR::IdKind kind,
|
||||
SemIR::CopyOnWriteTypeBlock new_type_block(context.sem_ir(),
|
||||
old_type_block_id);
|
||||
for (auto i : llvm::reverse(llvm::seq(size))) {
|
||||
new_type_block.Set(i, context.GetTypeIdForTypeInst(worklist.Pop()));
|
||||
new_type_block.Set(
|
||||
i, context.types().GetTypeIdForTypeInstId(worklist.Pop()));
|
||||
}
|
||||
return new_type_block.GetCanonical().index;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user