Skip to content

Commit d4c2351

Browse files
authored
quote rhs of :const expression (#687)
1 parent a29cc79 commit d4c2351

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/interpret.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ function step_expr!(interp::Interpreter, frame::Frame, @nospecialize(node), isto
516516
elseif node.head === :const || node.head === :globaldecl
517517
g = node.args[1]
518518
if length(node.args) == 2
519-
Core.eval(moduleof(frame), Expr(:block, Expr(node.head, g, lookup(interp, frame, node.args[2])), nothing))
519+
Core.eval(moduleof(frame), Expr(:block, Expr(node.head, g, QuoteNode(lookup(interp, frame, node.args[2]))), nothing))
520520
else
521521
Core.eval(moduleof(frame), Expr(:block, Expr(node.head, g), nothing))
522522
end

test/toplevel.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,3 +633,8 @@ end
633633
JuliaInterpreter.finish!(frame, true)
634634
@test nmethods_in_overlay() == 4
635635
end
636+
637+
# Need to wrap rhs of `:const` expression
638+
let ex = :(const ___symbol___ = :___symbol___)
639+
@test JuliaInterpreter.finish_and_return!(Frame(@__MODULE__, ex), true) === :___symbol___
640+
end

0 commit comments

Comments
 (0)