Remove expr/stmt (#5857)

This commit is contained in:
Arne Döring 2017-07-25 09:28:23 +02:00 • committed by Andreas Rumpf
commit 000b8afd26
168 changed files with 497 additions and 529 deletions

View file

@ -1,15 +1,15 @@
type PNode* = ref object of RootObj
template litNode (name, ty): stmt =
template litNode(name, ty) =
type name* = ref object of PNode
val*: ty
litNode PIntNode, int
import json
template withKey*(j: JsonNode; key: string; varname: expr;
body:stmt): stmt {.immediate.} =
template withKey*(j: JsonNode; key: string; varname,
body: untyped): typed =
if j.hasKey(key):
let varname{.inject.}= j[key]
block:
@ -18,4 +18,3 @@ template withKey*(j: JsonNode; key: string; varname: expr;
var j = parsejson("{\"zzz\":1}")
withkey(j, "foo", x):
echo(x)