diff --git a/mers_lib/Cargo.toml b/mers_lib/Cargo.toml index d291727..018c209 100755 --- a/mers_lib/Cargo.toml +++ b/mers_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mers_lib" -version = "0.6.0" +version = "0.6.1" edition = "2021" license = "MIT OR Apache-2.0" description = "library to use the mers language in other projects" diff --git a/mers_lib/src/data/mod.rs b/mers_lib/src/data/mod.rs index ca93af5..1b5ae1e 100755 --- a/mers_lib/src/data/mod.rs +++ b/mers_lib/src/data/mod.rs @@ -298,15 +298,18 @@ impl Type { pub fn add(&mut self, new: Arc) { let n = new.as_any(); if let Some(s) = n.downcast_ref::() { - for t in &s.types { - self.add(Arc::clone(t)); - } + self.add_all(s); } else { if !self.types.iter().any(|t| new.is_included_in(t.as_ref())) { self.types.push(new); } } } + pub fn add_all(&mut self, types: &Self) { + for t in &types.types { + self.add(Arc::clone(t)); + } + } pub fn dereference(&self) -> Option { let mut o = Self::empty(); for t in &self.types {