added newTree to ast.nim

This commit is contained in:
Araq 2015-11-10 15:29:01 +01:00
commit 81f876040b

View file

@ -1013,6 +1013,10 @@ proc newNode*(kind: TNodeKind): PNode =
writeStackTrace() writeStackTrace()
inc gNodeId inc gNodeId
proc newTree*(kind: TNodeKind; children: varargs[PNode]): PNode =
result = newNode(kind)
result.sons = @children
proc newIntNode*(kind: TNodeKind, intVal: BiggestInt): PNode = proc newIntNode*(kind: TNodeKind, intVal: BiggestInt): PNode =
result = newNode(kind) result = newNode(kind)
result.intVal = intVal result.intVal = intVal