Remove expr/stmt (#5857)
This commit is contained in:
parent
52ff244d5d
commit
000b8afd26
168 changed files with 497 additions and 529 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue