This works: 
    
    
    macro t2(): untyped =
      result = getAst(t1())
    
    #t2()
    
    
    Run

A macro produces an abstract syntax tree (AST) of nodes, that's what is 
assigned to its `result` variable. A macro call like `t1()` is replaced with 
the code representation of this AST, not with the AST itself. If you need the 
AST, and you do in `result = t1()` because `t2` is supposed to return an AST, 
wrap it with `getAST`. Alternatively, `t1` could become a `proc`.

> Even stranger if I comment out t1 and add discard...

The compiler just warns about `t2` not being used because the call to it is 
commented out, not sure what you mean.

Reply via email to