Skip to content

Commit c367b48

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Add InterfaceType.allSupertypes.
[email protected] Change-Id: I9c5058091b1a4473a2535ba792aa6bbfac35793c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153945 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent b09dd47 commit c367b48

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

pkg/analyzer/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Added `DynamicType`, `NeverType`, and `VoidType` interfaces.
44
* Added `TypeVisitor` and `DartType.accept(TypeVisitor)`.
55
* Changed `ConstructorElement.returnType` to `InterfaceType`.
6+
* Added `InterfaceType.allSupertypes`.
67
* Added `InterfaceType.asInstanceOf(ClassElement)`.
78
* Removed deprecated internal `bogus-disabled` and `bogus-enabled`.
89

pkg/analyzer/lib/dart/element/type.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ abstract class InterfaceType implements ParameterizedType {
261261
/// declared in this type.
262262
List<PropertyAccessorElement> get accessors;
263263

264+
/// Return all the super-interfaces implemented by this interface. This
265+
/// includes superclasses, mixins, interfaces, and superclass constraints.
266+
List<InterfaceType> get allSupertypes;
267+
264268
/// Return a list containing all of the constructors declared in this type.
265269
List<ConstructorElement> get constructors;
266270

pkg/analyzer/lib/src/dart/element/type.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,12 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
716716
return _accessors;
717717
}
718718

719+
@override
720+
List<InterfaceType> get allSupertypes {
721+
var substitution = Substitution.fromInterfaceType(this);
722+
return element.allSupertypes.map(substitution.substituteType).toList();
723+
}
724+
719725
@override
720726
List<ConstructorElement> get constructors {
721727
if (_constructors == null) {

0 commit comments

Comments
 (0)