Skip to content

Commit 1261477

Browse files
improve expression generation
1 parent 6cb4f23 commit 1261477

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
function Base.convert(::Type{Expression}, ex::Expr)
1+
Base.convert(::Type{Expression}, ex::Expr) = Expression(ex)
2+
function Expression(ex;mod=Main)
23
ex.head === :if && (ex = Expr(:call, ifelse, ex.args...))
34
ex.head === :call || throw(ArgumentError("internal representation does not support non-call Expr"))
45

5-
op = eval(ex.args[1]) # HACK
6+
op = getproperty(mod,ex.args[1])
67
args = convert.(Expression, ex.args[2:end])
78

89
return Operation(op, args)

0 commit comments

Comments
 (0)