Skip to content
Merged
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
23 changes: 4 additions & 19 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1845,25 +1845,10 @@ function repl_eval_counter(hp)
end

function out_transform(@nospecialize(x), n::Ref{Int})
return Expr(:toplevel, get_usings!([], x)..., quote
let __temp_val_a72df459 = $x
$capture_result($n, __temp_val_a72df459)
__temp_val_a72df459
end
end)
end

function get_usings!(usings, ex)
ex isa Expr || return usings
# get all `using` and `import` statements which are at the top level
for (i, arg) in enumerate(ex.args)
if Base.isexpr(arg, :toplevel)
get_usings!(usings, arg)
elseif Base.isexpr(arg, [:using, :import])
push!(usings, popat!(ex.args, i))
end
end
return usings
return Expr(:block, # avoid line numbers or scope that would leak into the output and change the meaning of x
:(local __temp_val_a72df459 = $x),
Expr(:call, capture_result, n, :__temp_val_a72df459),
:__temp_val_a72df459)
end

function create_global_out!(mod)
Expand Down