Nim/tests/macros/tlocktypednode1.nim
Arne Döring 44e7a7b6c2 Lock semchecked ast for macros (#11883) [bugfix]
* reject to modify type checked AST
* add flag to back out
* Introduce legacy feature set.
2019-08-08 16:57:06 +02:00

12 lines
238 B
Nim

discard """
errormsg: "typechecked nodes may not be modified"
"""
import macros
macro doSomething(arg: typed): untyped =
echo arg.treeREpr
result = arg
result.add newCall(bindSym"echo", newLit(1))
doSomething((echo(1); echo(2)))