Skip to content

Commit

Permalink
Merge 0406840 into 8df3bef
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb authored Nov 19, 2020
2 parents 8df3bef + 0406840 commit 1fb51ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ macro lookup(args...)
nodetmp = gensym(:node) # used to hoist, e.g., args[4]
if havemod
fallback = quote
isa($nodetmp, Symbol) ? getfield($(esc(mod)), $nodetmp) :
isa($nodetmp, Symbol) && isdefined($(esc(mod)), $nodetmp) ? getfield($(esc(mod)), $nodetmp) :
$nodetmp
end
else
Expand All @@ -61,7 +61,7 @@ macro lookup(args...)
isa($nodetmp, GlobalRef) ? lookup_var($(esc(frame)), $nodetmp) :
isa($nodetmp, SlotNumber) ? lookup_var($(esc(frame)), $nodetmp) :
isa($nodetmp, QuoteNode) ? $nodetmp.value :
isa($nodetmp, Symbol) ? getfield(moduleof($(esc(frame))), $nodetmp) :
isa($nodetmp, Symbol) && isdefined(moduleof($(esc(frame))), $nodetmp) ? getfield(moduleof($(esc(frame))), $nodetmp) :
isa($nodetmp, Expr) ? lookup_expr($(esc(frame)), $nodetmp) :
$fallback
end
Expand Down
5 changes: 5 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,8 @@ end
frame = JuliaInterpreter.enter_call(A396, 3)
@test length(JuliaInterpreter.locals(frame)) > 0
end

@testset "logging" begin
foo(x) = @info x
@test @interpret(foo(2)) === nothing
end

0 comments on commit 1fb51ca

Please sign in to comment.