diff --git a/base/docs.jl b/base/docs.jl index 8cc23e470a0ac1..23df4d04d10319 100644 --- a/base/docs.jl +++ b/base/docs.jl @@ -56,10 +56,10 @@ function newmethod(funcs, f) end function trackmethod(def) - name = namify(unblock(def)) + name = uncurly(unblock(def).args[1].args[1]) f = esc(name) quote - if isdefined($(Expr(:quote, name))) && isgeneric($f) + if $(isexpr(name, Symbol)) && isdefined($(Expr(:quote, name))) && isgeneric($f) funcs = [def => def.func for def in methods($f)] $(esc(def)) $f, newmethod(funcs, $f) @@ -127,6 +127,8 @@ function unblock(ex) return exs[1] end +uncurly(ex) = isexpr(ex, :curly) ? ex.args[1] : ex + namify(ex::Expr) = namify(ex.args[1]) namify(sy::Symbol) = sy