I’ve often encountered a problem figuring out where a method is defined when it’s definition happens through a macro. For example:
macro foo()
:(bar() = x)
end
@foo()
bar()
This gives an UndefVarError
with a stacktrace pointing to line 2 (inside the foo
macro), but not showing line 5, where the definition was expanded from (usually, of course, it won’t be in the same file).
How can I find this information? Is it even stored anywhere? It doesn’t seem to be anywhere in the Method
object (@which bar()
).