@@ -208,13 +208,7 @@ function evaluate_call!(@nospecialize(recurse::Function), frame::Frame, call_exp
208
208
end
209
209
newframe = prepare_frame (frame, framecode, fargs, lenv)
210
210
shouldbreak (newframe) && return BreakpointRef (newframe. framecode, newframe. pc)
211
- ret = try
212
- recurse (recurse, newframe)
213
- catch e
214
- frame. callee == nothing
215
- recycle (newframe)
216
- rethrow (e)
217
- end
211
+ ret = recurse (recurse, newframe) # if this errors, handle_err will pop the stack and recycle newframe
218
212
isa (ret, BreakpointRef) && return ret
219
213
frame. callee = nothing
220
214
recycle (newframe)
358
352
359
353
function step_expr! (@nospecialize (recurse), frame, @nospecialize (node), istoplevel:: Bool )
360
354
pc, code, data = frame. pc, frame. framecode, frame. framedata
355
+ if ! is_leaf (frame)
356
+ show_stackloc (frame)
357
+ @show node
358
+ end
361
359
@assert is_leaf (frame)
362
360
local rhs
363
361
# show_stackloc(frame)
@@ -525,19 +523,24 @@ function handle_err(@nospecialize(recurse), frame, err)
525
523
return BreakpointRef (frame. framecode, frame. pc, err)
526
524
end
527
525
end
528
- # Check for world age errors, which generally indicate a failure to go back to toplevel
529
- if isa (err, MethodError)
530
- is_arg_types = isa (err. args, DataType)
531
- arg_types = is_arg_types ? err. args : Base. typesof (err. args... )
532
- if (err. world != typemax (UInt) &&
533
- hasmethod (err. f, arg_types) &&
534
- ! hasmethod (err. f, arg_types, world = err. world))
535
- @warn " likely failure to return to toplevel, try JuliaInterpreter.split_expressions"
536
- rethrow (err)
526
+ data = frame. framedata
527
+ if isempty (data. exception_frames)
528
+ if frame. caller != = nothing
529
+ frame. caller. callee = nothing
530
+ recycle (frame)
537
531
end
532
+ # Check for world age errors, which generally indicate a failure to go back to toplevel
533
+ if isa (err, MethodError)
534
+ is_arg_types = isa (err. args, DataType)
535
+ arg_types = is_arg_types ? err. args : Base. typesof (err. args... )
536
+ if (err. world != typemax (UInt) &&
537
+ hasmethod (err. f, arg_types) &&
538
+ ! hasmethod (err. f, arg_types, world = err. world))
539
+ @warn " likely failure to return to toplevel, try JuliaInterpreter.split_expressions"
540
+ end
541
+ end
542
+ rethrow (err)
538
543
end
539
- data = frame. framedata
540
- isempty (data. exception_frames) && rethrow (err)
541
544
data. last_exception[] = err
542
545
return (frame. pc = data. exception_frames[end ])
543
546
end
0 commit comments