-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I happened to build two macros that uses splitdef and combinedef functions. When I tried to use them together, splitdef gives an error. Looks like it doesn't expand the inner macro before applying the outer macro. Is this a ExprTools problem or could I fix it some other way? thanks
Here's a MWE:
macro foo(ex)
esc(combinedef(splitdef(ex)))
end
macro bar(ex)
esc(combinedef(splitdef(ex)))
endError as follows:
julia> @foo @bar f(x)
ERROR: LoadError: ArgumentError: Function definition contains invalid function head `:macrocall`
Expr
head: Symbol macrocall
args: Array{Any}((3,))
1: Symbol @bar
2: LineNumberNode
line: Int64 1
file: Symbol REPL[52]
3: Expr
head: Symbol call
args: Array{Any}((2,))
1: Symbol f
2: Symbol x
Stacktrace:
[1] invalid_def at /Users/tomkwong/.julia/packages/ExprTools/xk0OO/src/function.jl:30 [inlined]
[2] splitdef(::Expr; throw::Bool) at /Users/tomkwong/.julia/packages/ExprTools/xk0OO/src/function.jl:37
[3] splitdef(::Expr) at /Users/tomkwong/.julia/packages/ExprTools/xk0OO/src/function.jl:24
[4] @foo(::LineNumberNode, ::Module, ::Any) at ./REPL[40]:2
in expression starting at REPL[52]:1Metadata
Metadata
Assignees
Labels
No labels