Added support for nested structs
This commit is contained in:
parent
ba5cadfb1b
commit
bb444a9755
5 changed files with 296 additions and 117 deletions
|
|
@ -148,10 +148,8 @@ fn serialize_table_access(array: *std.ArrayList(u8), val: TableAccess) !void {
|
|||
|
||||
fn serialize_product_type_element(array: *std.ArrayList(u8), val: ProductTypeElement) !void {
|
||||
try array.appendSlice(&[_]u8{ 0 });
|
||||
//if(val.name) |name| {
|
||||
try array.appendSlice(&std.mem.toBytes(@as(u32, @intCast(val.name.len))));
|
||||
try array.appendSlice(val.name);
|
||||
//}
|
||||
try serialize_algebraic_type(array, val.algebraic_type);
|
||||
}
|
||||
|
||||
|
|
@ -168,6 +166,10 @@ fn serialize_algebraic_type(array: *std.ArrayList(u8), val: AlgebraicType) !void
|
|||
try array.appendSlice(&[_]u8{@intFromEnum(val)});
|
||||
try serialize_product_type(array, product);
|
||||
},
|
||||
AlgebraicType.Ref => |ref| {
|
||||
try array.appendSlice(&[_]u8{@intFromEnum(val)});
|
||||
try array.appendSlice(&std.mem.toBytes(ref.inner));
|
||||
},
|
||||
else => try array.appendSlice(&[_]u8{@intFromEnum(val)}),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue