Skip to content

Commit 32c5757

Browse files
committed
fix renamespace
1 parent 6ce3f55 commit 32c5757

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/systems/abstractsystem.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,16 @@ function Base.getproperty(sys::AbstractSystem, name::Symbol)
159159
throw(error("Variable $name does not exist"))
160160
end
161161

162-
renamespace(namespace,name) = Symbol(namespace,:₊,name)
163-
164-
function renamespace(namespace, x::Sym)
165-
Sym{symtype(x)}(renamespace(namespace,x.name))
166-
end
167-
168-
function renamespace(namespace, x::Term)
169-
renamespace(namespace, operation(x))(arguments(x)...)
162+
function renamespace(namespace, x)
163+
if x isa Num
164+
renamespace(namespace, value(x))
165+
elseif istree(x)
166+
renamespace(namespace, operation(x))(arguments(x)...)
167+
elseif x isa Sym
168+
Sym{symtype(x)}(renamespace(namespace,nameof(x)))
169+
else
170+
Symbol(namespace,:₊,x)
171+
end
170172
end
171173

172174
function namespace_variables(sys::AbstractSystem)

0 commit comments

Comments
 (0)