Skip to content

Commit

Permalink
Merge pull request #66 from JuliaDebug/sp/better-gcability
Browse files Browse the repository at this point in the history
Nix bindings in anon module
  • Loading branch information
pfitzseb authored Feb 21, 2022
2 parents 6e91ec5 + 424063f commit e392a98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Infiltrator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,20 @@ function interpret(io, expr, mod, locals)
out = Core.eval(newmod, :(ans = $(expr)))

# exfiltrate all new assignments into the safehouse
@debug "exfiltration start"
for n in names(newmod, all = true)
if !(n in ns || haskey(modns, n))
@debug "exfiltrating $n"
Core.eval(getfield(safehouse, :store), Expr(:(=), n, getfield(newmod, n)))
else
# need to take care not to nix references to the module itself
if !(string(n) in ("@__MODULE__", "#@__MODULE__", "anonymous",))
@debug "nixing $n"
Core.eval(newmod, Expr(:(=), n, nothing))
end
end
end
@debug "exfiltration end"

return out
end
Expand Down

0 comments on commit e392a98

Please sign in to comment.