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

allow overload for next_or_nothing! #115

Merged
merged 1 commit into from
Sep 10, 2024
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/codeedges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ function selective_eval!(@nospecialize(recurse), frame::Frame, isrequired::Abstr
if te
pcexec = pc = step_expr!(recurse, frame, istoplevel)
else
pc = next_or_nothing!(frame)
pc = next_or_nothing!(recurse, frame)
end
end
isa(pc, BreakpointRef) && return pc
Expand Down
6 changes: 3 additions & 3 deletions src/signatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
sigt, pc = signature(recurse, frame, stmt, pc)
meth = whichtt(sigt)
if isa(meth, Method) && (meth.sig <: sigt && sigt <: meth.sig)
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(frame)
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(recurse, frame)
elseif define
pc = step_expr!(recurse, frame, stmt, true)
meth = whichtt(sigt)
Expand All @@ -517,7 +517,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
@warn "file $(loc.file), line $(loc.line): no method found for $sigt"
end
if pc == pc3
pc = next_or_nothing!(frame)
pc = next_or_nothing!(recurse, frame)
end
end
end
Expand Down Expand Up @@ -560,7 +560,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
# Methods like f(x::Ref{<:Real}) that use gensymmed typevars will not have the *exact*
# signature of the active method. So let's get the active signature.
frame.pc = pc
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(frame)
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(recurse, frame)
meth = whichtt(sigt)
isa(meth, Method) && push!(signatures, meth.sig) # inner methods are not visible
name === name3 && return pc, pc3 # if this was an inner method we should keep going
Expand Down
6 changes: 3 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ Advance the program counter without executing the corresponding line.
If `frame` is finished, `nextpc` will be `nothing`.
"""
next_or_nothing(frame, pc) = pc < nstatements(frame.framecode) ? pc+1 : nothing
function next_or_nothing!(frame)
next_or_nothing!(frame) = next_or_nothing(finish_and_return!, frame)
function next_or_nothing!(@nospecialize(recurse), frame)
pc = frame.pc
if pc < nstatements(frame.framecode)
frame.pc = pc = pc + 1
return pc
return frame.pc = pc + 1
end
return nothing
end
Expand Down
Loading