Skip to content

Commit bfbee01

Browse files
authored
Merge pull request #52 from JuliaDebug/teh/fix_51
Check output type of `prepare_call` more carefully. Fixes #51.
2 parents 2f5a96f + fa4737f commit bfbee01

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/JuliaInterpreter.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ See [`enter_call`](@ref) for a similar approach not based on expressions.
789789
"""
790790
function enter_call_expr(expr; enter_generated = false)
791791
r = determine_method_for_expr(expr; enter_generated = enter_generated)
792-
if r !== nothing
792+
if isa(r, Tuple)
793793
return build_frame(r[1:end-1]...)
794794
end
795795
nothing
@@ -841,7 +841,7 @@ function enter_call(@nospecialize(finfo), @nospecialize(args...); kwargs...)
841841
error(f, " is a builtin or intrinsic")
842842
end
843843
r = prepare_call(f, allargs; enter_generated=enter_generated)
844-
if r !== nothing
844+
if isa(r, Tuple)
845845
return build_frame(r[1:end-1]...)
846846
end
847847
return nothing

test/interpret.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using JuliaInterpreter
22
using JuliaInterpreter: enter_call_expr
3-
using Test
3+
using Test, InteractiveUtils
44

55
module Isolated end
66

@@ -214,3 +214,10 @@ frame = JuliaInterpreter.enter_call(f, 3)
214214
@test JuliaInterpreter.linenumber(frame, JuliaInterpreter.JuliaProgramCounter(1)) == defline + 1
215215
@test JuliaInterpreter.linenumber(frame, JuliaInterpreter.JuliaProgramCounter(3)) == defline + 4
216216
@test JuliaInterpreter.linenumber(frame, JuliaInterpreter.JuliaProgramCounter(5)) == defline + 6
217+
218+
# issue #51
219+
if isdefined(Core.Compiler, :SNCA)
220+
ci = @code_lowered gcd(10, 20)
221+
cfg = Core.Compiler.compute_basic_blocks(ci.code)
222+
@test isa(@interpret(Core.Compiler.SNCA(cfg)), Vector{Int})
223+
end

0 commit comments

Comments
 (0)