diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md index 8879a0e1485a..3c8f5a7bae56 100644 --- a/pkg/analyzer/CHANGELOG.md +++ b/pkg/analyzer/CHANGELOG.md @@ -3,6 +3,7 @@ * Added `DynamicType`, `NeverType`, and `VoidType` interfaces. * Added `TypeVisitor` and `DartType.accept(TypeVisitor)`. * Changed `ConstructorElement.returnType` to `InterfaceType`. +* Added `InterfaceType.allSupertypes`. * Added `InterfaceType.asInstanceOf(ClassElement)`. * Removed deprecated internal `bogus-disabled` and `bogus-enabled`. diff --git a/pkg/analyzer/lib/dart/element/type.dart b/pkg/analyzer/lib/dart/element/type.dart index f0cabe3fcee2..4e5d82192457 100644 --- a/pkg/analyzer/lib/dart/element/type.dart +++ b/pkg/analyzer/lib/dart/element/type.dart @@ -261,6 +261,10 @@ abstract class InterfaceType implements ParameterizedType { /// declared in this type. List get accessors; + /// Return all the super-interfaces implemented by this interface. This + /// includes superclasses, mixins, interfaces, and superclass constraints. + List get allSupertypes; + /// Return a list containing all of the constructors declared in this type. List get constructors; diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart index d5e26cc83e07..08c095ed6506 100644 --- a/pkg/analyzer/lib/src/dart/element/type.dart +++ b/pkg/analyzer/lib/src/dart/element/type.dart @@ -716,6 +716,12 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType { return _accessors; } + @override + List get allSupertypes { + var substitution = Substitution.fromInterfaceType(this); + return element.allSupertypes.map(substitution.substituteType).toList(); + } + @override List get constructors { if (_constructors == null) {