Skip to content

Commit

Permalink
refactor: implement new hasname function from SII
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Nov 30, 2023
1 parent 3afe412 commit aa50d32
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ getsource(x, val=_fail) = getmetadata(unwrap(x), VariableSource, val)
SymbolicIndexingInterface.symbolic_type(::Type{<:Symbolics.Num}) = ScalarSymbolic()
SymbolicIndexingInterface.symbolic_type(::Type{<:Symbolics.Arr}) = ArraySymbolic()

SymbolicIndexingInterface.hasname(x::Union{Num,Arr}) = hasname(unwrap(x))

function SymbolicIndexingInterface.hasname(x::Symbolic)
issym(x) || !istree(x) || istree(x) && (issym(operation(x)) || operation(x) == getindex)
end

SymbolicIndexingInterface.getname(x, val=_fail) = _getname(unwrap(x), val)

function getparent(x, val=_fail)
Expand Down

0 comments on commit aa50d32

Please sign in to comment.