@@ -205,7 +205,7 @@ function wrap_array_vars(sys::AbstractSystem, exprs; dvs = unknowns(sys))
205205 isscalar = ! (exprs isa AbstractArray)
206206 array_vars = Dict {Any, AbstractArray{Int}} ()
207207 for (j, x) in enumerate (dvs)
208- if istree (x) && operation (x) == getindex
208+ if iscall (x) && operation (x) == getindex
209209 arg = arguments (x)[1 ]
210210 inds = get! (() -> Int[], array_vars, arg)
211211 push! (inds, j)
@@ -352,7 +352,7 @@ function SymbolicIndexingInterface.is_variable(sys::AbstractSystem, sym)
352352 end
353353 if has_index_cache (sys) && (ic = get_index_cache (sys)) != = nothing
354354 return is_variable (ic, sym) ||
355- istree (sym) && operation (sym) === getindex &&
355+ iscall (sym) && operation (sym) === getindex &&
356356 is_variable (ic, first (arguments (sym)))
357357 end
358358 return any (isequal (sym), variable_symbols (sys)) ||
@@ -378,7 +378,7 @@ function SymbolicIndexingInterface.variable_index(sys::AbstractSystem, sym)
378378 if has_index_cache (sys) && (ic = get_index_cache (sys)) != = nothing
379379 return if (idx = variable_index (ic, sym)) != = nothing
380380 idx
381- elseif istree (sym) && operation (sym) === getindex &&
381+ elseif iscall (sym) && operation (sym) === getindex &&
382382 (idx = variable_index (ic, first (arguments (sym)))) != = nothing
383383 idx[arguments (sym)[(begin + 1 ): end ]. .. ]
384384 else
@@ -416,7 +416,7 @@ function SymbolicIndexingInterface.is_parameter(sys::AbstractSystem, sym)
416416 sym = unwrap (sym)
417417 if has_index_cache (sys) && (ic = get_index_cache (sys)) != = nothing
418418 return is_parameter (ic, sym) ||
419- istree (sym) && operation (sym) === getindex &&
419+ iscall (sym) && operation (sym) === getindex &&
420420 is_parameter (ic, first (arguments (sym)))
421421 end
422422 if unwrap (sym) isa Int
@@ -441,7 +441,7 @@ function SymbolicIndexingInterface.parameter_index(sys::AbstractSystem, sym)
441441 if has_index_cache (sys) && (ic = get_index_cache (sys)) != = nothing
442442 return if (idx = parameter_index (ic, sym)) != = nothing
443443 idx
444- elseif istree (sym) && operation (sym) === getindex &&
444+ elseif iscall (sym) && operation (sym) === getindex &&
445445 (idx = parameter_index (ic, first (arguments (sym)))) != = nothing
446446 ParameterIndex (idx. portion, (idx. idx... , arguments (sym)[(begin + 1 ): end ]. .. ))
447447 else
@@ -745,22 +745,22 @@ function _apply_to_variables(f::F, ex) where {F}
745745 if isvariable (ex)
746746 return f (ex)
747747 end
748- istree (ex) || return ex
749- similarterm (ex , _apply_to_variables (f, operation (ex)),
748+ iscall (ex) || return ex
749+ maketerm ( typeof (ex) , _apply_to_variables (f, operation (ex)),
750750 map (Base. Fix1 (_apply_to_variables, f), arguments (ex)),
751- metadata = metadata (ex))
751+ symtype (ex), metadata (ex))
752752end
753753
754754abstract type SymScope end
755755
756756struct LocalScope <: SymScope end
757757function LocalScope (sym:: Union{Num, Symbolic, Symbolics.Arr{Num}} )
758758 apply_to_variables (sym) do sym
759- if istree (sym) && operation (sym) === getindex
759+ if iscall (sym) && operation (sym) === getindex
760760 args = arguments (sym)
761761 a1 = setmetadata (args[1 ], SymScope, LocalScope ())
762- similarterm ( sym, operation (sym), [a1, args[2 : end ]. .. ];
763- metadata = metadata (sym))
762+ maketerm ( typeof ( sym) , operation (sym), [a1, args[2 : end ]. .. ];
763+ symtype (sym), metadata (sym))
764764 else
765765 setmetadata (sym, SymScope, LocalScope ())
766766 end
@@ -772,12 +772,12 @@ struct ParentScope <: SymScope
772772end
773773function ParentScope (sym:: Union{Num, Symbolic, Symbolics.Arr{Num}} )
774774 apply_to_variables (sym) do sym
775- if istree (sym) && operation (sym) === getindex
775+ if iscall (sym) && operation (sym) === getindex
776776 args = arguments (sym)
777777 a1 = setmetadata (args[1 ], SymScope,
778778 ParentScope (getmetadata (value (args[1 ]), SymScope, LocalScope ())))
779- similarterm ( sym, operation (sym), [a1, args[2 : end ]. .. ];
780- metadata = metadata (sym))
779+ maketerm ( typeof ( sym) , operation (sym), [a1, args[2 : end ]. .. ];
780+ symtype (sym), metadata (sym))
781781 else
782782 setmetadata (sym, SymScope,
783783 ParentScope (getmetadata (value (sym), SymScope, LocalScope ())))
@@ -791,12 +791,12 @@ struct DelayParentScope <: SymScope
791791end
792792function DelayParentScope (sym:: Union{Num, Symbolic, Symbolics.Arr{Num}} , N)
793793 apply_to_variables (sym) do sym
794- if istree (sym) && operation (sym) == getindex
794+ if iscall (sym) && operation (sym) == getindex
795795 args = arguments (sym)
796796 a1 = setmetadata (args[1 ], SymScope,
797797 DelayParentScope (getmetadata (value (args[1 ]), SymScope, LocalScope ()), N))
798- similarterm ( sym, operation (sym), [a1, args[2 : end ]. .. ];
799- metadata = metadata (sym))
798+ maketerm ( typeof ( sym) , operation (sym), [a1, args[2 : end ]. .. ];
799+ symtype (sym), metadata (sym))
800800 else
801801 setmetadata (sym, SymScope,
802802 DelayParentScope (getmetadata (value (sym), SymScope, LocalScope ()), N))
@@ -808,11 +808,11 @@ DelayParentScope(sym::Union{Num, Symbolic, Symbolics.Arr{Num}}) = DelayParentSco
808808struct GlobalScope <: SymScope end
809809function GlobalScope (sym:: Union{Num, Symbolic, Symbolics.Arr{Num}} )
810810 apply_to_variables (sym) do sym
811- if istree (sym) && operation (sym) == getindex
811+ if iscall (sym) && operation (sym) == getindex
812812 args = arguments (sym)
813813 a1 = setmetadata (args[1 ], SymScope, GlobalScope ())
814- similarterm ( sym, operation (sym), [a1, args[2 : end ]. .. ];
815- metadata = metadata (sym))
814+ maketerm ( typeof ( sym) , operation (sym), [a1, args[2 : end ]. .. ];
815+ symtype (sym), metadata (sym))
816816 else
817817 setmetadata (sym, SymScope, GlobalScope ())
818818 end
@@ -827,16 +827,16 @@ function renamespace(sys, x)
827827 x = unwrap (x)
828828 if x isa Symbolic
829829 T = typeof (x)
830- if istree (x) && operation (x) isa Operator
831- return similarterm (x , operation (x),
830+ if iscall (x) && operation (x) isa Operator
831+ return maketerm ( typeof (x) , operation (x),
832832 Any[renamespace (sys, only (arguments (x)))];
833- metadata = metadata (x)):: T
833+ symtype (x), metadata (x)):: T
834834 end
835- if istree (x) && operation (x) === getindex
835+ if iscall (x) && operation (x) === getindex
836836 args = arguments (x)
837- return similarterm (
838- x , operation (x), vcat (renamespace (sys, args[1 ]), args[2 : end ]);
839- metadata = metadata (x)):: T
837+ return maketerm (
838+ typeof (x) , operation (x), vcat (renamespace (sys, args[1 ]), args[2 : end ]);
839+ symtype (x), metadata (x)):: T
840840 end
841841 let scope = getmetadata (x, SymScope, LocalScope ())
842842 if scope isa LocalScope
@@ -904,7 +904,7 @@ function namespace_expr(
904904 O = unwrap (O)
905905 if any (isequal (O), ivs)
906906 return O
907- elseif istree (O)
907+ elseif iscall (O)
908908 T = typeof (O)
909909 renamed = let sys = sys, n = n, T = T
910910 map (a -> namespace_expr (a, sys, n; ivs):: Any , arguments (O))
@@ -913,13 +913,14 @@ function namespace_expr(
913913 # Use renamespace so the scope is correct, and make sure to use the
914914 # metadata from the rescoped variable
915915 rescoped = renamespace (n, O)
916- similarterm (O, operation (rescoped), renamed,
916+ maketerm (typeof (rescoped), operation (rescoped), renamed,
917+ symtype (rescoped)
917918 metadata = metadata (rescoped))
918919 elseif Symbolics. isarraysymbolic (O)
919920 # promote_symtype doesn't work for array symbolics
920- similarterm (O , operation (O), renamed, symtype (O), metadata = metadata (O))
921+ maketerm ( typeof (O) , operation (O), renamed, symtype (O), metadata (O))
921922 else
922- similarterm (O , operation (O), renamed, metadata = metadata (O))
923+ maketerm ( typeof (O) , operation (O), renamed, symtype (O), metadata (O))
923924 end
924925 elseif isvariable (O)
925926 renamespace (n, O)
@@ -1097,7 +1098,7 @@ function time_varying_as_func(x, sys::AbstractTimeDependentSystem)
10971098 # than pass in a value in place of x(t).
10981099 #
10991100 # This is done by just making `x` the argument of the function.
1100- if istree (x) &&
1101+ if iscall (x) &&
11011102 issym (operation (x)) &&
11021103 ! (length (arguments (x)) == 1 && isequal (arguments (x)[1 ], get_iv (sys)))
11031104 return operation (x)
@@ -1125,7 +1126,7 @@ function push_vars!(stmt, name, typ, vars)
11251126 isempty (vars) && return
11261127 vars_expr = Expr (:macrocall , typ, nothing )
11271128 for s in vars
1128- if istree (s)
1129+ if iscall (s)
11291130 f = nameof (operation (s))
11301131 args = arguments (s)
11311132 ex = :($ f ($ (args... )))
@@ -1142,7 +1143,7 @@ function round_trip_expr(t, var2name)
11421143 name = get (var2name, t, nothing )
11431144 name != = nothing && return name
11441145 issym (t) && return nameof (t)
1145- istree (t) || return t
1146+ iscall (t) || return t
11461147 f = round_trip_expr (operation (t), var2name)
11471148 args = map (Base. Fix2 (round_trip_expr, var2name), arguments (t))
11481149 return :($ f ($ (args... )))
0 commit comments