Quote a keys for CritBitTree $ impl. Fixes #7987
This commit is contained in:
parent
e06f5bc3d0
commit
aa7348b356
1 changed files with 8 additions and 4 deletions
|
|
@ -322,10 +322,14 @@ proc `$`*[T](c: CritBitTree[T]): string =
|
||||||
const avgItemLen = 16
|
const avgItemLen = 16
|
||||||
result = newStringOfCap(c.count * avgItemLen)
|
result = newStringOfCap(c.count * avgItemLen)
|
||||||
result.add("{")
|
result.add("{")
|
||||||
|
when T is void:
|
||||||
|
for key in keys(c):
|
||||||
|
if result.len > 1: result.add(", ")
|
||||||
|
result.addQuoted(key)
|
||||||
|
else:
|
||||||
for key, val in pairs(c):
|
for key, val in pairs(c):
|
||||||
if result.len > 1: result.add(", ")
|
if result.len > 1: result.add(", ")
|
||||||
result.add($key)
|
result.addQuoted(key)
|
||||||
when T isnot void:
|
|
||||||
result.add(": ")
|
result.add(": ")
|
||||||
result.addQuoted(val)
|
result.addQuoted(val)
|
||||||
result.add("}")
|
result.add("}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue