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

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

Issue 1127643003: suggest only superclass elements for "super." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 7 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/suggestion_builder.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
index 80ddd8560414003336112be61692682d28e3cd84..02f7ed0b1330abb00ff970c545ba34fc5ffc139a 100644
--- a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
@@ -345,7 +345,15 @@ class InterfaceTypeSuggestionBuilder {
}
}
- void _buildSuggestions(InterfaceType type, LibraryElement library) {
+ void _buildSuggestions(
+ InterfaceType type, LibraryElement library, bool isSuper) {
+ if (isSuper) {
+ // Suggest members from superclass if the target is "super"
+ type = type.superclass;
+ if (type == null) {
+ return;
+ }
+ }
// Visit all of the types in the class hierarchy, collecting possible
// completions. If multiple elements are found that complete to the same
// identifier, addSuggestion will discard all but the first (with a few
@@ -412,7 +420,8 @@ class InterfaceTypeSuggestionBuilder {
/**
* Add suggestions for the visible members in the given interface
*/
- static void suggestionsFor(DartCompletionRequest request, DartType type) {
+ static void suggestionsFor(DartCompletionRequest request, DartType type,
+ {bool isSuper: false}) {
CompilationUnit compilationUnit =
request.target.containingNode.getAncestor((n) => n is CompilationUnit);
LibraryElement library = compilationUnit.element.library;
@@ -421,7 +430,7 @@ class InterfaceTypeSuggestionBuilder {
}
if (type is InterfaceType) {
return new InterfaceTypeSuggestionBuilder(request)._buildSuggestions(
- type, library);
+ type, library, isSuper);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698