/// Determine if this object has a given prototype in its prototype chain.
///
/// The given object should be the prototype we are checking against this
/// object. Its prototype will be searched in the
/// prototype chain of this object. If `check_interfaces` is enabled, then
/// the interfaces listed on each prototype will also be checked.
Determine if this object has a given prototype in its prototype chain.
The given object should be the prototype we are checking against this
object. Its prototype will be searched in the
prototype chain of this object. If `check_interfaces` is enabled, then
the interfaces listed on each prototype will also be checked.
Determine if this object has a given prototype in its prototype chain . The given object should be the prototype we are checking against this object . Its prototype will be searched in the prototype chain of this object . If ` check_interfaces ` is enabled then the interfaces listed on each prototype will also be checked .
fn has_prototype_in_chain(
        &self,
        type_proto: Object<'gc>,
        check_interfaces: bool,
    ) -> Result<bool, Error> {
        let mut my_proto = self.proto();
        //TODO: Is it a verification error to do `obj instanceof bare_object`?
        while let Some(proto) = my_proto {
            if Object::ptr_eq(proto, type_proto) {
                return Ok(true);
            }
            if check_interfaces {
                for interface in proto.interfaces() {
                    if Object::ptr_eq(interface, type_proto) {
                        return Ok(true);
                    }
                }
            }
            my_proto = proto.proto()
        }
        Ok(false)
    }
fn has_prototype_in_chain ( & self , type_proto : Object < ' gc > , check_interfaces : bool , ) -> Result < bool , Error > { let mut my_proto = self . proto ( ) ; //TODO: Is it a verification error to do `obj instanceof bare_object`? while let Some ( proto ) = my_proto { if Object :: ptr_eq ( proto , type_proto ) { return Ok ( true ) ; } if check_interfaces { for interface in proto . interfaces ( ) { if Object :: ptr_eq ( interface , type_proto ) { return Ok ( true ) ; } } } my_proto = proto . proto ( ) } Ok ( false ) }
Determine if this object has a given prototype in its prototype chain.
Determine if this object has a given prototype in its prototype chain .
&self
type_proto
Object<'gc>
check_interfaces
bool