tlocktypednode3.nim 286 B

12345678910111213141516
  1. discard """
  2. errormsg: "typechecked nodes may not be modified"
  3. """
  4. import macros
  5. macro doSomething(arg: typed): untyped =
  6. echo arg.treeREpr
  7. result = arg
  8. result.add(
  9. newCall(bindSym"echo", newLit(3)),
  10. newCall(bindSym"echo", newLit(1))
  11. )
  12. doSomething((echo(1); echo(2)))