@@ -8,8 +8,8 @@ export toexpr, Assignment, (←), Let, Func, DestructuredArgs, LiteralExpr,
8
8
9
9
import .. SymbolicUtils
10
10
import .. SymbolicUtils. Rewriters
11
- import SymbolicUtils: @matchable , BasicSymbolic , Sym, Term, iscall, operation, arguments, issym,
12
- symtype, sorted_arguments, metadata, isterm, term, maketerm
11
+ import SymbolicUtils: @matchable , BasicSymbolicType , Sym, Term, iscall, operation, arguments, issym,
12
+ isconst, symtype, sorted_arguments, metadata, isterm, term, maketerm
13
13
import SymbolicIndexingInterface: symbolic_type, NotSymbolic
14
14
15
15
# #== state management ==##
@@ -156,7 +156,7 @@ function function_to_expr(::typeof(SymbolicUtils.ifelse), O, st)
156
156
:($ (toexpr (args[1 ], st)) ? $ (toexpr (args[2 ], st)) : $ (toexpr (args[3 ], st)))
157
157
end
158
158
159
- function function_to_expr (x:: BasicSymbolic , O, st)
159
+ function function_to_expr (x:: BasicSymbolicType , O, st)
160
160
issym (x) ? get (st. rewrites, O, nothing ) : nothing
161
161
end
162
162
@@ -182,6 +182,8 @@ function toexpr(O, st)
182
182
if issym (O)
183
183
O = substitute_name (O, st)
184
184
return issym (O) ? nameof (O) : toexpr (O, st)
185
+ elseif isconst (O)
186
+ return toexpr (O. val, st)
185
187
end
186
188
O = substitute_name (O, st)
187
189
766
768
function cse_block (state, t, name= Symbol (" var-" , hash (t)))
767
769
assignments = Assignment[]
768
770
counter = Ref {Int} (1 )
769
- names = Dict {Any, BasicSymbolic } ()
771
+ names = Dict {Any, BasicSymbolicType } ()
770
772
Let (assignments, cse_block! (assignments, counter, names, name, state, t))
771
773
end
772
774
0 commit comments