Parametric polymorphic union type

This commit is contained in:
gingerBill
2018-09-08 12:02:25 +01:00
parent 26cfc0257d
commit 3cd6ae311d
9 changed files with 317 additions and 58 deletions
+7 -1
View File
@@ -353,7 +353,13 @@ write_type :: proc(buf: ^String_Buffer, ti: ^runtime.Type_Info) {
write_byte(buf, '}');
case runtime.Type_Info_Union:
write_string(buf, "union {");
write_string(buf, "union ");
if info.custom_align {
write_string(buf, "#align ");
write_i64(buf, i64(ti.align), 10);
write_byte(buf, ' ');
}
write_byte(buf, '{');
for variant, i in info.variants {
if i > 0 do write_string(buf, ", ");
write_type(buf, variant);
+1
View File
@@ -82,6 +82,7 @@ Type_Info_Union :: struct {
variants: []^Type_Info,
tag_offset: uintptr,
tag_type: ^Type_Info,
custom_align: bool,
};
Type_Info_Enum :: struct {
base: ^Type_Info,