diff options
author | Araq <rumpf_a@web.de> | 2015-04-20 11:34:18 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-04-20 11:34:18 +0200 |
commit | dc3a0bc00965f10c3906b948aee48d1065d1ccdf (patch) | |
tree | 17ece7e4eaed2ccbacb8a3178baa1b212214f837 /lib/core | |
parent | 9abfc60db441e6d21edbc99f0ef38075fba85f36 (diff) | |
download | Nim-dc3a0bc00965f10c3906b948aee48d1065d1ccdf.tar.gz |
added macros.newTree proc (why didn't we do this earlier?)
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/macros.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 5583748e0..b78b94bd1 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -355,6 +355,12 @@ proc expectLen*(n: NimNode, len: int) {.compileTime.} = ## macros that check its number of arguments. if n.len != len: error("macro expects a node with " & $len & " children") +proc newTree*(kind: NimNodeKind, + children: varargs[NimNode]): NimNode {.compileTime.} = + ## produces a new node with children. + result = newNimNode(kind) + result.add(children) + proc newCall*(theProc: NimNode, args: varargs[NimNode]): NimNode {.compileTime.} = ## produces a new call node. `theProc` is the proc that is called with |