diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-06-06 10:51:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-06 10:51:42 +0200 |
commit | 97cf2a309a69f0a8f2250aef370e3ebc587311a4 (patch) | |
tree | 338b32b07a1bc1278c4c978a7ebcf024d6911901 | |
parent | a58bd643de02475ccf2f1e2161e191d30e7203dc (diff) | |
parent | a0cb1a80dd61428de8046cee25e664b41156e6ab (diff) | |
download | Nim-97cf2a309a69f0a8f2250aef370e3ebc587311a4.tar.gz |
Merge pull request #7965 from hlaaftana/patch-3
Allow `%` overloading in `%*` macro in json (again)
-rw-r--r-- | lib/pure/json.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim index e7ad5bd5a..1bd53edb7 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -328,14 +328,14 @@ proc toJson(x: NimNode): NimNode {.compiletime.} = result = newNimNode(nnkBracket) for i in 0 ..< x.len: result.add(toJson(x[i])) - result = newCall(bindSym"%", result) + result = newCall(bindSym("%", brOpen), result) of nnkTableConstr: # object if x.len == 0: return newCall(bindSym"newJObject") result = newNimNode(nnkTableConstr) for i in 0 ..< x.len: x[i].expectKind nnkExprColonExpr result.add newTree(nnkExprColonExpr, x[i][0], toJson(x[i][1])) - result = newCall(bindSym"%", result) + result = newCall(bindSym("%", brOpen), result) of nnkCurly: # empty object x.expectLen(0) result = newCall(bindSym"newJObject") @@ -343,9 +343,9 @@ proc toJson(x: NimNode): NimNode {.compiletime.} = result = newCall(bindSym"newJNull") of nnkPar: if x.len == 1: result = toJson(x[0]) - else: result = newCall(bindSym"%", x) + else: result = newCall(bindSym("%", brOpen), x) else: - result = newCall(bindSym"%", x) + result = newCall(bindSym("%", brOpen), x) macro `%*`*(x: untyped): untyped = ## Convert an expression to a JsonNode directly, without having to specify |