-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
function gen_sym(pattern,body)
quote
@metafunction testfun($pattern) begin
$(body...)
end
end
end
@macromethod test(pattern,begin *{body} end) begin
pattern_tree = analyze(pattern,current_module()).child
#matchfun = matcher(pattern,@currentmodule)
if pattern_tree.head.sym != :call
error("not a function call")
end
fun = gen_sym(pattern,body)
quote
$fun
end
end
macroexpand(:(@test f(:E{x,2},:T{y,Int}) begin
f(x+y)
end))
results in
:($(Expr(:error, MethodError(haskey, (ExpressionPatterns.Dispatch.TopMetaTables.MetaModuleTable(Dict{Symbol,ExpressionPatterns.Dispatch.Structure.MetaMethodTable}(), Set{Symbol}()), :($(Expr(:globalref, Main, :testfun)))), 0x0000000000005886))))
I can't see why?
Why can't i return a metafunction?
thanks