I have this snippet
    
    
    import macros
    
    template texture(a, b): untyped =
      var a: TexturePtr
      
      init:
        state.a = loadTexture(b)
      
      finish:
        state.a.free()
    
    static:
      let node = getAst(texture(background, "res/menu.png")) # undeclared 
identifier: background
      let node = getAst(quote do: texture(background, "res/menu.png")) # 
undeclared identifier: TexturePtr
    
    
    Run

I want an option that doesn't error and returns this AST:
    
    
    var background: TexturePtr
    
    init:
      state.background = loadTexture("res/menu.png")
    
    finish:
      state.background.free()
    
    
    Run

Basically gives the result of a single template expanded, not expanded all the 
way to the point of type checking. Does Nim have a hook for this?

Reply via email to