| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 _importedCompletions.add(suggestion.completion); | 279 _importedCompletions.add(suggestion.completion); |
| 280 } | 280 } |
| 281 | 281 |
| 282 /** | 282 /** |
| 283 * Compute the hash of the imports for the given compilation unit. | 283 * Compute the hash of the imports for the given compilation unit. |
| 284 */ | 284 */ |
| 285 String _computeImportKey(CompilationUnit unit) { | 285 String _computeImportKey(CompilationUnit unit) { |
| 286 StringBuffer sb = new StringBuffer(); | 286 StringBuffer sb = new StringBuffer(); |
| 287 unit.directives.forEach((Directive directive) { | 287 unit.directives.forEach((Directive directive) { |
| 288 if (directive is ImportDirective) { | 288 sb.write(directive.toSource()); |
| 289 sb.write(directive.toSource()); | |
| 290 } | |
| 291 }); | 289 }); |
| 292 return sb.toString(); | 290 return sb.toString(); |
| 293 } | 291 } |
| 294 } | 292 } |
| 295 | 293 |
| 296 /** | 294 /** |
| 297 * A visitor for building suggestions based upon the elements defined by | 295 * A visitor for building suggestions based upon the elements defined by |
| 298 * a source file contained in the same library but not the same as | 296 * a source file contained in the same library but not the same as |
| 299 * the source in which the completions are being requested. | 297 * the source in which the completions are being requested. |
| 300 */ | 298 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 326 @override | 324 @override |
| 327 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { | 325 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { |
| 328 cache.addSuggestion(element, CompletionRelevance.DEFAULT); | 326 cache.addSuggestion(element, CompletionRelevance.DEFAULT); |
| 329 } | 327 } |
| 330 | 328 |
| 331 @override | 329 @override |
| 332 void visitTopLevelVariableElement(TopLevelVariableElement element) { | 330 void visitTopLevelVariableElement(TopLevelVariableElement element) { |
| 333 cache.addSuggestion(element, CompletionRelevance.DEFAULT); | 331 cache.addSuggestion(element, CompletionRelevance.DEFAULT); |
| 334 } | 332 } |
| 335 } | 333 } |
| OLD | NEW |