Skip to content

Commit 9925eea

Browse files
committed
docs: fix-up world-age handling for META access
This improves the world-age handling for Base.Docs slightly. It had a corner case where it could fail to init the META dictionary if the META binding was deleted in a later world, and fixes a missing `invokelatest` for `doc!`.
1 parent 8c62f42 commit 9925eea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

base/docs/Docs.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ const META = gensym(:meta)
7575
const METAType = IdDict{Any,Any}
7676

7777
function meta(m::Module; autoinit::Bool=true)
78-
if !isdefinedglobal(m, META)
79-
return autoinit ? invokelatest(initmeta, m) : nothing
78+
if !invokelatest(isdefinedglobal, m, META)
79+
return autoinit ? initmeta(m) : nothing
8080
end
8181
# TODO: This `invokelatest` is not technically required, but because
8282
# of the automatic constant backdating is currently required to avoid
@@ -85,13 +85,13 @@ function meta(m::Module; autoinit::Bool=true)
8585
end
8686

8787
function initmeta(m::Module)
88-
if !isdefinedglobal(m, META)
88+
if !invokelatest(isdefinedglobal, m, META)
8989
val = METAType()
9090
Core.eval(m, :(const $META = $val))
9191
push!(modules, m)
9292
return val
9393
end
94-
return getglobal(m, META)
94+
return invokelatest(getglobal, m, META)
9595
end
9696

9797
function signature!(tv::Vector{Any}, expr::Expr)

0 commit comments

Comments
 (0)