Chromium Code Reviews| 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); |
| } |