Skip to content

Commit 0dbab5b

Browse files
authored
Don't reevaluate at__MODULE__ (#133)
* Actually fix the issue * Bump version * Make definitions more robust * Actually just special-case __MODULE__ --------- Co-authored-by: Cédric Belmant <cedric.belmant@juliahub.com>
1 parent 0150c3a commit 0dbab5b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Infiltrator"
22
uuid = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
3-
version = "1.8.4"
3+
version = "1.8.5"
44

55
[deps]
66
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

src/Infiltrator.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,13 @@ function init_transient_eval_module(mod, locals)
525525
Expr(:call, Symbol("__MODULE__")),
526526
Expr(:block, mod))
527527
)
528+
haskey(modns, Symbol("@__MODULE__")) && delete!(modns, Symbol("@__MODULE__"))
528529
# insert local variables into current scope
529530
Core.eval(newmod, Expr(:block, map(x->Expr(:(=), x...), [(k, maybe_quote(v)) for (k, v) in locals])...))
530531
# insert variables in safehouse
531532
Core.eval(newmod, Expr(:block, map(x->Expr(:(=), x...), [(k, maybe_quote(v)) for (k, v) in get_store_names() if !isdefined(newmod, k)])...))
532533
# insert all bindings from the source module that aren't already defined in the eval module
533-
Core.eval(newmod, Expr(:block, map(x->Expr(:global, Expr(:(=), x...)), [(k, maybe_quote(v)) for (k, v) in modns if !isdefined(newmod, k)])...))
534+
Core.eval(newmod, Expr(:block, map(x->Expr(:(=), x...), [(k, maybe_quote(v)) for (k, v) in modns if !isdefined(newmod, k)])...))
534535

535536
return newmod
536537
end

0 commit comments

Comments
 (0)