hasOrInheritsDeprecated property

bool get hasOrInheritsDeprecated

Whether this element, the enclosing class (if there is one), or the enclosing library, has been annotated with the @Deprecated() annotation.

Implementation

bool get hasOrInheritsDeprecated {
  if (isDeprecatedWithKind('use')) {
    return true;
  }

  var ancestor = enclosingElement;
  if (ancestor is InterfaceElement) {
    if (ancestor.isDeprecatedWithKind('use')) {
      return true;
    }
    ancestor = ancestor.enclosingElement;
  }
  return ancestor is LibraryElement && ancestor.isDeprecatedWithKind('use');
}