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

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

Issue 2535173004: Implement search for PrefixElement. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/search_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 55d28d61cb6d8caa7fe709d7b7727e228aa1f38f..6cbc37a8cd0182a215c5fb350bb6b49f5023f2b9 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -60,6 +60,8 @@ class Search {
return _searchReferences_Local(element, (n) => n is Block);
} else if (kind == ElementKind.PARAMETER) {
return _searchReferences_Parameter(element);
+ } else if (kind == ElementKind.PREFIX) {
+ return _searchReferences_Prefix(element);
} else if (kind == ElementKind.TYPE_PARAMETER) {
return _searchReferences_Local(
element, (n) => n.parent is CompilationUnit);
@@ -196,6 +198,21 @@ class Search {
}));
return results;
}
+
+ Future<List<SearchResult>> _searchReferences_Prefix(
+ PrefixElement element) async {
+ List<SearchResult> results = <SearchResult>[];
+ LibraryElement libraryElement = element.library;
+ for (CompilationUnitElement unitElement in libraryElement.units) {
+ String unitPath = unitElement.source.fullName;
+ AnalysisResult unitAnalysisResult = await _driver.getResult(unitPath);
+ _LocalReferencesVisitor visitor =
+ new _LocalReferencesVisitor(element, unitElement);
+ unitAnalysisResult.unit.accept(visitor);
+ results.addAll(visitor.results);
+ }
+ return results;
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/search_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698