Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo in whereis #145

Merged
merged 2 commits into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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