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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 7 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
8 import 'package:analysis_server/src/services/completion/completion_core.dart'; | 8 import 'package:analysis_server/src/services/completion/completion_core.dart'; |
9 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; | 9 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; |
10 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart' | 10 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart' |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 cs = s; | 557 cs = s; |
558 } else { | 558 } else { |
559 failedCompletion('expected exactly one $cs', | 559 failedCompletion('expected exactly one $cs', |
560 suggestions.where((s) => s.completion == completion)); | 560 suggestions.where((s) => s.completion == completion)); |
561 } | 561 } |
562 }); | 562 }); |
563 } | 563 } |
564 return cs; | 564 return cs; |
565 } | 565 } |
566 | 566 |
567 Future/*<E>*/ performAnalysis/*<E>*/( | 567 Future<E> performAnalysis<E>(int times, Completer<E> completer) async { |
568 int times, Completer/*<E>*/ completer) async { | |
569 if (completer.isCompleted) { | 568 if (completer.isCompleted) { |
570 return completer.future; | 569 return completer.future; |
571 } | 570 } |
572 // We use a delayed future to allow microtask events to finish. The | 571 // We use a delayed future to allow microtask events to finish. The |
573 // Future.value or Future() constructors use scheduleMicrotask themselves an
d | 572 // Future.value or Future() constructors use scheduleMicrotask themselves an
d |
574 // would therefore not wait for microtask callbacks that are scheduled after | 573 // would therefore not wait for microtask callbacks that are scheduled after |
575 // invoking this method. | 574 // invoking this method. |
576 return new Future.delayed( | 575 return new Future.delayed( |
577 Duration.ZERO, () => performAnalysis(times - 1, completer)); | 576 Duration.ZERO, () => performAnalysis(times - 1, completer)); |
578 } | 577 } |
579 | 578 |
580 void resolveSource(String path, String content) { | 579 void resolveSource(String path, String content) { |
581 addSource(path, content); | 580 addSource(path, content); |
582 } | 581 } |
583 | 582 |
584 @override | 583 @override |
585 void setUp() { | 584 void setUp() { |
586 super.setUp(); | 585 super.setUp(); |
587 testFile = provider.convertPath('/completionTest.dart'); | 586 testFile = provider.convertPath('/completionTest.dart'); |
588 contributor = createContributor(); | 587 contributor = createContributor(); |
589 } | 588 } |
590 } | 589 } |
OLD | NEW |