@@ -10,7 +10,6 @@ import 'dart:collection';
10
10
import 'package:analyzer/dart/element/element.dart' ;
11
11
import 'package:analyzer/dart/element/nullability_suffix.dart' ;
12
12
import 'package:analyzer/dart/element/type.dart' ;
13
- import 'package:analyzer/src/dart/element/element.dart' show ClassElementImpl;
14
13
import 'package:dartdoc/src/model/model.dart' ;
15
14
import 'package:dartdoc/src/render/element_type_renderer.dart' ;
16
15
@@ -335,24 +334,15 @@ abstract class DefinedElementType extends ElementType {
335
334
/// interfaces) is equivalent to or a subtype of [this] when
336
335
/// instantiated to bounds.
337
336
@override
338
- bool isBoundSupertypeTo (ElementType t) =>
339
- _isBoundSupertypeTo (t.instantiatedType, HashSet ());
340
-
341
- bool _isBoundSupertypeTo (DartType superType, HashSet <DartType > visited) {
342
- // Only InterfaceTypes can have superTypes.
343
- if (superType is ! InterfaceType ) return false ;
344
- ClassElement superClass = superType? .element;
345
- if (visited.contains (superType)) return false ;
346
- visited.add (superType);
347
- if (superClass == type.element &&
348
- (superType == instantiatedType ||
349
- library.typeSystem.isSubtypeOf (superType, instantiatedType))) {
350
- return true ;
351
- }
352
- var supertypes = < InterfaceType > [];
353
- ClassElementImpl .collectAllSupertypes (supertypes, superType, null );
354
- for (var toVisit in supertypes) {
355
- if (_isBoundSupertypeTo (toVisit, visited)) return true ;
337
+ bool isBoundSupertypeTo (ElementType t) {
338
+ var type = t.instantiatedType;
339
+ if (type is InterfaceType ) {
340
+ var superTypes = type.allSupertypes;
341
+ for (var superType in superTypes) {
342
+ if (library.typeSystem.isSubtypeOf (superType, instantiatedType)) {
343
+ return true ;
344
+ }
345
+ }
356
346
}
357
347
return false ;
358
348
}
0 commit comments