Skip to content

Commit 54f6697

Browse files
authored
allow overload for next_or_nothing! (#115)
I am writing a solution for #99 by overloading `next_or_nothing!`. This PR serves as a preparation for that, while the basic usage of LCU remains unchanged.
1 parent 5277734 commit 54f6697

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/codeedges.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ function selective_eval!(@nospecialize(recurse), frame::Frame, isrequired::Abstr
943943
if te
944944
pcexec = pc = step_expr!(recurse, frame, istoplevel)
945945
else
946-
pc = next_or_nothing!(frame)
946+
pc = next_or_nothing!(recurse, frame)
947947
end
948948
end
949949
isa(pc, BreakpointRef) && return pc

src/signatures.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
493493
sigt, pc = signature(recurse, frame, stmt, pc)
494494
meth = whichtt(sigt)
495495
if isa(meth, Method) && (meth.sig <: sigt && sigt <: meth.sig)
496-
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(frame)
496+
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(recurse, frame)
497497
elseif define
498498
pc = step_expr!(recurse, frame, stmt, true)
499499
meth = whichtt(sigt)
@@ -517,7 +517,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
517517
@warn "file $(loc.file), line $(loc.line): no method found for $sigt"
518518
end
519519
if pc == pc3
520-
pc = next_or_nothing!(frame)
520+
pc = next_or_nothing!(recurse, frame)
521521
end
522522
end
523523
end
@@ -560,7 +560,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
560560
# Methods like f(x::Ref{<:Real}) that use gensymmed typevars will not have the *exact*
561561
# signature of the active method. So let's get the active signature.
562562
frame.pc = pc
563-
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(frame)
563+
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(recurse, frame)
564564
meth = whichtt(sigt)
565565
isa(meth, Method) && push!(signatures, meth.sig) # inner methods are not visible
566566
name === name3 && return pc, pc3 # if this was an inner method we should keep going

src/utils.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ Advance the program counter without executing the corresponding line.
210210
If `frame` is finished, `nextpc` will be `nothing`.
211211
"""
212212
next_or_nothing(frame, pc) = pc < nstatements(frame.framecode) ? pc+1 : nothing
213-
function next_or_nothing!(frame)
213+
next_or_nothing!(frame) = next_or_nothing(finish_and_return!, frame)
214+
function next_or_nothing!(@nospecialize(recurse), frame)
214215
pc = frame.pc
215216
if pc < nstatements(frame.framecode)
216-
frame.pc = pc = pc + 1
217-
return pc
217+
return frame.pc = pc + 1
218218
end
219219
return nothing
220220
end

0 commit comments

Comments
 (0)