overloading resolution for getAst; breaking change

This commit is contained in:
Araq 2017-03-18 20:57:45 +01:00
commit aa4260ffa8
5 changed files with 44 additions and 18 deletions

View file

@ -2,13 +2,13 @@
import macros
template plus(a, b: expr): expr {.dirty} =
template plus(a, b: untyped): untyped {.dirty} =
a + b
macro call(e: expr): expr =
macro call(e: untyped): untyped =
result = newCall("foo", newStrLitNode("bar"))
macro dumpAST(n: stmt): stmt {.immediate.} =
macro dumpAST(n: untyped): untyped =
# dump AST as a side-effect and return the inner node
let n = callsite()
echo n.lispRepr
@ -17,7 +17,7 @@ macro dumpAST(n: stmt): stmt {.immediate.} =
var plusAst = getAst(plus(1, 2))
echo plusAst.lispRepr
var callAst = getAst(call())
var callAst = getAst(call(4))
echo callAst.lispRepr
var e = parseExpr("foo(bar + baz)")