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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.completion.computer.dart.toplevel; 5 library services.completion.computer.dart.toplevel;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol_server.dart' hide Element, 9 import 'package:analysis_server/src/protocol_server.dart' hide Element,
10 ElementKind; 10 ElementKind;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 return new Future.value(false); 63 return new Future.value(false);
64 } 64 }
65 65
66 @override 66 @override
67 Future<bool> visitCombinator(Combinator node) { 67 Future<bool> visitCombinator(Combinator node) {
68 return _addCombinatorSuggestions(node); 68 return _addCombinatorSuggestions(node);
69 } 69 }
70 70
71 @override 71 @override
72 Future<bool> visitExpression(Expression node) {
73 return _addImportedElementSuggestions();
74 }
75
76 @override
72 Future<bool> visitExpressionStatement(ExpressionStatement node) { 77 Future<bool> visitExpressionStatement(ExpressionStatement node) {
73 Expression expression = node.expression; 78 Expression expression = node.expression;
74 // A pre-variable declaration (e.g. C ^) is parsed as an expression 79 // A pre-variable declaration (e.g. C ^) is parsed as an expression
75 // statement. Do not make suggestions for the variable name. 80 // statement. Do not make suggestions for the variable name.
76 if (expression is SimpleIdentifier && request.offset <= expression.end) { 81 if (expression is SimpleIdentifier && request.offset <= expression.end) {
77 return _addImportedElementSuggestions(); 82 return _addImportedElementSuggestions();
78 } 83 }
79 return new Future.value(false); 84 return new Future.value(false);
80 } 85 }
81 86
82 @override 87 @override
83 Future<bool> visitNode(AstNode node) { 88 Future<bool> visitNode(AstNode node) {
84 return new Future.value(false); 89 return new Future.value(false);
85 } 90 }
86 91
87 @override 92 @override
88 Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) { 93 Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) {
89 // Make suggestions for the prefix, but not for the selector 94 // Make suggestions for the prefix, but not for the selector
90 // InvocationComputer makes selector suggestions 95 // InvocationComputer makes selector suggestions
91 if (request.offset <= node.prefix.end) { 96 Token period = node.period;
97 if (period != null && request.offset <= period.offset) {
92 return _addImportedElementSuggestions(); 98 return _addImportedElementSuggestions();
93 } 99 }
94 return new Future.value(false); 100 return new Future.value(false);
101 }
102
103 @override
104 Future<bool> visitPropertyAccess(PropertyAccess node) {
105 // Make suggestions for the target, but not for the property name
106 // InvocationComputer makes property name suggestions
107 var operator = node.operator;
108 if (operator != null && request.offset < operator.offset) {
109 return _addImportedElementSuggestions();
110 }
111 return new Future.value(false);
95 } 112 }
96 113
97 @override 114 @override
98 Future<bool> visitSimpleIdentifier(SimpleIdentifier node) { 115 Future<bool> visitSimpleIdentifier(SimpleIdentifier node) {
99 return node.parent.accept(this); 116 return node.parent.accept(this);
100 } 117 }
101 118
102 @override 119 @override
120 Future<bool> visitStringLiteral(StringLiteral node) {
121 return new Future.value(false);
122 }
123
124 @override
103 Future<bool> visitTypeName(TypeName node) { 125 Future<bool> visitTypeName(TypeName node) {
104 return _addImportedElementSuggestions(typesOnly: true); 126 return _addImportedElementSuggestions(typesOnly: true);
105 } 127 }
106 128
107 @override 129 @override
108 visitVariableDeclaration(VariableDeclaration node) { 130 visitVariableDeclaration(VariableDeclaration node) {
109 Token equals = node.equals; 131 Token equals = node.equals;
110 // Make suggestions for the RHS of a variable declaration 132 // Make suggestions for the RHS of a variable declaration
111 if (equals != null && request.offset >= equals.end) { 133 if (equals != null && request.offset >= equals.end) {
112 return _addImportedElementSuggestions(); 134 return _addImportedElementSuggestions();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 importElem.isDeprecated, 257 importElem.isDeprecated,
236 false); 258 false);
237 LibraryElement lib = importElem.importedLibrary; 259 LibraryElement lib = importElem.importedLibrary;
238 if (lib != null) { 260 if (lib != null) {
239 suggestion.element = newElement_fromEngine(lib); 261 suggestion.element = newElement_fromEngine(lib);
240 } 262 }
241 request.suggestions.add(suggestion); 263 request.suggestions.add(suggestion);
242 } 264 }
243 } 265 }
244 } 266 }
OLDNEW
« 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