@@ -445,8 +445,8 @@ function repl_backend_loop(backend::REPLBackend, get_module::Function)
445
445
try
446
446
ret = f ()
447
447
put! (backend. response_channel, Pair {Any, Bool} (ret, false ))
448
- catch err
449
- put! (backend. response_channel, Pair {Any, Bool} (err , true ))
448
+ catch
449
+ put! (backend. response_channel, Pair {Any, Bool} (current_exceptions () , true ))
450
450
end
451
451
else
452
452
ast = ast_or_func
@@ -587,11 +587,11 @@ function print_response(errio::IO, response, backend::Union{REPLBackendRef,Nothi
587
587
if val != = nothing && show_value
588
588
val2, iserr = if specialdisplay === nothing
589
589
# display calls may require being run on the main thread
590
- eval_with_backend (backend) do
590
+ call_on_backend (backend) do
591
591
Base. invokelatest (display, val)
592
592
end
593
593
else
594
- eval_with_backend (backend) do
594
+ call_on_backend (backend) do
595
595
Base. invokelatest (display, specialdisplay, val)
596
596
end
597
597
end
@@ -708,7 +708,7 @@ function run_frontend(repl::BasicREPL, backend::REPLBackendRef)
708
708
(isa (ast,Expr) && ast. head === :incomplete ) || break
709
709
end
710
710
if ! isempty (line)
711
- response = eval_with_backend (ast, backend)
711
+ response = eval_on_backend (ast, backend)
712
712
print_response (repl, response, ! ends_with_semicolon (line), false )
713
713
end
714
714
write (repl. terminal, ' \n ' )
@@ -1153,21 +1153,23 @@ find_hist_file() = get(ENV, "JULIA_HISTORY",
1153
1153
backend (r:: AbstractREPL ) = hasproperty (r, :backendref ) ? r. backendref : nothing
1154
1154
1155
1155
1156
- function eval_with_backend (ast:: Expr , backend:: REPLBackendRef )
1156
+ function eval_on_backend (ast, backend:: REPLBackendRef )
1157
1157
put! (backend. repl_channel, (ast, 1 )) # (f, show_value)
1158
1158
return take! (backend. response_channel) # (val, iserr)
1159
1159
end
1160
- function eval_with_backend (f, backend:: REPLBackendRef )
1160
+ function call_on_backend (f, backend:: REPLBackendRef )
1161
+ applicable (f) || error (" internal error: f is not callable" )
1161
1162
put! (backend. repl_channel, (f, 2 )) # (f, show_value) 2 indicates function (rather than ast)
1162
1163
return take! (backend. response_channel) # (val, iserr)
1163
1164
end
1164
1165
# if no backend just eval (used by tests)
1165
- function eval_with_backend (f, backend:: Nothing )
1166
+ eval_on_backend (ast, backend:: Nothing ) = error (" no backend for eval ast" )
1167
+ function call_on_backend (f, backend:: Nothing )
1166
1168
try
1167
1169
ret = f ()
1168
1170
return (ret, false ) # (val, iserr)
1169
- catch err
1170
- return (err , true )
1171
+ catch
1172
+ return (current_exceptions () , true )
1171
1173
end
1172
1174
end
1173
1175
@@ -1183,7 +1185,7 @@ function respond(f, repl, main; pass_empty::Bool = false, suppress_on_semicolon:
1183
1185
local response
1184
1186
try
1185
1187
ast = Base. invokelatest (f, line)
1186
- response = eval_with_backend (ast, backend (repl))
1188
+ response = eval_on_backend (ast, backend (repl))
1187
1189
catch
1188
1190
response = Pair {Any, Bool} (current_exceptions (), true )
1189
1191
end
@@ -1823,7 +1825,7 @@ function run_frontend(repl::StreamREPL, backend::REPLBackendRef)
1823
1825
if have_color
1824
1826
print (repl. stream, Base. color_normal)
1825
1827
end
1826
- response = eval_with_backend (ast, backend)
1828
+ response = eval_on_backend (ast, backend)
1827
1829
print_response (repl, response, ! ends_with_semicolon (line), have_color)
1828
1830
end
1829
1831
end
0 commit comments