Skip to content

Commit 7e781da

Browse files
committed
Thread expr_compat_mode param through eval
1 parent b07a711 commit 7e781da

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/desugaring.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4309,9 +4309,10 @@ function expand_module(ctx, ex::SyntaxTree)
43094309
[K"inert" ex]
43104310
]
43114311
[K"call"
4312-
eval_module ::K"Value"
4313-
ctx.mod ::K"Value"
4314-
modname ::K"String"
4312+
eval_module ::K"Value"
4313+
ctx.mod ::K"Value"
4314+
modname ::K"String"
4315+
ctx.expr_compat_mode ::K"Bool"
43154316
[K"inert"(body)
43164317
[K"toplevel"
43174318
std_defs
@@ -4505,9 +4506,10 @@ function expand_forms_2(ctx::DesugaringContext, ex::SyntaxTree, docs=nothing)
45054506
@ast ctx ex [K"block"
45064507
[K"assert" "toplevel_only"::K"Symbol" [K"inert" ex]]
45074508
[K"call"
4508-
eval ::K"Value"
4509-
ctx.mod ::K"Value"
4509+
eval ::K"Value"
4510+
ctx.mod ::K"Value"
45104511
[K"inert" ex]
4512+
ctx.expr_compat_mode ::K"Bool"
45114513
]
45124514
]
45134515
elseif k == K"vect"

src/eval.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,16 @@ end
344344

345345
#-------------------------------------------------------------------------------
346346
# Our version of eval takes our own data structures
347-
function Core.eval(mod::Module, ex::SyntaxTree)
347+
function Core.eval(mod::Module, ex::SyntaxTree, expr_compat_mode::Bool=false)
348348
k = kind(ex)
349349
if k == K"toplevel"
350350
x = nothing
351351
for e in children(ex)
352-
x = eval(mod, e)
352+
x = eval(mod, e, expr_compat_mode)
353353
end
354354
return x
355355
end
356-
linear_ir = lower(mod, ex)
356+
linear_ir = lower(mod, ex, expr_compat_mode)
357357
expr_form = to_lowered_expr(mod, linear_ir)
358358
eval(mod, expr_form)
359359
end

src/runtime.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ end
158158
# public modname
159159
#
160160
# And run statments in the toplevel expression `body`
161-
function eval_module(parentmod, modname, body)
161+
function eval_module(parentmod, modname, expr_compat_mode, body)
162162
# Here we just use `eval()` with an Expr.
163163
# If we wanted to avoid this we'd need to reproduce a lot of machinery from
164164
# jl_eval_module_expr()
@@ -175,7 +175,7 @@ function eval_module(parentmod, modname, body)
175175
name = Symbol(modname)
176176
eval(parentmod, :(
177177
baremodule $name
178-
$eval($name, $body)
178+
$eval($name, $body, $expr_compat_mode)
179179
end
180180
))
181181
end

0 commit comments

Comments
 (0)