diff --git a/Cargo.lock b/Cargo.lock index 5f1cd510e..416542eb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,12 +213,12 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#f59c0c10922fb330d43b944a5bfcaa1021ecffe3" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4b3b6af70eb84d513b9fa926dd8c36e1dba88713" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#f59c0c10922fb330d43b944a5bfcaa1021ecffe3" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4b3b6af70eb84d513b9fa926dd8c36e1dba88713" dependencies = [ "hashbrown", "hbbytecode", @@ -229,7 +229,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#f59c0c10922fb330d43b944a5bfcaa1021ecffe3" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4b3b6af70eb84d513b9fa926dd8c36e1dba88713" dependencies = [ "hbbytecode", ] diff --git a/sysdata/libraries/stn/src/fmt.hb b/sysdata/libraries/stn/src/fmt.hb index a5ed5924a..f6383a972 100644 --- a/sysdata/libraries/stn/src/fmt.hb +++ b/sysdata/libraries/stn/src/fmt.hb @@ -119,11 +119,23 @@ fmt_float := fn(v: @Any(), str: ^u8, precision: uint, radix: int): uint { fmt_container := fn(v: @Any(), str: ^u8, opts: FormatOptions): uint { T2 := @TypeOf(v) - i := 0; - *@as(^[@lenof(@nameof(T2))]u8, @bitcast(str)) = *@bitcast(@nameof(T2)) - len := @lenof(@nameof(T2)); - *@as(^[2]u8, @bitcast(str + len)) = *@bitcast(".(\0") - len += 2 + kind := Kind.of(T2) + i := 0 + len := 0 + if kind == .Struct { + *@as(^[@lenof(@nameof(T2))]u8, @bitcast(str + len)) = *@bitcast(@nameof(T2)) + len += @lenof(@nameof(T2)); + *@as(^[2]u8, @bitcast(str + len)) = *@bitcast(".(\0") + len += 2 + } else if kind == .Slice { + *@as(^[@lenof(@nameof(@ChildOf(T2)))]u8, @bitcast(str + len)) = *@bitcast(@nameof(@ChildOf(T2))) + len += @lenof(@nameof(@ChildOf(T2))); + *@as(^[2]u8, @bitcast(str + len)) = *@bitcast(".[\0") + len += 2 + } else if kind == .Tuple { + *@as(^[2]u8, @bitcast(str + len)) = *@bitcast(".(\0") + len += 2 + } $loop { v_sub := v[i] len += @inline(format, v_sub, str + len, opts) @@ -132,9 +144,14 @@ fmt_container := fn(v: @Any(), str: ^u8, opts: FormatOptions): uint { *@as(^[2]u8, @bitcast(str + len)) = *@bitcast(", \0") len += 2 } - }; - *@as(^[1]u8, @bitcast(str + len)) = *@bitcast(")\0") - len += 1 + } + if kind == .Struct | kind == .Tuple { + *@as(^[1]u8, @bitcast(str + len)) = *@bitcast(")\0") + len += 1 + } else if kind == .Slice { + *@as(^[1]u8, @bitcast(str + len)) = *@bitcast("]\0") + len += 1 + } return len }