Get function with macro

How can I get the function object with a macro?

module C
macro getfunc(sig)
    name = sig.args[1]   
end
export @method, @getfunc
end

module D
using Main.C
function foo()
    1
end
using Test
@test (@getfunc foo()) == foo
end

You want esc(sig.args[1]), I think.

2 Likes