Skip to content

Commit

Permalink
Merge pull request #14 from rdeits/rd/eval-in-jsexpr
Browse files Browse the repository at this point in the history
expand macros in JSExpr instead of current_module()
  • Loading branch information
Shashi Gowda authored Jul 31, 2018
2 parents 1494934 + d04d5af commit 015f45b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/JSExpr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function jsexpr(x::Expr)
a_[] => obs_get_expr(a)
a_[i__] => ref_expr(a, i...)
[xs__] => vect_expr(xs)
(@m_ xs__) => jsexpr(macroexpand(current_module(), x))
(@m_ xs__) => jsexpr(macroexpand(JSExpr, x))
(for i_ = start_ : to_
body__
end) => for_expr(i, start, to, body)
Expand Down
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,17 @@ end
@test @js($ob[] = 1) == js"WebIO.setval({\"name\":\"test\",\"scope\":\"testwidget2\",\"id\":\"ob_02\",\"type\":\"observable\"},1)"
end
end

# https://github.com/JuliaGizmos/JSExpr.jl/issues/13
module OuterWrapper
module InnerWrapper
import JSExpr: jsexpr
f() = jsexpr(:(@new(1)))
end

using Base.Test
@testset "Issue 13" begin
InnerWrapper.f()
end
end

0 comments on commit 015f45b

Please sign in to comment.