Skip to content

Commit 162cfb3

Browse files
authored
juliac: add invokelatest_gr override to juliac-buildscript.jl (#57205)
This extends the existing `invokelatest` hack to treat the current world as the latest world for globalref lookups. Since this came up, @Keno can you confirm that any world-age-affecting operations on bindings still require `eval()`? Are there any imports / assignments / etc. that might bump the world age by changing a binding?
1 parent 2a9c133 commit 162cfb3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contrib/juliac-buildscript.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ end
3838
@inline function invokelatest(f::F, args...; kwargs...) where F
3939
return f(args...; kwargs...)
4040
end
41+
@inline function invokelatest_gr(gr::GlobalRef, @nospecialize args...; kwargs...)
42+
@inline
43+
kwargs = merge(NamedTuple(), kwargs)
44+
if isempty(kwargs)
45+
return apply_gr(gr, args...)
46+
end
47+
return apply_gr_kw(kwargs, gr, args...)
48+
end
4149
function sprint(f::F, args::Vararg{Any,N}; context=nothing, sizehint::Integer=0) where {F<:Function,N}
4250
s = IOBuffer(sizehint=sizehint)
4351
if context isa Tuple

0 commit comments

Comments
 (0)