@@ -224,18 +224,21 @@ function bypass_builtins(interp::Interpreter, frame::Frame, call_expr::Expr, pc:
224224end
225225
226226function native_call(fargs:: Vector{Any} , frame:: Frame )
227- f = popfirst!(fargs) # now it's really just `args`
228- if (@static isdefinedglobal(Core. IR, :EnterNode) && true )
229- newscope = Core. current_scope()
230- if newscope != = nothing || ! isempty(frame. framedata. current_scopes)
231- for scope in frame. framedata. current_scopes
232- newscope = Scope(newscope, scope. values... )
233- end
234- ex = Expr(:tryfinally, :($ f($ fargs... )), nothing , newscope)
235- return Core. eval(moduleof(frame), ex)
227+ f = popfirst!(fargs)
228+ @something maybe_eval_with_scope(f, fargs, frame) return @invokelatest f(fargs... )
229+ end
230+
231+ function maybe_eval_with_scope(@nospecialize(f), fargs:: Vector{Any} , frame:: Frame )
232+ @static isdefinedglobal(Core. IR, :EnterNode) || return nothing
233+ newscope = Core. current_scope()
234+ if newscope != = nothing || ! isempty(frame. framedata. current_scopes)
235+ for scope in frame. framedata. current_scopes
236+ newscope = Scope(newscope, scope. values... )
236237 end
238+ ex = Expr(:tryfinally, :($ f($ fargs... )), nothing , newscope)
239+ return Some{Any}(Core. eval(moduleof(frame), ex))
237240 end
238- return @invokelatest f(fargs ... )
241+ return nothing
239242end
240243
241244function evaluate_call!(interp:: Compiled , frame:: Frame , call_expr:: Expr , enter_generated:: Bool = false )
0 commit comments