| 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 30 matching lines...) Expand all Loading... |
| 41 /** | 41 /** |
| 42 * A visitor for determining which imported class and top level variable | 42 * A visitor for determining which imported class and top level variable |
| 43 * should be suggested and building those suggestions. | 43 * should be suggested and building those suggestions. |
| 44 */ | 44 */ |
| 45 class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> { | 45 class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> { |
| 46 final DartCompletionRequest request; | 46 final DartCompletionRequest request; |
| 47 | 47 |
| 48 _ImportedVisitor(this.request); | 48 _ImportedVisitor(this.request); |
| 49 | 49 |
| 50 @override | 50 @override |
| 51 Future<bool> visitArgumentList(ArgumentList node) { |
| 52 return _addImportedElementSuggestions(node, excludeVoidReturn: true); |
| 53 } |
| 54 |
| 55 @override |
| 51 Future<bool> visitBlock(Block node) { | 56 Future<bool> visitBlock(Block node) { |
| 52 return _addImportedElementSuggestions(node); | 57 return _addImportedElementSuggestions(node); |
| 53 } | 58 } |
| 54 | 59 |
| 55 @override | 60 @override |
| 56 Future<bool> visitCascadeExpression(CascadeExpression node) { | 61 Future<bool> visitCascadeExpression(CascadeExpression node) { |
| 57 // Make suggestions for the target, but not for the selector | 62 // Make suggestions for the target, but not for the selector |
| 58 // InvocationComputer makes selector suggestions | 63 // InvocationComputer makes selector suggestions |
| 59 Expression target = node.target; | 64 Expression target = node.target; |
| 60 if (target != null && request.offset <= target.end) { | 65 if (target != null && request.offset <= target.end) { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 importElem.isDeprecated, | 389 importElem.isDeprecated, |
| 385 false); | 390 false); |
| 386 LibraryElement lib = importElem.importedLibrary; | 391 LibraryElement lib = importElem.importedLibrary; |
| 387 if (lib != null) { | 392 if (lib != null) { |
| 388 suggestion.element = newElement_fromEngine(lib); | 393 suggestion.element = newElement_fromEngine(lib); |
| 389 } | 394 } |
| 390 request.suggestions.add(suggestion); | 395 request.suggestions.add(suggestion); |
| 391 } | 396 } |
| 392 } | 397 } |
| 393 } | 398 } |
| OLD | NEW |