Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: pkg/analyzer/lib/src/dart/analysis/search.dart

Issue 2557543002: Implement search for direct subtypes and enable `search.getTypeHierarchy` request. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/dart/analysis/search.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 21b662d217bedd80717137b556e08daf82f11869..907ad15af4a8a73d30f532529998476e4f727659 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -74,6 +74,22 @@ class Search {
return const <SearchResult>[];
}
+ /**
+ * Returns subtypes of the given [type].
+ */
+ Future<List<SearchResult>> subTypes(ClassElement type) async {
+ if (type == null) {
+ return const <SearchResult>[];
+ }
+ List<SearchResult> results = <SearchResult>[];
+ await _addResults(results, type, {
+ IndexRelationKind.IS_EXTENDED_BY: SearchResultKind.REFERENCE,
+ IndexRelationKind.IS_MIXED_IN_BY: SearchResultKind.REFERENCE,
+ IndexRelationKind.IS_IMPLEMENTED_BY: SearchResultKind.REFERENCE
+ });
+ return results;
+ }
+
Future<Null> _addResults(List<SearchResult> results, Element element,
Map<IndexRelationKind, SearchResultKind> relationToResultKind) async {
String path = element.source.fullName;

Powered by Google App Engine
This is Rietveld 408576698