mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:44:41 +01:00
Remove the type field from semantics nodes that don't produce values of that type. (#3049)
For `Assign` and `ReturnExpression`, this field wasn't used for anything. For `StructTypeField`, we stored the type of the field here, and now store it as an argument of the node instead. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
ab709b4117
commit
0c33dead70
@@ -149,12 +149,13 @@ auto LoweringContext::BuildType(SemanticsNodeId node_id) -> llvm::Type* {
|
||||
llvm::SmallVector<llvm::Type*> subtypes;
|
||||
subtypes.reserve(refs.size());
|
||||
for (auto ref_id : refs) {
|
||||
auto type_id = semantics_ir_->GetNode(ref_id).type_id();
|
||||
auto [field_name_id, field_type_id] =
|
||||
semantics_ir_->GetNode(ref_id).GetAsStructTypeField();
|
||||
// TODO: Handle recursive types. The restriction for builtins prevents
|
||||
// recursion while still letting them cache.
|
||||
CARBON_CHECK(type_id.index < SemanticsBuiltinKind::ValidCount)
|
||||
<< type_id;
|
||||
subtypes.push_back(GetType(type_id));
|
||||
CARBON_CHECK(field_type_id.index < SemanticsBuiltinKind::ValidCount)
|
||||
<< field_type_id;
|
||||
subtypes.push_back(GetType(field_type_id));
|
||||
}
|
||||
return llvm::StructType::create(*llvm_context_, subtypes,
|
||||
"StructLiteralType");
|
||||
|
||||
Reference in New Issue
Block a user