| OLD | NEW |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 @override | 97 @override |
| 98 Future<bool> visitForStatement(ForStatement node) { | 98 Future<bool> visitForStatement(ForStatement node) { |
| 99 Token leftParenthesis = node.leftParenthesis; | 99 Token leftParenthesis = node.leftParenthesis; |
| 100 if (leftParenthesis != null && request.offset >= leftParenthesis.end) { | 100 if (leftParenthesis != null && request.offset >= leftParenthesis.end) { |
| 101 return _addImportedElementSuggestions(); | 101 return _addImportedElementSuggestions(); |
| 102 } | 102 } |
| 103 return new Future.value(false); | 103 return new Future.value(false); |
| 104 } | 104 } |
| 105 | 105 |
| 106 @override | 106 @override |
| 107 Future<bool> visitIfStatement(IfStatement node) { |
| 108 Token leftParen = node.leftParenthesis; |
| 109 if (leftParen != null && request.offset >= leftParen.end) { |
| 110 Token rightParen = node.rightParenthesis; |
| 111 if (rightParen == null || request.offset <= rightParen.offset) { |
| 112 return _addImportedElementSuggestions(); |
| 113 } |
| 114 } |
| 115 return new Future.value(false); |
| 116 } |
| 117 |
| 118 @override |
| 107 Future<bool> visitInterpolationExpression(InterpolationExpression node) { | 119 Future<bool> visitInterpolationExpression(InterpolationExpression node) { |
| 108 Expression expression = node.expression; | 120 Expression expression = node.expression; |
| 109 if (expression is SimpleIdentifier) { | 121 if (expression is SimpleIdentifier) { |
| 110 return _addImportedElementSuggestions(); | 122 return _addImportedElementSuggestions(); |
| 111 } | 123 } |
| 112 return new Future.value(false); | 124 return new Future.value(false); |
| 113 } | 125 } |
| 114 | 126 |
| 115 @override | 127 @override |
| 116 Future<bool> visitNode(AstNode node) { | 128 Future<bool> visitNode(AstNode node) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 importElem.isDeprecated, | 297 importElem.isDeprecated, |
| 286 false); | 298 false); |
| 287 LibraryElement lib = importElem.importedLibrary; | 299 LibraryElement lib = importElem.importedLibrary; |
| 288 if (lib != null) { | 300 if (lib != null) { |
| 289 suggestion.element = newElement_fromEngine(lib); | 301 suggestion.element = newElement_fromEngine(lib); |
| 290 } | 302 } |
| 291 request.suggestions.add(suggestion); | 303 request.suggestions.add(suggestion); |
| 292 } | 304 } |
| 293 } | 305 } |
| 294 } | 306 } |
| OLD | NEW |