@@ -10,7 +10,6 @@ import 'dart:collection';
1010import 'package:analyzer/dart/element/element.dart' ;
1111import 'package:analyzer/dart/element/nullability_suffix.dart' ;
1212import 'package:analyzer/dart/element/type.dart' ;
13- import 'package:analyzer/src/dart/element/element.dart' show ClassElementImpl;
1413import 'package:dartdoc/src/model/model.dart' ;
1514import 'package:dartdoc/src/render/element_type_renderer.dart' ;
1615
@@ -335,24 +334,15 @@ abstract class DefinedElementType extends ElementType {
335334 /// interfaces) is equivalent to or a subtype of [this] when
336335 /// instantiated to bounds.
337336 @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+ }
356346 }
357347 return false ;
358348 }
0 commit comments