Skip to content

Commit

Permalink
fix to use const eval on advise of @SolitudeSF
Browse files Browse the repository at this point in the history
  • Loading branch information
gpicron committed Apr 28, 2023
1 parent 1721604 commit 8053ad6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/jsony.nim
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,9 @@ proc dumpHook*(s: var string, v: string) =
s.dumpStrFast(v)

template dumpKey(s: var string, v: string) =
var escaped = newStringOfCap(v.len + 5)
dumpHook(escaped, v)
escaped.add ":"
s.add escaped

const v2 = jsony.toJson(v) & ":"
s.add v2

proc dumpHook*(s: var string, v: char) =
s.add '"'
s.add v
Expand Down

0 comments on commit 8053ad6

Please sign in to comment.