Advertisement
Guest User

Untitled

a guest
Sep 27th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.27 KB | None | 0 0
  1. import macros
  2.  
  3. static:
  4.   var node = newStmtList()
  5.  
  6. macro foo(body: untyped): untyped =
  7.   echo body.treerepr
  8.    
  9.   node.add body # works
  10.   result = newStmtList()
  11.   result.add body
  12.  
  13. proc bar(n:NimNode)= #doesn't work
  14.   var t = foo:
  15.     echo 3
  16.   n.add t
  17.  
  18. bar(node)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement