isAssignableFrom static method
Returns whether a source class is assignable to target class.
tgt
- target classsrc
- source class
Implementation
static bool isAssignableFrom(ClassMirror tgt, ClassMirror src) {
if (tgt.qualifiedName == src.qualifiedName)
return true;
if (isTopClass(src)) //no more super class
return false;
//TypedefMirror does not implement superinterfaces/superclass
if (src is TypedefMirror)
return false;
//check superinterfaces and superclass
for (ClassMirror inf in src.superinterfaces)
if (isAssignableFrom(tgt, inf))
return true; //recursive
return isAssignableFrom(tgt, src.superclass!); //recursive
}