diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-12-08 14:35:22 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-12-08 14:35:22 +0000 |
| commit | e6827393cf2f385a4cd13d605c5280ace33a84f2 (patch) | |
| tree | 4f0bb9d2f7e8cb189ca7b7ea641f3869705a39b5 /core | |
| parent | 3a3239294c9e4a7504bfb60e3cb5f8229fe6a326 (diff) | |
Add `raw_union_tag` struct tag fields to many types in `vendor`
Diffstat (limited to 'core')
| -rw-r--r-- | core/fmt/fmt.odin | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index c05b8eb62..c958c2d2e 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -2076,9 +2076,6 @@ handle_tag :: proc(state: ^Info_State, data: rawptr, info: reflect.Type_Info_Str __handle_raw_union_tag :: proc(fi: ^Info, v: any, the_verb: rune, info: runtime.Type_Info_Struct, type_name: string) -> (ok: bool) { - if fi.state.parent_struct == nil { - return false - } ut := type_info_of(v.id) if !reflect.is_raw_union(ut) { @@ -2104,8 +2101,14 @@ __handle_raw_union_tag :: proc(fi: ^Info, v: any, the_verb: rune, info: runtime. tag := reflect.struct_field_value_by_name(fi.state.parent_struct, tag_name, true) if tag == nil { + // try the current type just in case the tag is also stored here + tag = reflect.struct_field_value_by_name(v, tag_name, false) + } + if tag == nil { return false } + + tag_info := reflect.type_info_base(type_info_of(tag.id)) #partial switch ti in tag_info.variant { case reflect.Type_Info_Enum: |