Skip to content

Commit

Permalink
Optimize show(io::IO, m::Module) implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sacha0 committed Oct 23, 2021
1 parent 030a0f9 commit cb5bc66
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,22 @@ function show(io::IO, m::Module)
if is_root_module(m)
print(io, nameof(m))
else
print(io, join(fullname(m),"."))
print_fullname(io, m)
end
end
function print_fullname(io::IO, m::Module)
_print_fullname(io, parentmodule(m))
print(io, nameof(m))
end
function _print_fullname(io::IO, m::Module)
mp = parentmodule(m)
if m === Main || m === Base || m === Core || mp === m
print(io, nameof(m))
print(io, '.')
else
_print_fullname(io, mp)
print(io, nameof(m))
print(io, '.')
end
end

Expand Down

0 comments on commit cb5bc66

Please sign in to comment.