|
@@ -115,16 +115,14 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
|
|
case Type_Info_Struct:
|
|
case Type_Info_Struct:
|
|
y := b.variant.(Type_Info_Struct) or_return
|
|
y := b.variant.(Type_Info_Struct) or_return
|
|
switch {
|
|
switch {
|
|
- case len(x.types) != len(y.types),
|
|
|
|
- x.is_packed != y.is_packed,
|
|
|
|
- x.is_raw_union != y.is_raw_union,
|
|
|
|
- x.custom_align != y.custom_align,
|
|
|
|
|
|
+ case x.field_count != y.field_count,
|
|
|
|
+ x.flags != y.flags,
|
|
x.soa_kind != y.soa_kind,
|
|
x.soa_kind != y.soa_kind,
|
|
x.soa_base_type != y.soa_base_type,
|
|
x.soa_base_type != y.soa_base_type,
|
|
x.soa_len != y.soa_len:
|
|
x.soa_len != y.soa_len:
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- for _, i in x.types {
|
|
|
|
|
|
+ for i in 0..<x.field_count {
|
|
xn, yn := x.names[i], y.names[i]
|
|
xn, yn := x.names[i], y.names[i]
|
|
xt, yt := x.types[i], y.types[i]
|
|
xt, yt := x.types[i], y.types[i]
|
|
xl, yl := x.tags[i], y.tags[i]
|
|
xl, yl := x.tags[i], y.tags[i]
|
|
@@ -179,8 +177,8 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
|
|
case Type_Info_Bit_Field:
|
|
case Type_Info_Bit_Field:
|
|
y := b.variant.(Type_Info_Bit_Field) or_return
|
|
y := b.variant.(Type_Info_Bit_Field) or_return
|
|
if !are_types_identical(x.backing_type, y.backing_type) { return false }
|
|
if !are_types_identical(x.backing_type, y.backing_type) { return false }
|
|
- if len(x.names) != len(y.names) { return false }
|
|
|
|
- for _, i in x.names {
|
|
|
|
|
|
+ if x.field_count != y.field_count { return false }
|
|
|
|
+ for _, i in x.names[:x.field_count] {
|
|
if x.names[i] != y.names[i] {
|
|
if x.names[i] != y.names[i] {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
@@ -368,13 +366,13 @@ is_tuple :: proc(info: ^Type_Info) -> bool {
|
|
is_struct :: proc(info: ^Type_Info) -> bool {
|
|
is_struct :: proc(info: ^Type_Info) -> bool {
|
|
if info == nil { return false }
|
|
if info == nil { return false }
|
|
s, ok := type_info_base(info).variant.(Type_Info_Struct)
|
|
s, ok := type_info_base(info).variant.(Type_Info_Struct)
|
|
- return ok && !s.is_raw_union
|
|
|
|
|
|
+ return ok && .raw_union not_in s.flags
|
|
}
|
|
}
|
|
@(require_results)
|
|
@(require_results)
|
|
is_raw_union :: proc(info: ^Type_Info) -> bool {
|
|
is_raw_union :: proc(info: ^Type_Info) -> bool {
|
|
if info == nil { return false }
|
|
if info == nil { return false }
|
|
s, ok := type_info_base(info).variant.(Type_Info_Struct)
|
|
s, ok := type_info_base(info).variant.(Type_Info_Struct)
|
|
- return ok && s.is_raw_union
|
|
|
|
|
|
+ return ok && .raw_union in s.flags
|
|
}
|
|
}
|
|
@(require_results)
|
|
@(require_results)
|
|
is_union :: proc(info: ^Type_Info) -> bool {
|
|
is_union :: proc(info: ^Type_Info) -> bool {
|
|
@@ -656,15 +654,16 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info, n_written: ^int = nil) -
|
|
}
|
|
}
|
|
|
|
|
|
io.write_string(w, "struct ", &n) or_return
|
|
io.write_string(w, "struct ", &n) or_return
|
|
- if info.is_packed { io.write_string(w, "#packed ", &n) or_return }
|
|
|
|
- if info.is_raw_union { io.write_string(w, "#raw_union ", &n) or_return }
|
|
|
|
- if info.custom_align {
|
|
|
|
|
|
+ if .packed in info.flags { io.write_string(w, "#packed ", &n) or_return }
|
|
|
|
+ if .raw_union in info.flags { io.write_string(w, "#raw_union ", &n) or_return }
|
|
|
|
+ if .no_copy in info.flags { io.write_string(w, "#no_copy ", &n) or_return }
|
|
|
|
+ if .align in info.flags {
|
|
io.write_string(w, "#align(", &n) or_return
|
|
io.write_string(w, "#align(", &n) or_return
|
|
io.write_i64(w, i64(ti.align), 10, &n) or_return
|
|
io.write_i64(w, i64(ti.align), 10, &n) or_return
|
|
io.write_string(w, ") ", &n) or_return
|
|
io.write_string(w, ") ", &n) or_return
|
|
}
|
|
}
|
|
io.write_byte(w, '{', &n) or_return
|
|
io.write_byte(w, '{', &n) or_return
|
|
- for name, i in info.names {
|
|
|
|
|
|
+ for name, i in info.names[:info.field_count] {
|
|
if i > 0 { io.write_string(w, ", ", &n) or_return }
|
|
if i > 0 { io.write_string(w, ", ", &n) or_return }
|
|
io.write_string(w, name, &n) or_return
|
|
io.write_string(w, name, &n) or_return
|
|
io.write_string(w, ": ", &n) or_return
|
|
io.write_string(w, ": ", &n) or_return
|
|
@@ -722,7 +721,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info, n_written: ^int = nil) -
|
|
io.write_string(w, "bit_field ", &n) or_return
|
|
io.write_string(w, "bit_field ", &n) or_return
|
|
write_type(w, info.backing_type, &n) or_return
|
|
write_type(w, info.backing_type, &n) or_return
|
|
io.write_string(w, " {", &n) or_return
|
|
io.write_string(w, " {", &n) or_return
|
|
- for name, i in info.names {
|
|
|
|
|
|
+ for name, i in info.names[:info.field_count] {
|
|
if i > 0 { io.write_string(w, ", ", &n) or_return }
|
|
if i > 0 { io.write_string(w, ", ", &n) or_return }
|
|
io.write_string(w, name, &n) or_return
|
|
io.write_string(w, name, &n) or_return
|
|
io.write_string(w, ": ", &n) or_return
|
|
io.write_string(w, ": ", &n) or_return
|