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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart

Issue 1911803004: Code Completion refactoring, follow up on comment in https://codereview.chromium.org/1908703002/ to… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase with master Created 4 years, 8 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
Index: pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
index 9814fd6bd55ec26d85efe52f0b2987dfff3e9a38..5c10beb8d9779750f8a1087686068a4eba202a7c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
@@ -46,20 +46,18 @@ class LibraryElementSuggestionBuilder extends GeneralizingElementVisitor
void visitClassElement(ClassElement element) {
if (optype.includeTypeNameSuggestions) {
// if includeTypeNameSuggestions, then use the filter
- if (optype.typeNameSuggestionsFilter(element.type)) {
- addSuggestion(element,
- prefix: prefix, relevance: DART_RELEVANCE_DEFAULT);
+ int relevance = optype.typeNameSuggestionsFilter(
+ element.type, DART_RELEVANCE_DEFAULT);
+ if (relevance != null) {
+ addSuggestion(element, prefix: prefix, relevance: relevance);
}
}
if (optype.includeConstructorSuggestions) {
- int relevance = DART_RELEVANCE_DEFAULT;
- int filter = optype.constructorSuggestionsFilter(element.type);
- if (filter == null) {
- return;
- } else {
- relevance += filter;
+ int relevance = optype.constructorSuggestionsFilter(
+ element.type, DART_RELEVANCE_DEFAULT);
+ if (relevance != null) {
+ _addConstructorSuggestions(element, relevance);
}
- _addConstructorSuggestions(element, relevance);
}
}

Powered by Google App Engine
This is Rietveld 408576698