Index: pkg/analysis_server/lib/src/services/search/search_engine_internal.dart |
diff --git a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart |
index 2cd5cc4708bf1ceb2ab571b4616368507310f04b..b551b48123e7d993ff0966d38af10892d910a65b 100644 |
--- a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart |
@@ -20,6 +20,37 @@ class SearchEngineImpl implements SearchEngine { |
SearchEngineImpl(this._drivers); |
@override |
+ Future<Set<String>> membersOfSubtypes(ClassElement type) async { |
+ List<AnalysisDriver> drivers = _drivers.toList(); |
+ |
+ bool hasSubtypes = false; |
+ Set<String> visitedIds = new Set<String>(); |
+ Set<String> members = new Set<String>(); |
+ |
+ Future<Null> addMembers(ClassElement type, SubtypeResult subtype) async { |
+ if (subtype != null && !visitedIds.add(subtype.id)) { |
+ return; |
+ } |
+ for (AnalysisDriver driver in drivers) { |
+ List<SubtypeResult> subtypes = |
+ await driver.search.subtypes(type: type, subtype: subtype); |
+ for (var subtype in subtypes) { |
+ hasSubtypes = true; |
+ members.addAll(subtype.members); |
+ await addMembers(null, subtype); |
+ } |
+ } |
+ } |
+ |
+ await addMembers(type, null); |
+ |
+ if (!hasSubtypes) { |
+ return null; |
+ } |
+ return members; |
+ } |
+ |
+ @override |
Future<Set<ClassElement>> searchAllSubtypes(ClassElement type) async { |
Set<ClassElement> allSubtypes = new Set<ClassElement>(); |