mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
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:
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user