diff options
author | data-man <datamanrb@gmail.com> | 2018-06-07 18:39:46 +0300 |
---|---|---|
committer | data-man <datamanrb@gmail.com> | 2018-06-07 18:39:46 +0300 |
commit | aa7348b3565e9d63bda1c58b806b6d4f9cc522f9 (patch) | |
tree | 58682349cfacfa76dd95915e2d91a38fade9f2dc | |
parent | e06f5bc3d0b2e7a637cf3f6da7ad228aa9f02cc1 (diff) | |
download | Nim-aa7348b3565e9d63bda1c58b806b6d4f9cc522f9.tar.gz |
Quote a keys for CritBitTree $ impl. Fixes #7987
-rw-r--r-- | lib/pure/collections/critbits.nim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/pure/collections/critbits.nim b/lib/pure/collections/critbits.nim index 5ae5e26b2..71615002e 100644 --- a/lib/pure/collections/critbits.nim +++ b/lib/pure/collections/critbits.nim @@ -322,10 +322,14 @@ proc `$`*[T](c: CritBitTree[T]): string = const avgItemLen = 16 result = newStringOfCap(c.count * avgItemLen) result.add("{") - for key, val in pairs(c): - if result.len > 1: result.add(", ") - result.add($key) - when T isnot void: + 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): + if result.len > 1: result.add(", ") + result.addQuoted(key) result.add(": ") result.addQuoted(val) result.add("}") |