Skip to content

Commit ea522b8

Browse files
committed
adjustments to JuliaLang/julia#54678
1 parent eae3b4c commit ea522b8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/interpret.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,14 @@ function do_assignment!(frame, @nospecialize(lhs), @nospecialize(rhs))
372372
counter = (frame.assignment_counter += 1)
373373
data.locals[lhs.id] = Some{Any}(rhs)
374374
data.last_reference[lhs.id] = counter
375-
elseif isa(lhs, GlobalRef)
375+
elseif isa(lhs, Symbol) || isa(lhs, GlobalRef)
376+
mod = lhs isa Symbol ? moduleof(frame) : lhs.mod
377+
name = lhs isa Symbol ? lhs : lhs.name
378+
Core.eval(mod, Expr(:global, name))
376379
@static if @isdefined setglobal!
377-
setglobal!(lhs.mod, lhs.name, rhs)
380+
setglobal!(mod, name, rhs)
378381
else
379-
ccall(:jl_set_global, Cvoid, (Any, Any, Any), lhs.mod, lhs.name, rhs)
380-
end
381-
elseif isa(lhs, Symbol)
382-
@static if @isdefined setglobal!
383-
setglobal!(moduleof(code), lhs, rhs)
384-
else
385-
ccall(:jl_set_global, Cvoid, (Any, Any, Any), moduleof(code), lhs, rhs)
382+
ccall(:jl_set_global, Cvoid, (Any, Any, Any), mod, name, rhs)
386383
end
387384
end
388385
end

0 commit comments

Comments
 (0)