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

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

Issue 639183002: binary expression suggestion fix (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/imported_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
index c032211ab62bd59f0d1e03df5a2fcaadc1386760..6110a25c9bd46d28c1f4b2cd74f1be152002a5fd 100644
--- a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
@@ -69,6 +69,11 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
}
@override
+ Future<bool> visitExpression(Expression node) {
+ return _addImportedElementSuggestions();
+ }
+
+ @override
Future<bool> visitExpressionStatement(ExpressionStatement node) {
Expression expression = node.expression;
// A pre-variable declaration (e.g. C ^) is parsed as an expression
@@ -88,7 +93,19 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) {
// Make suggestions for the prefix, but not for the selector
// InvocationComputer makes selector suggestions
- if (request.offset <= node.prefix.end) {
+ Token period = node.period;
+ if (period != null && request.offset <= period.offset) {
+ return _addImportedElementSuggestions();
+ }
+ return new Future.value(false);
+ }
+
+ @override
+ Future<bool> visitPropertyAccess(PropertyAccess node) {
+ // Make suggestions for the target, but not for the property name
+ // InvocationComputer makes property name suggestions
+ var operator = node.operator;
+ if (operator != null && request.offset < operator.offset) {
return _addImportedElementSuggestions();
}
return new Future.value(false);
@@ -100,6 +117,11 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
}
@override
+ Future<bool> visitStringLiteral(StringLiteral node) {
+ return new Future.value(false);
+ }
+
+ @override
Future<bool> visitTypeName(TypeName node) {
return _addImportedElementSuggestions(typesOnly: true);
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698