Remove unneeded semicolons from the core library

This commit is contained in:
gingerBill
2021-08-31 22:21:13 +01:00
parent b176af2742
commit 251da264ed
187 changed files with 27227 additions and 27227 deletions
+20 -20
View File
@@ -2,8 +2,8 @@ package reflect
import "core:runtime"
import "core:mem"
_ :: runtime;
_ :: mem;
_ :: runtime
_ :: mem
Map_Entry_Info :: struct($Key, $Value: typeid) {
hash: uintptr,
@@ -12,31 +12,31 @@ Map_Entry_Info :: struct($Key, $Value: typeid) {
}
map_entry_info_slice :: proc(m: $M/map[$K]$V, allocator := context.allocator) -> (entries: []Map_Entry_Info(K, V)) #no_bounds_check {
m := m;
rm := (^mem.Raw_Map)(&m);
m := m
rm := (^mem.Raw_Map)(&m)
info := type_info_base(type_info_of(M)).variant.(Type_Info_Map);
gs := type_info_base(info.generated_struct).variant.(Type_Info_Struct);
ed := type_info_base(gs.types[1]).variant.(Type_Info_Dynamic_Array);
entry_type := ed.elem.variant.(Type_Info_Struct);
key_offset := entry_type.offsets[2];
value_offset := entry_type.offsets[3];
entry_size := uintptr(ed.elem_size);
info := type_info_base(type_info_of(M)).variant.(Type_Info_Map)
gs := type_info_base(info.generated_struct).variant.(Type_Info_Struct)
ed := type_info_base(gs.types[1]).variant.(Type_Info_Dynamic_Array)
entry_type := ed.elem.variant.(Type_Info_Struct)
key_offset := entry_type.offsets[2]
value_offset := entry_type.offsets[3]
entry_size := uintptr(ed.elem_size)
entries = make(type_of(entries), rm.entries.len);
entries = make(type_of(entries), rm.entries.len)
data := uintptr(rm.entries.data);
data := uintptr(rm.entries.data)
for i in 0..<rm.entries.len {
header := (^runtime.Map_Entry_Header)(data);
header := (^runtime.Map_Entry_Header)(data)
hash := header.hash;
key := (^K)(data + key_offset)^;
value := (^V)(data + value_offset)^;
hash := header.hash
key := (^K)(data + key_offset)^
value := (^V)(data + value_offset)^
entries[i] = {hash, key, value};
entries[i] = {hash, key, value}
data += entry_size;
data += entry_size
}
return entries;
return entries
}
+571 -571
View File
File diff suppressed because it is too large Load Diff
+246 -246
View File
@@ -5,111 +5,111 @@ import "core:strings"
are_types_identical :: proc(a, b: ^Type_Info) -> bool {
if a == b {
return true;
return true
}
if (a == nil && b != nil) ||
(a != nil && b == nil) {
return false;
return false
}
switch {
case a.size != b.size, a.align != b.align:
return false;
return false
}
switch x in a.variant {
case Type_Info_Named:
y := b.variant.(Type_Info_Named) or_return;
return x.base == y.base;
y := b.variant.(Type_Info_Named) or_return
return x.base == y.base
case Type_Info_Integer:
y := b.variant.(Type_Info_Integer) or_return;
return x.signed == y.signed && x.endianness == y.endianness;
y := b.variant.(Type_Info_Integer) or_return
return x.signed == y.signed && x.endianness == y.endianness
case Type_Info_Rune:
_, ok := b.variant.(Type_Info_Rune);
return ok;
_, ok := b.variant.(Type_Info_Rune)
return ok
case Type_Info_Float:
_, ok := b.variant.(Type_Info_Float);
return ok;
_, ok := b.variant.(Type_Info_Float)
return ok
case Type_Info_Complex:
_, ok := b.variant.(Type_Info_Complex);
return ok;
_, ok := b.variant.(Type_Info_Complex)
return ok
case Type_Info_Quaternion:
_, ok := b.variant.(Type_Info_Quaternion);
return ok;
_, ok := b.variant.(Type_Info_Quaternion)
return ok
case Type_Info_Type_Id:
_, ok := b.variant.(Type_Info_Type_Id);
return ok;
_, ok := b.variant.(Type_Info_Type_Id)
return ok
case Type_Info_String:
_, ok := b.variant.(Type_Info_String);
return ok;
_, ok := b.variant.(Type_Info_String)
return ok
case Type_Info_Boolean:
_, ok := b.variant.(Type_Info_Boolean);
return ok;
_, ok := b.variant.(Type_Info_Boolean)
return ok
case Type_Info_Any:
_, ok := b.variant.(Type_Info_Any);
return ok;
_, ok := b.variant.(Type_Info_Any)
return ok
case Type_Info_Pointer:
y := b.variant.(Type_Info_Pointer) or_return;
return are_types_identical(x.elem, y.elem);
y := b.variant.(Type_Info_Pointer) or_return
return are_types_identical(x.elem, y.elem)
case Type_Info_Multi_Pointer:
y := b.variant.(Type_Info_Multi_Pointer) or_return;
return are_types_identical(x.elem, y.elem);
y := b.variant.(Type_Info_Multi_Pointer) or_return
return are_types_identical(x.elem, y.elem)
case Type_Info_Procedure:
y := b.variant.(Type_Info_Procedure) or_return;
y := b.variant.(Type_Info_Procedure) or_return
switch {
case x.variadic != y.variadic,
x.convention != y.convention:
return false;
return false
}
return are_types_identical(x.params, y.params) && are_types_identical(x.results, y.results);
return are_types_identical(x.params, y.params) && are_types_identical(x.results, y.results)
case Type_Info_Array:
y := b.variant.(Type_Info_Array) or_return;
y := b.variant.(Type_Info_Array) or_return
if x.count != y.count { return false; }
return are_types_identical(x.elem, y.elem);
return are_types_identical(x.elem, y.elem)
case Type_Info_Enumerated_Array:
y := b.variant.(Type_Info_Enumerated_Array) or_return;
y := b.variant.(Type_Info_Enumerated_Array) or_return
if x.count != y.count { return false; }
return are_types_identical(x.index, y.index) &&
are_types_identical(x.elem, y.elem);
are_types_identical(x.elem, y.elem)
case Type_Info_Dynamic_Array:
y := b.variant.(Type_Info_Dynamic_Array) or_return;
return are_types_identical(x.elem, y.elem);
y := b.variant.(Type_Info_Dynamic_Array) or_return
return are_types_identical(x.elem, y.elem)
case Type_Info_Slice:
y := b.variant.(Type_Info_Slice) or_return;
return are_types_identical(x.elem, y.elem);
y := b.variant.(Type_Info_Slice) or_return
return are_types_identical(x.elem, y.elem)
case Type_Info_Tuple:
y := b.variant.(Type_Info_Tuple) or_return;
y := b.variant.(Type_Info_Tuple) or_return
if len(x.types) != len(y.types) { return false; }
for _, i in x.types {
xt, yt := x.types[i], y.types[i];
xt, yt := x.types[i], y.types[i]
if !are_types_identical(xt, yt) {
return false;
return false
}
}
return true;
return true
case Type_Info_Struct:
y := b.variant.(Type_Info_Struct) or_return;
y := b.variant.(Type_Info_Struct) or_return
switch {
case len(x.types) != len(y.types),
x.is_packed != y.is_packed,
@@ -118,207 +118,207 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
x.soa_kind != y.soa_kind,
x.soa_base_type != y.soa_base_type,
x.soa_len != y.soa_len:
return false;
return false
}
for _, i in x.types {
xn, yn := x.names[i], y.names[i];
xt, yt := x.types[i], y.types[i];
xl, yl := x.tags[i], y.tags[i];
xn, yn := x.names[i], y.names[i]
xt, yt := x.types[i], y.types[i]
xl, yl := x.tags[i], y.tags[i]
if xn != yn { return false; }
if !are_types_identical(xt, yt) { return false; }
if xl != yl { return false; }
}
return true;
return true
case Type_Info_Union:
y := b.variant.(Type_Info_Union) or_return;
y := b.variant.(Type_Info_Union) or_return
if len(x.variants) != len(y.variants) { return false; }
for _, i in x.variants {
xv, yv := x.variants[i], y.variants[i];
xv, yv := x.variants[i], y.variants[i]
if !are_types_identical(xv, yv) { return false; }
}
return true;
return true
case Type_Info_Enum:
// NOTE(bill): Should be handled above
return false;
return false
case Type_Info_Map:
y := b.variant.(Type_Info_Map) or_return;
return are_types_identical(x.key, y.key) && are_types_identical(x.value, y.value);
y := b.variant.(Type_Info_Map) or_return
return are_types_identical(x.key, y.key) && are_types_identical(x.value, y.value)
case Type_Info_Bit_Set:
y := b.variant.(Type_Info_Bit_Set) or_return;
return x.elem == y.elem && x.lower == y.lower && x.upper == y.upper;
y := b.variant.(Type_Info_Bit_Set) or_return
return x.elem == y.elem && x.lower == y.lower && x.upper == y.upper
case Type_Info_Simd_Vector:
y := b.variant.(Type_Info_Simd_Vector) or_return;
return x.count == y.count && x.elem == y.elem;
y := b.variant.(Type_Info_Simd_Vector) or_return
return x.count == y.count && x.elem == y.elem
case Type_Info_Relative_Pointer:
y := b.variant.(Type_Info_Relative_Pointer) or_return;
return x.base_integer == y.base_integer && x.pointer == y.pointer;
y := b.variant.(Type_Info_Relative_Pointer) or_return
return x.base_integer == y.base_integer && x.pointer == y.pointer
case Type_Info_Relative_Slice:
y := b.variant.(Type_Info_Relative_Slice) or_return;
return x.base_integer == y.base_integer && x.slice == y.slice;
y := b.variant.(Type_Info_Relative_Slice) or_return
return x.base_integer == y.base_integer && x.slice == y.slice
}
return false;
return false
}
is_signed :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
#partial switch i in type_info_base(info).variant {
case Type_Info_Integer: return i.signed;
case Type_Info_Float: return true;
case Type_Info_Integer: return i.signed
case Type_Info_Float: return true
}
return false;
return false
}
is_unsigned :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
#partial switch i in type_info_base(info).variant {
case Type_Info_Integer: return !i.signed;
case Type_Info_Float: return false;
case Type_Info_Integer: return !i.signed
case Type_Info_Float: return false
}
return false;
return false
}
is_byte :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
#partial switch i in type_info_base(info).variant {
case Type_Info_Integer: return info.size == 1;
case Type_Info_Integer: return info.size == 1
}
return false;
return false
}
is_integer :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Integer);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Integer)
return ok
}
is_rune :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Rune);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Rune)
return ok
}
is_float :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Float);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Float)
return ok
}
is_complex :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Complex);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Complex)
return ok
}
is_quaternion :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Quaternion);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Quaternion)
return ok
}
is_any :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Any);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Any)
return ok
}
is_string :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_String);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_String)
return ok
}
is_cstring :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
v, ok := type_info_base(info).variant.(Type_Info_String);
return ok && v.is_cstring;
v, ok := type_info_base(info).variant.(Type_Info_String)
return ok && v.is_cstring
}
is_boolean :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Boolean);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Boolean)
return ok
}
is_pointer :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Pointer);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Pointer)
return ok
}
is_multi_pointer :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Multi_Pointer);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Multi_Pointer)
return ok
}
is_procedure :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Procedure);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Procedure)
return ok
}
is_array :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Array);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Array)
return ok
}
is_enumerated_array :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Enumerated_Array);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Enumerated_Array)
return ok
}
is_dynamic_array :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Dynamic_Array);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Dynamic_Array)
return ok
}
is_dynamic_map :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Map);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Map)
return ok
}
is_slice :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Slice);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Slice)
return ok
}
is_tuple :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Tuple);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Tuple)
return ok
}
is_struct :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
s, ok := type_info_base(info).variant.(Type_Info_Struct);
return ok && !s.is_raw_union;
s, ok := type_info_base(info).variant.(Type_Info_Struct)
return ok && !s.is_raw_union
}
is_raw_union :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
s, ok := type_info_base(info).variant.(Type_Info_Struct);
return ok && s.is_raw_union;
s, ok := type_info_base(info).variant.(Type_Info_Struct)
return ok && s.is_raw_union
}
is_union :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Union);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Union)
return ok
}
is_enum :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Enum);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Enum)
return ok
}
is_simd_vector :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Simd_Vector);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Simd_Vector)
return ok
}
is_relative_pointer :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Relative_Pointer);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Relative_Pointer)
return ok
}
is_relative_slice :: proc(info: ^Type_Info) -> bool {
if info == nil { return false; }
_, ok := type_info_base(info).variant.(Type_Info_Relative_Slice);
return ok;
_, ok := type_info_base(info).variant.(Type_Info_Relative_Slice)
return ok
}
@@ -329,256 +329,256 @@ is_relative_slice :: proc(info: ^Type_Info) -> bool {
write_typeid_builder :: proc(buf: ^strings.Builder, id: typeid) {
write_type(buf, type_info_of(id));
write_type(buf, type_info_of(id))
}
write_typeid_writer :: proc(writer: io.Writer, id: typeid) {
write_type(writer, type_info_of(id));
write_type(writer, type_info_of(id))
}
write_typeid :: proc{
write_typeid_builder,
write_typeid_writer,
};
}
write_type :: proc{
write_type_builder,
write_type_writer,
};
}
write_type_builder :: proc(buf: ^strings.Builder, ti: ^Type_Info) -> int {
return write_type_writer(strings.to_writer(buf), ti);
return write_type_writer(strings.to_writer(buf), ti)
}
write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
using strings;
using strings
if ti == nil {
return write_string(w, "nil");
return write_string(w, "nil")
}
_n1 :: proc(err: io.Error) -> int { return 1 if err == nil else 0; };
_n2 :: proc(n: int, _: io.Error) -> int { return n; };
_n :: proc{_n1, _n2};
_n1 :: proc(err: io.Error) -> int { return 1 if err == nil else 0; }
_n2 :: proc(n: int, _: io.Error) -> int { return n; }
_n :: proc{_n1, _n2}
switch info in ti.variant {
case Type_Info_Named:
return write_string(w, info.name);
return write_string(w, info.name)
case Type_Info_Integer:
switch ti.id {
case int: return write_string(w, "int");
case uint: return write_string(w, "uint");
case uintptr: return write_string(w, "uintptr");
case int: return write_string(w, "int")
case uint: return write_string(w, "uint")
case uintptr: return write_string(w, "uintptr")
case:
n += _n(io.write_byte(w, 'i' if info.signed else 'u'));
n += _n(io.write_i64(w, i64(8*ti.size), 10));
n += _n(io.write_byte(w, 'i' if info.signed else 'u'))
n += _n(io.write_i64(w, i64(8*ti.size), 10))
switch info.endianness {
case .Platform: // Okay
case .Little: n += write_string(w, "le");
case .Big: n += write_string(w, "be");
case .Little: n += write_string(w, "le")
case .Big: n += write_string(w, "be")
}
}
case Type_Info_Rune:
n += _n(io.write_string(w, "rune"));
n += _n(io.write_string(w, "rune"))
case Type_Info_Float:
n += _n(io.write_byte(w, 'f'));
n += _n(io.write_i64(w, i64(8*ti.size), 10));
n += _n(io.write_byte(w, 'f'))
n += _n(io.write_i64(w, i64(8*ti.size), 10))
switch info.endianness {
case .Platform: // Okay
case .Little: n += write_string(w, "le");
case .Big: n += write_string(w, "be");
case .Little: n += write_string(w, "le")
case .Big: n += write_string(w, "be")
}
case Type_Info_Complex:
n += _n(io.write_string(w, "complex"));
n += _n(io.write_i64(w, i64(8*ti.size), 10));
n += _n(io.write_string(w, "complex"))
n += _n(io.write_i64(w, i64(8*ti.size), 10))
case Type_Info_Quaternion:
n += _n(io.write_string(w, "quaternion"));
n += _n(io.write_i64(w, i64(8*ti.size), 10));
n += _n(io.write_string(w, "quaternion"))
n += _n(io.write_i64(w, i64(8*ti.size), 10))
case Type_Info_String:
if info.is_cstring {
n += write_string(w, "cstring");
n += write_string(w, "cstring")
} else {
n += write_string(w, "string");
n += write_string(w, "string")
}
case Type_Info_Boolean:
switch ti.id {
case bool: n += write_string(w, "bool");
case bool: n += write_string(w, "bool")
case:
n += _n(io.write_byte(w, 'b'));
n += _n(io.write_i64(w, i64(8*ti.size), 10));
n += _n(io.write_byte(w, 'b'))
n += _n(io.write_i64(w, i64(8*ti.size), 10))
}
case Type_Info_Any:
n += write_string(w, "any");
n += write_string(w, "any")
case Type_Info_Type_Id:
n += write_string(w, "typeid");
n += write_string(w, "typeid")
case Type_Info_Pointer:
if info.elem == nil {
write_string(w, "rawptr");
write_string(w, "rawptr")
} else {
write_string(w, "^");
write_type(w, info.elem);
write_string(w, "^")
write_type(w, info.elem)
}
case Type_Info_Multi_Pointer:
write_string(w, "[^]");
write_type(w, info.elem);
write_string(w, "[^]")
write_type(w, info.elem)
case Type_Info_Procedure:
n += write_string(w, "proc");
n += write_string(w, "proc")
if info.params == nil {
n += write_string(w, "()");
n += write_string(w, "()")
} else {
t := info.params.variant.(Type_Info_Tuple);
n += write_string(w, "(");
t := info.params.variant.(Type_Info_Tuple)
n += write_string(w, "(")
for t, i in t.types {
if i > 0 {
n += write_string(w, ", ");
n += write_string(w, ", ")
}
n += write_type(w, t);
n += write_type(w, t)
}
n += write_string(w, ")");
n += write_string(w, ")")
}
if info.results != nil {
n += write_string(w, " -> ");
n += write_type(w, info.results);
n += write_string(w, " -> ")
n += write_type(w, info.results)
}
case Type_Info_Tuple:
count := len(info.names);
count := len(info.names)
if count != 1 { n += write_string(w, "("); }
for name, i in info.names {
if i > 0 { n += write_string(w, ", "); }
t := info.types[i];
t := info.types[i]
if len(name) > 0 {
n += write_string(w, name);
n += write_string(w, ": ");
n += write_string(w, name)
n += write_string(w, ": ")
}
n += write_type(w, t);
n += write_type(w, t)
}
if count != 1 { n += write_string(w, ")"); }
case Type_Info_Array:
n += _n(io.write_string(w, "["));
n += _n(io.write_i64(w, i64(info.count), 10));
n += _n(io.write_string(w, "]"));
n += write_type(w, info.elem);
n += _n(io.write_string(w, "["))
n += _n(io.write_i64(w, i64(info.count), 10))
n += _n(io.write_string(w, "]"))
n += write_type(w, info.elem)
case Type_Info_Enumerated_Array:
n += write_string(w, "[");
n += write_type(w, info.index);
n += write_string(w, "]");
n += write_type(w, info.elem);
n += write_string(w, "[")
n += write_type(w, info.index)
n += write_string(w, "]")
n += write_type(w, info.elem)
case Type_Info_Dynamic_Array:
n += _n(io.write_string(w, "[dynamic]"));
n += write_type(w, info.elem);
n += _n(io.write_string(w, "[dynamic]"))
n += write_type(w, info.elem)
case Type_Info_Slice:
n += _n(io.write_string(w, "[]"));
n += write_type(w, info.elem);
n += _n(io.write_string(w, "[]"))
n += write_type(w, info.elem)
case Type_Info_Map:
n += _n(io.write_string(w, "map["));
n += write_type(w, info.key);
n += _n(io.write_byte(w, ']'));
n += write_type(w, info.value);
n += _n(io.write_string(w, "map["))
n += write_type(w, info.key)
n += _n(io.write_byte(w, ']'))
n += write_type(w, info.value)
case Type_Info_Struct:
switch info.soa_kind {
case .None: // Ignore
case .Fixed:
n += _n(io.write_string(w, "#soa["));
n += _n(io.write_i64(w, i64(info.soa_len)));
n += _n(io.write_byte(w, ']'));
n += write_type(w, info.soa_base_type);
return;
n += _n(io.write_string(w, "#soa["))
n += _n(io.write_i64(w, i64(info.soa_len)))
n += _n(io.write_byte(w, ']'))
n += write_type(w, info.soa_base_type)
return
case .Slice:
n += _n(io.write_string(w, "#soa[]"));
n += write_type(w, info.soa_base_type);
return;
n += _n(io.write_string(w, "#soa[]"))
n += write_type(w, info.soa_base_type)
return
case .Dynamic:
n += _n(io.write_string(w, "#soa[dynamic]"));
n += write_type(w, info.soa_base_type);
return;
n += _n(io.write_string(w, "#soa[dynamic]"))
n += write_type(w, info.soa_base_type)
return
}
n += write_string(w, "struct ");
n += write_string(w, "struct ")
if info.is_packed { n += write_string(w, "#packed "); }
if info.is_raw_union { n += write_string(w, "#raw_union "); }
if info.custom_align {
n += _n(io.write_string(w, "#align "));
n += _n(io.write_i64(w, i64(ti.align), 10));
n += _n(io.write_byte(w, ' '));
n += _n(io.write_string(w, "#align "))
n += _n(io.write_i64(w, i64(ti.align), 10))
n += _n(io.write_byte(w, ' '))
}
n += _n(io.write_byte(w, '{'));
n += _n(io.write_byte(w, '{'))
for name, i in info.names {
if i > 0 { n += write_string(w, ", "); }
n += _n(io.write_string(w, name));
n += _n(io.write_string(w, ": "));
n += write_type(w, info.types[i]);
n += _n(io.write_string(w, name))
n += _n(io.write_string(w, ": "))
n += write_type(w, info.types[i])
}
n += _n(io.write_byte(w, '}'));
n += _n(io.write_byte(w, '}'))
case Type_Info_Union:
n += write_string(w, "union ");
n += write_string(w, "union ")
if info.custom_align {
n += write_string(w, "#align ");
n += _n(io.write_i64(w, i64(ti.align), 10));
n += _n(io.write_byte(w, ' '));
n += write_string(w, "#align ")
n += _n(io.write_i64(w, i64(ti.align), 10))
n += _n(io.write_byte(w, ' '))
}
n += _n(io.write_byte(w, '{'));
n += _n(io.write_byte(w, '{'))
for variant, i in info.variants {
if i > 0 { n += write_string(w, ", "); }
n += write_type(w, variant);
n += write_type(w, variant)
}
n += _n(io.write_byte(w, '}'));
n += _n(io.write_byte(w, '}'))
case Type_Info_Enum:
n += write_string(w, "enum ");
n += write_type(w, info.base);
n += write_string(w, " {");
n += write_string(w, "enum ")
n += write_type(w, info.base)
n += write_string(w, " {")
for name, i in info.names {
if i > 0 { n += write_string(w, ", "); }
n += write_string(w, name);
n += write_string(w, name)
}
n += _n(io.write_byte(w, '}'));
n += _n(io.write_byte(w, '}'))
case Type_Info_Bit_Set:
n += write_string(w, "bit_set[");
n += write_string(w, "bit_set[")
switch {
case is_enum(info.elem):
n += write_type(w, info.elem);
n += write_type(w, info.elem)
case is_rune(info.elem):
n += write_encoded_rune(w, rune(info.lower));
n += write_string(w, "..");
n += write_encoded_rune(w, rune(info.upper));
n += write_encoded_rune(w, rune(info.lower))
n += write_string(w, "..")
n += write_encoded_rune(w, rune(info.upper))
case:
n += _n(io.write_i64(w, info.lower, 10));
n += write_string(w, "..");
n += _n(io.write_i64(w, info.upper, 10));
n += _n(io.write_i64(w, info.lower, 10))
n += write_string(w, "..")
n += _n(io.write_i64(w, info.upper, 10))
}
if info.underlying != nil {
n += write_string(w, "; ");
n += write_type(w, info.underlying);
n += write_string(w, "; ")
n += write_type(w, info.underlying)
}
n += _n(io.write_byte(w, ']'));
n += _n(io.write_byte(w, ']'))
case Type_Info_Simd_Vector:
n += write_string(w, "#simd[");
n += _n(io.write_i64(w, i64(info.count)));
n += _n(io.write_byte(w, ']'));
n += write_type(w, info.elem);
n += write_string(w, "#simd[")
n += _n(io.write_i64(w, i64(info.count)))
n += _n(io.write_byte(w, ']'))
n += write_type(w, info.elem)
case Type_Info_Relative_Pointer:
n += write_string(w, "#relative(");
n += write_type(w, info.base_integer);
n += write_string(w, ") ");
n += write_type(w, info.pointer);
n += write_string(w, "#relative(")
n += write_type(w, info.base_integer)
n += write_string(w, ") ")
n += write_type(w, info.pointer)
case Type_Info_Relative_Slice:
n += write_string(w, "#relative(");
n += write_type(w, info.base_integer);
n += write_string(w, ") ");
n += write_type(w, info.slice);
n += write_string(w, "#relative(")
n += write_type(w, info.base_integer)
n += write_string(w, ") ")
n += write_type(w, info.slice)
}
return;
return
}