isSubclassOf method
Returns whether the class denoted by the receiver is a subclass of the class denoted by the argument.
Note that the subclass relationship is reflexive.
Required capabilities: isSubclassOf requires a
TypeRelationsCapability, and it requires that the chain of subclasses
from this to other is covered.
Implementation
@override
bool isSubclassOf(ClassMirror other) {
if (_superclassIndex == noCapabilityIndex) {
// There are two possible reasons for this: (1) If we have no type
// relations capability then the index will always be noCapabilityIndex.
// (2) Even if we have the type relations capability then the superclass
// may be un-covered. So we cannot tell the two apart based on index.
// Note that the check for superclass access also applies to the access
// to superinterfaces, that is, it is not necessary (nor useful) to check
// for access to superinterfaces here.
if (!_supportsTypeRelations(_reflector)) {
throw NoSuchCapabilityError(
'Attempt to evaluate `isSubclassOf` for `$qualifiedName` '
'without `typeRelationsCapability`',
);
}
throw NoSuchCapabilityError(
'Attempt to evaluate `isSubclassOf` for $qualifiedName '
'without capability.',
);
}
return _isSubclassOf(other);
}