Skip to content

Commit

Permalink
Merge f4ee837 into 7c2c5a2
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Oct 24, 2020
2 parents 7c2c5a2 + f4ee837 commit b729579
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/loadsave.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const sym2loader = Dict{Symbol,Vector{Symbol}}()
const sym2saver = Dict{Symbol,Vector{Symbol}}()
const load_locker = Base.ReentrantLock()

is_installed(pkg::Symbol) = get(Pkg.installed(), string(pkg), nothing) != nothing

Expand All @@ -16,19 +17,21 @@ function topimport(modname)
end

function checked_import(pkg::Symbol)
# kludge for test suite
if isdefined(Main, pkg)
m1 = getfield(Main, pkg)
isa(m1, Module) && return m1
end
if isdefined(FileIO, pkg)
m1 = getfield(FileIO, pkg)
isa(m1, Module) && return m1
lock(load_locker) do
# kludge for test suite
if isdefined(Main, pkg)
m1 = getfield(Main, pkg)
isa(m1, Module) && return m1
end
if isdefined(FileIO, pkg)
m1 = getfield(FileIO, pkg)
isa(m1, Module) && return m1
end
m = _findmod(pkg)
m == nothing || return Base.loaded_modules[m]
topimport(pkg)
return Base.loaded_modules[_findmod(pkg)]
end
m = _findmod(pkg)
m == nothing || return Base.loaded_modules[m]
topimport(pkg)
return Base.loaded_modules[_findmod(pkg)]
end


Expand Down

0 comments on commit b729579

Please sign in to comment.