diff --git a/src/obj.rs b/src/obj.rs index 4bc669c..de3abe0 100644 --- a/src/obj.rs +++ b/src/obj.rs @@ -238,7 +238,9 @@ pub trait Obj: Debug + Display + Any + Trace { } } - fn type_inst(&self) -> ObjP; + fn type_inst(&self) -> ObjP { + self.get_attr("__type__").expect("no __type__") + } fn type_name(&self) -> Rc { with_obj_downcast(self.type_inst(), |type_inst: &TypeInst| { @@ -313,10 +315,6 @@ impl Obj for BaseObjInst { &mut self.attrs } - fn type_inst(&self) -> ObjP { - self.get_attr("__type__").expect("no __type__") - } - fn equals(&self, other: &dyn Obj) -> bool { if let Some(other) = other.as_any().downcast_ref::() { // compare all attrs diff --git a/src/obj/macros.rs b/src/obj/macros.rs index 1da5b90..837dd64 100644 --- a/src/obj/macros.rs +++ b/src/obj/macros.rs @@ -23,10 +23,6 @@ macro_rules! impl_base_obj { self.$base_name.attrs_mut() } - fn type_inst(&self) -> ObjP { - self.$base_name.type_inst() - } - fn as_any(&self) -> &dyn std::any::Any { self }