Basic lowering support for classes. (#3334)

Track the fields in a class, and generate a corresponding struct type as
the object representation for the class. For now, we always use a
pointer as the value representation for a class.
This commit is contained in:
Richard Smith
2023-10-25 20:44:24 +00:00
committed by GitHub
parent 7f2f4bec4f
commit 620408b999
18 changed files with 127 additions and 23 deletions
@@ -57,6 +57,10 @@ auto HandlePatternBinding(Context& context, Parse::Node parse_node) -> bool {
value_type_id = context.CanonicalizeType(field_type_node_id);
value_id =
context.AddNode(SemIR::Field{parse_node, value_type_id, name_id});
// Add a corresponding field to the object representation of the class.
context.args_type_info_stack().AddNode(
SemIR::StructTypeField{parse_node, name_id, cast_type_id});
} else {
value_id = context.AddNode(
SemIR::VarStorage{name_node, value_type_id, name_id});