Skip to content

Commit

Permalink
Merge pull request #145 from JuliaDebug/kc/whereis
Browse files Browse the repository at this point in the history
fix typo in whereis
  • Loading branch information
timholy authored Mar 14, 2019
2 parents dd876a0 + bcda7c1 commit 608aea9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function CodeTracking.whereis(framecode::FrameCode, pc)
codeloc == 0 && return nothing
lineinfo = framecode.src.linetable[codeloc]
return isa(framecode.scope, Method) ?
whereis(lineinfo, framecode.scope) : getfile(lineinfo), getline(lineinfo)
whereis(lineinfo, framecode.scope) : (getfile(lineinfo), getline(lineinfo))
end
CodeTracking.whereis(frame::Frame, pc=frame.pc) = whereis(frame.framecode, pc)

Expand Down
7 changes: 7 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,10 @@ end
x = Union{Array{UInt8,N},Array{Int8,N}} where N
@test isa(JuliaInterpreter.prepare_call(varargidentity, [varargidentity, x])[1], JuliaInterpreter.FrameCode)
end

# Test return value of whereis
f() = nothing
fr = JuliaInterpreter.enter_call(f)
file, line = JuliaInterpreter.whereis(fr)
@test file == @__FILE__
@test line == (@__LINE__() - 4)
2 changes: 1 addition & 1 deletion test/toplevel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ end
module Toplevel end

@testset "toplevel" begin
modexs, _ = JuliaInterpreter.split_expressions(Toplevel, read_and_parse("toplevel_script.jl"))
modexs, _ = JuliaInterpreter.split_expressions(Toplevel, read_and_parse(joinpath(@__DIR__, "toplevel_script.jl")))
for modex in modexs
frame = JuliaInterpreter.prepare_thunk(modex)
while true
Expand Down

0 comments on commit 608aea9

Please sign in to comment.