isSuperOf method

bool isSuperOf(
  1. Element element
)

Returns true if representing a super class of element.

This check only takes into account the extends hierarchy. If you wish to check mixins and interfaces, use isAssignableFrom.

Implementation

bool isSuperOf(Element element) {
  if (element is InterfaceElement) {
    var theSuper = element.supertype;

    do {
      if (isExactlyType(theSuper!)) {
        return true;
      }

      theSuper = theSuper.superclass;
    } while (theSuper != null);
  }

  return false;
}