Skip to content

Commit 382a88f

Browse files
committed
Check function identity
1 parent 88e2e13 commit 382a88f

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/code.jl

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Code
22

3-
using StaticArrays, LabelledArrays, SparseArrays, LinearAlgebra, NaNMath
3+
using StaticArrays, LabelledArrays, SparseArrays, LinearAlgebra, NaNMath, SpecialFunctions
44

55
export toexpr, Assignment, (), Let, Func, DestructuredArgs, LiteralExpr,
66
SetArray, MakeArray, MakeSparseArray, MakeTuple, AtIndex,
@@ -97,22 +97,23 @@ Base.convert(::Type{Assignment}, p::Pair) = Assignment(pair[1], pair[2])
9797
toexpr(a::Assignment, st) = :($(toexpr(a.lhs, st)) = $(toexpr(a.rhs, st)))
9898

9999
const NaNMathFuns = (
100-
:sin,
101-
:cos,
102-
:tan,
103-
:asin,
104-
:acos,
105-
:acosh,
106-
:atanh,
107-
:log,
108-
:log2,
109-
:log10,
110-
:lgamma,
111-
:log1p,
112-
:sqrt,
100+
sin,
101+
cos,
102+
tan,
103+
asin,
104+
acos,
105+
acosh,
106+
atanh,
107+
log,
108+
log2,
109+
log10,
110+
lgamma,
111+
log1p,
112+
sqrt,
113113
)
114114
function function_to_expr(op, O, st)
115-
(op isa Function && (name = nameof(op)) in NaNMathFuns) || return nothing
115+
op in NaNMathFuns || return nothing
116+
name = nameof(op)
116117
fun = GlobalRef(NaNMath, name)
117118
args = map(Base.Fix2(toexpr, st), arguments(O))
118119
expr = Expr(:call, fun)

0 commit comments

Comments
 (0)