Created
December 15, 2016 00:10
-
-
Save ZacLN/866a5735cb5355977dbf85efe9439eb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ns = Expr(:module, true, :Namespace, Expr(:block)) | |
meth = Expr(:type, true, :Meth, Expr(:block, :parameters, :(file::AbstractString), :(line::Int))) | |
func = Expr(:type, true, :Func, Expr(:block, :(methods::Vector{Meth}))) | |
push!(ns.args[3].args, Expr(:type, true, :Meth, Expr(:block, :parameters, :(file::AbstractString), :(line::Int)))) | |
push!(ns.args[3].args, Expr(:type, true, :Func, Expr(:block, :(methods::Vector{Meth})))) | |
M = Core | |
m = Expr(:module, true, Symbol(M), Expr(:block, meth, func)) | |
for n in names(M, true, true) | |
x, exists = get_value(n, M) | |
if exists && first(string(n))!='#' && n!=:eval | |
t = typeof(x) | |
sigs = map(methods(x)) do met | |
decl = Base.arg_decl_parts(met) | |
Expr(:call, :Meth, [Expr(:(::), Symbol(v[1]), Symbol(v[2])) for v in decl[2][2:end]], string(decl[3]), decl[4]) | |
end | |
if isa(x, Function) && length(sigs)>0 | |
push!(m.args[3].args,Expr(:(=), n, string(sigs))) | |
elseif isa(x, DataType) | |
push!(m.args[3].args, Expr(:(=), n, Docs.doc(Docs.Binding(Core, n)))) | |
end | |
end | |
end | |
push!(ns.args[3].args, m); | |
eval(ns) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment