Skip to content

Commit b727aff

Browse files
shashiYingboMa
andcommitted
Look up everything in symbolify
Co-authored-by: "Yingbo Ma" <[email protected]>
1 parent cc7e77b commit b727aff

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/code.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ function toexpr(O, st)
125125
if expr′ !== nothing
126126
return expr′
127127
else
128+
haskey(st.symbolify, O) && return st.symbolify[O]
128129
args = arguments(O)
129130
return Expr(:call, toexpr(op, st), map(x->toexpr(x, st), args)...)
130131
end

test/code.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,13 @@ test_repr(a, b) = @test repr(Base.remove_linenums!(a)) == repr(Base.remove_linen
132132
[(),
133133
(0.6,)],
134134
vcat)|>toexpr|>eval) < 1.1
135+
136+
let
137+
@syms a b
138+
139+
f = eval(toexpr(Func([a+b], [], a+b)))
140+
@test f(1) == 1
141+
@test f(2) == 2
142+
end
135143
end
136144

0 commit comments

Comments
 (0)