Skip to content

Commit f5611aa

Browse files
fix: fix stack overflow in function_to_expr
1 parent 194aa85 commit f5611aa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/code.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,14 @@ function function_to_expr(op::typeof(^), O, st)
144144
args[1] = Term(inv, Any[args[1]])
145145
args[2] = -args[2]
146146
end
147+
if isequal(args[2], 1)
148+
return toexpr(args[1], st)
149+
end
147150
if get(st.rewrites, :nanmath, false) === true && !(args[2] isa Integer)
148151
op = NaNMath.pow
152+
return toexpr(Term(op, args), st)
149153
end
150-
return toexpr(Term(op, args), st)
154+
return nothing
151155
end
152156

153157
function function_to_expr(::typeof(SymbolicUtils.ifelse), O, st)

0 commit comments

Comments
 (0)