Re-shuffle Obj::type_inst and BaseObjInst::type_inst
There was a moment during the refactor that I was thinking about getting rid of the `__type__` attribute as the source of truth for the type instance, but I think that was a bit more than I could chew. However I forgot to re-add the default implementation for Obj::type_inst, so that has been added back in. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -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<String> {
|
||||
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::<BaseObjInst>() {
|
||||
// compare all attrs
|
||||
|
||||
Reference in New Issue
Block a user