We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6cb4f23 + 257b287 commit 427d255Copy full SHA for 427d255
src/utils.jl
@@ -1,8 +1,9 @@
1
-function Base.convert(::Type{Expression}, ex::Expr)
+Base.convert(::Type{Expression}, ex::Expr) = Expression(ex)
2
+function Expression(ex;mod=Main)
3
ex.head === :if && (ex = Expr(:call, ifelse, ex.args...))
4
ex.head === :call || throw(ArgumentError("internal representation does not support non-call Expr"))
5
- op = eval(ex.args[1]) # HACK
6
+ op = getproperty(mod,Symbol(ex.args[1]))
7
args = convert.(Expression, ex.args[2:end])
8
9
return Operation(op, args)
0 commit comments