mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:31:06 +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
@@ -32,11 +32,12 @@ auto SemanticsHandleMemberAccessExpression(SemanticsContext& context,
|
||||
// TODO: Do we need to optimize this with a lookup table for O(1)?
|
||||
for (int i = 0; i < static_cast<int>(refs.size()); ++i) {
|
||||
auto ref = context.semantics_ir().GetNode(refs[i]);
|
||||
if (name_id == ref.GetAsStructTypeField()) {
|
||||
if (auto [field_name_id, field_type_id] = ref.GetAsStructTypeField();
|
||||
name_id == field_name_id) {
|
||||
context.AddNodeAndPush(
|
||||
parse_node,
|
||||
SemanticsNode::StructMemberAccess::Make(
|
||||
parse_node, ref.type_id(), base_id, SemanticsMemberIndex(i)));
|
||||
parse_node, field_type_id, base_id, SemanticsMemberIndex(i)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user