Source_Code_Location.hash; %#v printing for Source_Code_Location; allow typeid for map keys

This commit is contained in:
gingerBill
2019-01-05 15:56:47 +00:00
parent aac643f476
commit 5acea1bceb
6 changed files with 58 additions and 6 deletions
+15
View File
@@ -34,6 +34,7 @@ Fmt_Info :: struct {
arg: any, // Temporary
}
string_buffer_from_slice :: proc(backing: []byte) -> String_Buffer {
s := transmute(mem.Raw_Slice)backing;
d := mem.Raw_Dynamic_Array{
@@ -1281,6 +1282,20 @@ fmt_arg :: proc(fi: ^Fmt_Info, arg: any, verb: rune) {
return;
}
custom_types: switch a in arg {
case runtime.Source_Code_Location:
if fi.hash && verb == 'v' {
write_string(fi.buf, a.file_path);
write_byte(fi.buf, '(');
write_i64(fi.buf, i64(a.line), 10);
write_byte(fi.buf, ':');
write_i64(fi.buf, i64(a.column), 10);
write_byte(fi.buf, ')');
return;
}
}
base_arg := arg;
base_arg.id = runtime.typeid_base(base_arg.id);
switch a in base_arg {