@@ -8,8 +8,8 @@ export toexpr, Assignment, (←), Let, Func, DestructuredArgs, LiteralExpr,
88
99import .. SymbolicUtils
1010import .. 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
1313import SymbolicIndexingInterface: symbolic_type, NotSymbolic
1414
1515# #== state management ==##
@@ -156,7 +156,7 @@ function function_to_expr(::typeof(SymbolicUtils.ifelse), O, st)
156156 :($ (toexpr (args[1 ], st)) ? $ (toexpr (args[2 ], st)) : $ (toexpr (args[3 ], st)))
157157end
158158
159- function function_to_expr (x:: BasicSymbolic , O, st)
159+ function function_to_expr (x:: BasicSymbolicType , O, st)
160160 issym (x) ? get (st. rewrites, O, nothing ) : nothing
161161end
162162
@@ -182,6 +182,8 @@ function toexpr(O, st)
182182 if issym (O)
183183 O = substitute_name (O, st)
184184 return issym (O) ? nameof (O) : toexpr (O, st)
185+ elseif isconst (O)
186+ return toexpr (O. val, st)
185187 end
186188 O = substitute_name (O, st)
187189
766768function cse_block (state, t, name= Symbol (" var-" , hash (t)))
767769 assignments = Assignment[]
768770 counter = Ref {Int} (1 )
769- names = Dict {Any, BasicSymbolic } ()
771+ names = Dict {Any, BasicSymbolicType } ()
770772 Let (assignments, cse_block! (assignments, counter, names, name, state, t))
771773end
772774
0 commit comments