@@ -231,7 +231,7 @@ function prepare_call(@nospecialize(f), allargs; enter_generated = false)
231
231
return framecode, args, lenv, argtypes
232
232
end
233
233
234
- function prepare_framedata (framecode, argvals:: Vector{Any} )
234
+ function prepare_framedata (framecode, argvals:: Vector{Any} , caller_will_catch_err :: Bool = false )
235
235
if isa (framecode. scope, Method)
236
236
meth, src = framecode. scope:: Method , framecode. src
237
237
ssavt = src. ssavaluetypes
@@ -283,7 +283,7 @@ function prepare_framedata(framecode, argvals::Vector{Any})
283
283
callargs = Any[]
284
284
last_exception = Ref {Any} (nothing )
285
285
end
286
- FrameData (locals, ssavalues, sparams, exception_frames, last_exception, last_reference, callargs)
286
+ FrameData (locals, ssavalues, sparams, exception_frames, last_exception, caller_will_catch_err, last_reference, callargs)
287
287
end
288
288
289
289
"""
292
292
Construct a new `Frame` for `framecode`, given lowered-code arguments `frameargs` and
293
293
static parameters `lenv`. See [`JuliaInterpreter.prepare_call`](@ref) for information about how to prepare the inputs.
294
294
"""
295
- function prepare_frame (framecode:: FrameCode , args:: Vector{Any} , lenv:: SimpleVector )
296
- framedata = prepare_framedata (framecode, args)
295
+ function prepare_frame (framecode:: FrameCode , args:: Vector{Any} , lenv:: SimpleVector , caller_will_catch_err :: Bool = false )
296
+ framedata = prepare_framedata (framecode, args, caller_will_catch_err )
297
297
resize! (framedata. sparams, length (lenv))
298
298
# Add static parameters to environment
299
299
for i = 1 : length (lenv)
@@ -305,7 +305,8 @@ function prepare_frame(framecode::FrameCode, args::Vector{Any}, lenv::SimpleVect
305
305
end
306
306
307
307
function prepare_frame_caller (caller:: Frame , framecode:: FrameCode , args:: Vector{Any} , lenv:: SimpleVector )
308
- caller. callee = frame = prepare_frame (framecode, args, lenv)
308
+ caller_will_catch_err = ! isempty (caller. framedata. exception_frames) || caller. framedata. caller_will_catch_err
309
+ caller. callee = frame = prepare_frame (framecode, args, lenv, caller_will_catch_err)
309
310
frame. caller = caller
310
311
return frame
311
312
end
0 commit comments