| 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.dart.cache; | 5 library services.completion.dart.cache; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol_server.dart' hide Element, | 10 import 'package:analysis_server/src/protocol_server.dart' hide Element, |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 */ | 269 */ |
| 270 void _addSuggestion(Element element, int relevance) { | 270 void _addSuggestion(Element element, int relevance) { |
| 271 | 271 |
| 272 if (element is ExecutableElement) { | 272 if (element is ExecutableElement) { |
| 273 if (element.isOperator) { | 273 if (element.isOperator) { |
| 274 return; | 274 return; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 CompletionSuggestion suggestion = | 278 CompletionSuggestion suggestion = |
| 279 createElementSuggestion(element, relevance: relevance); | 279 createSuggestion(element, relevance: relevance); |
| 280 | 280 |
| 281 if (element is ExecutableElement) { | 281 if (element is ExecutableElement) { |
| 282 DartType returnType = element.returnType; | 282 DartType returnType = element.returnType; |
| 283 if (returnType != null && returnType.isVoid) { | 283 if (returnType != null && returnType.isVoid) { |
| 284 importedVoidReturnSuggestions.add(suggestion); | 284 importedVoidReturnSuggestions.add(suggestion); |
| 285 } else { | 285 } else { |
| 286 otherImportedSuggestions.add(suggestion); | 286 otherImportedSuggestions.add(suggestion); |
| 287 } | 287 } |
| 288 } else if (element is ClassElement) { | 288 } else if (element is ClassElement) { |
| 289 importedTypeSuggestions.add(suggestion); | 289 importedTypeSuggestions.add(suggestion); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 @override | 355 @override |
| 356 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { | 356 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { |
| 357 cache._addSuggestion(element, COMPLETION_RELEVANCE_DEFAULT); | 357 cache._addSuggestion(element, COMPLETION_RELEVANCE_DEFAULT); |
| 358 } | 358 } |
| 359 | 359 |
| 360 @override | 360 @override |
| 361 void visitTopLevelVariableElement(TopLevelVariableElement element) { | 361 void visitTopLevelVariableElement(TopLevelVariableElement element) { |
| 362 cache._addSuggestion(element, COMPLETION_RELEVANCE_DEFAULT); | 362 cache._addSuggestion(element, COMPLETION_RELEVANCE_DEFAULT); |
| 363 } | 363 } |
| 364 } | 364 } |
| OLD | NEW |