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

Unified Diff: pkg/analysis_services/lib/src/completion/top_level_computer.dart

Issue 445083003: exclude private declarations in imported classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 months 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/analysis_services/test/completion/top_level_computer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_services/lib/src/completion/top_level_computer.dart
diff --git a/pkg/analysis_services/lib/src/completion/top_level_computer.dart b/pkg/analysis_services/lib/src/completion/top_level_computer.dart
index d725b8e96cab4140e0ab235a0f00110ab4e26fe5..23bda1d69bc47eb9bd3b34d0f047ad4a7a5aa7d7 100644
--- a/pkg/analysis_services/lib/src/completion/top_level_computer.dart
+++ b/pkg/analysis_services/lib/src/completion/top_level_computer.dart
@@ -31,27 +31,31 @@ class TopLevelComputer extends CompletionComputer {
// Compute the set of visible libraries to determine relevance
var visibleLibraries = new Set<LibraryElement>();
- visibleLibraries.add(unit.element.library);
- visibleLibraries.addAll(unit.element.library.importedLibraries);
+ var unitLibrary = unit.element.library;
+ visibleLibraries.add(unitLibrary);
+ visibleLibraries.addAll(unitLibrary.importedLibraries);
// Compute the set of possible classes and top level variables
var suggestions = new List<CompletionSuggestion>();
matches.forEach((SearchMatch match) {
if (match.kind == MatchKind.DECLARATION) {
Element element = match.element;
- String completion = element.displayName;
- suggestions.add(
- new CompletionSuggestion(
- CompletionSuggestionKind.fromElementKind(element.kind),
- visibleLibraries.contains(element.library) ?
- CompletionRelevance.DEFAULT :
- CompletionRelevance.LOW,
- completion,
- completion.length,
- 0,
- element.isDeprecated,
- false // isPotential
- ));
+ if (element.isPublic || element.library == unitLibrary) {
+ String completion = element.displayName;
+ var relevance = visibleLibraries.contains(element.library) ?
+ CompletionRelevance.DEFAULT :
+ CompletionRelevance.LOW;
+ suggestions.add(
+ new CompletionSuggestion(
+ CompletionSuggestionKind.fromElementKind(element.kind),
+ relevance,
+ completion,
+ completion.length,
+ 0,
+ element.isDeprecated,
+ false // isPotential
+ ));
+ }
}
});
return suggestions;
« no previous file with comments | « no previous file | pkg/analysis_services/test/completion/top_level_computer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698