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

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

Issue 2533853005: Don't search if the driver cannot reference the element. (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 | no next file » | 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 98087e0a854fec548608e20aef4c37c49a3f3d05..18114bd56a7df5b07597c5a1278161756c8ca5b2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -70,13 +70,19 @@ class Search {
Future<Null> _addResults(List<SearchResult> results, Element element,
IndexRelationKind relationKind, SearchResultKind resultKind) async {
+ String path = element.source.fullName;
+
+ // If the file with the element is not know, then the element is not used.
Paul Berry 2016/11/28 21:45:10 s/know/known/
+ if (!_driver.knownFiles.contains(path)) {
+ return;
+ }
+
// TODO(scheglov) optimize for private elements
String name = element.displayName;
// Prepare the list of files that reference the element name.
List<String> files = await _driver.getFilesReferencingName(name);
- String path = element.source.fullName;
- if (!files.contains(path)) {
+ if (!files.contains(path) && _driver.addedFiles.contains(path)) {
files.add(path);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698