Fix some about fn bugs

This commit is contained in:
TEC 2024-01-27 03:00:12 +08:00
parent 08f4b58c1a
commit 5492e6954a
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 3 additions and 3 deletions

View File

@ -162,7 +162,7 @@ function memorylayout(val::T) where {T}
end
function about(fn::Function)
source = Main.InteractiveUtils.which(Main, Symbol(fn))
source = Main.InteractiveUtils.which(parentmodule(fn), Symbol(fn))
methodmodules = getproperty.(methods(fn).ms, :module)
others = setdiff(methodmodules, [source])
print(Base.summary(fn))
@ -238,7 +238,7 @@ macro about(obj::Symbol, types::Union{Symbol, Expr}...)
types[1] == :(())
:(about($obj, Tuple{}))
elseif Core.eval(Main, obj) isa Function && length(types) > 0
:(about($obj, $(Tuple{Core.eval.(Main, types)...})))
:(about($obj, $(Tuple{Core.eval.(Ref(Main), types)...})))
else
:(about($obj))
end |> esc
@ -249,7 +249,7 @@ macro about(qobj::Union{QuoteNode, Expr}, types::Union{Symbol, Expr}...)
types[1] == :(())
:(about($(Core.eval(Main, qobj)), Tuple{}))
elseif length(types) > 0
:(about($(Core.eval(Main, qobj)), $(Tuple{Core.eval.(Main, types)...})))
:(about($(Core.eval(Main, qobj)), $(Tuple{Core.eval.(Ref(Main), types)...})))
else
:(about($(Core.eval(Main, qobj))))
end |> esc