diff options
| author | gingerBill <bill@gingerbill.org> | 2023-05-24 20:54:30 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-05-24 20:54:30 +0100 |
| commit | 32ca50a097c09da8b2bbba4d809b84b419e4c04e (patch) | |
| tree | 67a9b48378b4a960a9b566778b8173f435fb5a9f | |
| parent | 54b7cefb090f3ee23c57291c55bc369f0ea48696 (diff) | |
Fix special printing for certain named types with `fmt.printf` related procedures
| -rw-r--r-- | core/fmt/fmt.odin | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 8a5f54516..b82789813 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -2647,18 +2647,10 @@ fmt_arg :: proc(fi: ^Info, arg: any, verb: rune) { } } - - custom_types: switch a in arg { - case runtime.Source_Code_Location: - if fi.hash && verb == 'v' { - io.write_string(fi.writer, a.file_path, &fi.n) - io.write_byte(fi.writer, '(', &fi.n) - io.write_i64(fi.writer, i64(a.line), 10, &fi.n) - io.write_byte(fi.writer, ':', &fi.n) - io.write_i64(fi.writer, i64(a.column), 10, &fi.n) - io.write_byte(fi.writer, ')', &fi.n) - return - } + arg_info := type_info_of(arg.id) + if info, ok := arg_info.variant.(runtime.Type_Info_Named); ok { + fmt_named(fi, arg, verb, info) + return } base_arg := arg |