From 9b5fbf72be3f6c6878c98509e54d4364a2f55389 Mon Sep 17 00:00:00 2001 From: Spencer Lyon Date: Thu, 1 Mar 2018 15:19:39 -0500 Subject: [PATCH 1/3] ENH?: don't eval across modules in macroexpansion --- src/JSExpr.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JSExpr.jl b/src/JSExpr.jl index 2479a73..1df61c3 100644 --- a/src/JSExpr.jl +++ b/src/JSExpr.jl @@ -174,7 +174,7 @@ function jsexpr(x::Expr) a_[] => obs_get_expr(a) a_[i__] => ref_expr(a, i...) [xs__] => vect_expr(xs) - (@m_ xs__) => jsexpr(macroexpand(JSExpr, x)) + (@m_ xs__) => jsexpr(macroexpand(x)) (for i_ = start_ : to_ body__ end) => for_expr(i, start, to, body) From 828c9c6cd7aa38048608a5d70ac8276876e43d01 Mon Sep 17 00:00:00 2001 From: Spencer Lyon Date: Thu, 1 Mar 2018 15:20:59 -0500 Subject: [PATCH 2/3] ENH: export @var and @new so macroexpansion works in contexts where using JSExpr has run --- src/JSExpr.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JSExpr.jl b/src/JSExpr.jl index 1df61c3..0c84cb1 100644 --- a/src/JSExpr.jl +++ b/src/JSExpr.jl @@ -1,7 +1,7 @@ module JSExpr using JSON, MacroTools, WebIO -export JSString, @js, @js_str +export JSString, @js, @js_str, @var, @new import WebIO: JSString, JSONContext, JSEvalSerialization From c61c0ec23b5125212557c2b5889a421362d8fe9a Mon Sep 17 00:00:00 2001 From: Spencer Lyon Date: Thu, 1 Mar 2018 15:23:37 -0500 Subject: [PATCH 3/3] ENH: eval into current module --- src/JSExpr.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JSExpr.jl b/src/JSExpr.jl index 0c84cb1..3d4aa76 100644 --- a/src/JSExpr.jl +++ b/src/JSExpr.jl @@ -174,7 +174,7 @@ function jsexpr(x::Expr) a_[] => obs_get_expr(a) a_[i__] => ref_expr(a, i...) [xs__] => vect_expr(xs) - (@m_ xs__) => jsexpr(macroexpand(x)) + (@m_ xs__) => jsexpr(macroexpand(current_module(), x)) (for i_ = start_ : to_ body__ end) => for_expr(i, start, to, body)