Compare commits

...

2 Commits

Author SHA1 Message Date
16139847f9 superclasses_iter 2024-09-21 14:13:19 -07:00
751d4f4fb9 superclasses 2024-09-21 14:11:06 -07:00

View File

@ -2,12 +2,14 @@ use rbx_dom_weak::{types::Ref,WeakDom};
pub fn class_is_a(class:&str,superclass:&str)->bool{
class==superclass
||rbx_reflection_database::get().classes.get(class)
.is_some_and(|descriptor|
descriptor.superclass.as_ref().is_some_and(|class_super|
class_is_a(class_super,superclass)
)
)
||{
let db=rbx_reflection_database::get();
match (db.classes.get(class),db.classes.get(superclass)){
(Some(class),Some(superclass))=>db.superclasses_iter(class)
.any(|cls|core::ptr::addr_eq(cls,superclass)),
_=>false
}
}
}
#[repr(transparent)]