mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-24 22:54:59 -07:00
Reduce the size of runtime.Type_Info
This commit is contained in:
@@ -506,7 +506,7 @@ _marshal_into_encoder :: proc(e: Encoder, v: any, ti: ^runtime.Type_Info) -> (er
|
||||
}
|
||||
|
||||
n: u64; {
|
||||
for _, i in info.names {
|
||||
for _, i in info.names[:info.field_count] {
|
||||
if field_name(info, i) != "-" {
|
||||
n += 1
|
||||
}
|
||||
@@ -522,7 +522,7 @@ _marshal_into_encoder :: proc(e: Encoder, v: any, ti: ^runtime.Type_Info) -> (er
|
||||
entries := make([dynamic]Name, 0, n, e.temp_allocator) or_return
|
||||
defer delete(entries)
|
||||
|
||||
for _, i in info.names {
|
||||
for _, i in info.names[:info.field_count] {
|
||||
fname := field_name(info, i)
|
||||
if fname == "-" {
|
||||
continue
|
||||
@@ -540,7 +540,7 @@ _marshal_into_encoder :: proc(e: Encoder, v: any, ti: ^runtime.Type_Info) -> (er
|
||||
marshal_entry(e, info, v, entry.name, entry.field) or_return
|
||||
}
|
||||
} else {
|
||||
for _, i in info.names {
|
||||
for _, i in info.names[:info.field_count] {
|
||||
fname := field_name(info, i)
|
||||
if fname == "-" {
|
||||
continue
|
||||
|
||||
@@ -618,7 +618,7 @@ _unmarshal_map :: proc(d: Decoder, v: any, ti: ^reflect.Type_Info, hdr: Header,
|
||||
|
||||
#partial switch t in ti.variant {
|
||||
case reflect.Type_Info_Struct:
|
||||
if t.is_raw_union {
|
||||
if .raw_union in t.flags {
|
||||
return _unsupported(v, hdr)
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
|
||||
ti := runtime.type_info_base(type_info_of(v.id))
|
||||
info := ti.variant.(runtime.Type_Info_Struct)
|
||||
first_iteration := true
|
||||
for name, i in info.names {
|
||||
for name, i in info.names[:info.field_count] {
|
||||
omitempty := false
|
||||
|
||||
json_name, extra := json_name_from_tag_value(reflect.struct_tag_get(reflect.Struct_Tag(info.tags[i]), "json"))
|
||||
|
||||
@@ -368,7 +368,7 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
|
||||
|
||||
#partial switch t in ti.variant {
|
||||
case reflect.Type_Info_Struct:
|
||||
if t.is_raw_union {
|
||||
if .raw_union in t.flags {
|
||||
return UNSUPPORTED_TYPE
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user