Skip to content

Commit d774562

Browse files
committed
fix depwarns in utils
1 parent b844e62 commit d774562

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/interface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,7 @@ with `head` as the head and `args` as the arguments, `type` as the symtype
7878
and `metadata` as the metadata. By default this will execute `head(args...)`.
7979
`x` parameter can also be a `Type`. The `exprhead` keyword argument is useful
8080
when manipulating `Expr`s.
81+
82+
`similarterm` is deprecated see help for `maketerm` instead.
8183
"""
8284
function similarterm end

src/rule.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ function (acr::ACRule)(term)
408408
if result !== nothing
409409
# Assumption: inds are unique
410410
length(args) == length(inds) && return result
411-
return similarterm(term, f, [result, (args[i] for i in eachindex(args) if i inds)...], symtype(term))
411+
return maketerm(typeof(term), f, [result, (args[i] for i in eachindex(args) if i inds)...], symtype(term), metadata(term))
412412
end
413413
end
414414
end

src/utils.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function fold(t)
5353
# evaluate it
5454
return operation(t)(tt...)
5555
else
56-
return similarterm(t, operation(t), tt)
56+
return maketerm(typeof(t), operation(t), tt, symtype(t), metadata(t))
5757
end
5858
else
5959
return t
@@ -147,19 +147,19 @@ function flatten_term(⋆, x)
147147
push!(flattened_args, t)
148148
end
149149
end
150-
similarterm(x, , flattened_args)
150+
maketerm(typeof(x), , flattened_args, symtype(x), metadata(x))
151151
end
152152

153153
function sort_args(f, t)
154154
args = arguments(t)
155155
if length(args) < 2
156-
return similarterm(t, f, args)
156+
return maketerm(typeof(t), f, args, symtype(t), metadata(t))
157157
elseif length(args) == 2
158158
x, y = args
159-
return similarterm(t, f, x <ₑ y ? [x,y] : [y,x])
159+
return maketerm(typeof(t), f, x <ₑ y ? [x,y] : [y,x], symtype(t), metadata(t))
160160
end
161161
args = args isa Tuple ? [args...] : args
162-
similarterm(t, f, sort(args, lt=<ₑ))
162+
maketerm(typeof(t), f, sort(args, lt=<), symtype(t), metadata(t))
163163
end
164164

165165
# Linked List interface
@@ -225,7 +225,7 @@ macro matchable(expr)
225225
SymbolicUtils.arguments(x::$name) = getfield.((x,), ($(QuoteNode.(fields)...),))
226226
SymbolicUtils.children(x::$name) = [SymbolicUtils.operation(x); SymbolicUtils.children(x)]
227227
Base.length(x::$name) = $(length(fields) + 1)
228-
SymbolicUtils.similarterm(x::$name, f, args, type; kw...) = f(args...)
228+
SymbolicUtils.maketerm(x::$name, f, args, type, metadata) = f(args...)
229229
end |> esc
230230
end
231231

0 commit comments

Comments
 (0)