Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ Return all symbols in the module `m`.
This is used in a GAP method for `RecNames`.
"""
function get_symbols_in_module(m::Module)
name = string(nameof(m))::String
list = completions(name * ".", length(name) + 1)[1]
list = [Symbol(x.mod) for x in list]
list = filter(i -> isdefined(m, i), list)
@static if VERSION >= v"1.12.0-DEV.633" # https://github.com/JuliaLang/julia/pull/54609
list = names(m; all=true, imported=true, usings=true)
else
name = string(nameof(m))::String
list = completions(name * ".", length(name) + 1)[1]
list = [Symbol(x.mod) for x in list]
end
filter!(i -> isdefined(m, i), list) # remove non-defined symbols
filter!(i -> !startswith(string(i), "#"), list) # remove compiler-generated symbols
filter!(i -> i != Symbol(m), list) # remove module name itself
return list
end

Expand Down
Loading