Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart

Issue 1852113002: More strong mode changes in analysis_server (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/test/protocol_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 test.services.completion.dart.util; 5 library test.services.completion.dart.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
10 show Element, ElementKind; 10 show Element, ElementKind;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 cs = s; 512 cs = s;
513 } else { 513 } else {
514 failedCompletion('expected exactly one $cs', 514 failedCompletion('expected exactly one $cs',
515 suggestions.where((s) => s.completion == completion)); 515 suggestions.where((s) => s.completion == completion));
516 } 516 }
517 }); 517 });
518 } 518 }
519 return cs; 519 return cs;
520 } 520 }
521 521
522 Future performAnalysis(int times, Completer completer) { 522 Future/*<E>*/ performAnalysis/*<E>*/(int times, Completer/*<E>*/ completer) {
523 if (completer.isCompleted) return completer.future; 523 if (completer.isCompleted) {
524 if (times == 0 || context == null) return new Future.value(); 524 return completer.future;
525 }
526 if (times == 0 || context == null) {
527 return new Future.value();
528 }
525 context.performAnalysisTask(); 529 context.performAnalysisTask();
526 // We use a delayed future to allow microtask events to finish. The 530 // We use a delayed future to allow microtask events to finish. The
527 // Future.value or Future() constructors use scheduleMicrotask themselves an d 531 // Future.value or Future() constructors use scheduleMicrotask themselves an d
528 // would therefore not wait for microtask callbacks that are scheduled after 532 // would therefore not wait for microtask callbacks that are scheduled after
529 // invoking this method. 533 // invoking this method.
530 return new Future.delayed( 534 return new Future.delayed(
531 Duration.ZERO, () => performAnalysis(times - 1, completer)); 535 Duration.ZERO, () => performAnalysis(times - 1, completer));
532 } 536 }
533 537
534 void resolveSource(String path, String content) { 538 void resolveSource(String path, String content) {
535 Source libSource = addSource(path, content); 539 Source libSource = addSource(path, content);
536 var target = new LibrarySpecificUnit(libSource, libSource); 540 var target = new LibrarySpecificUnit(libSource, libSource);
537 context.computeResult(target, RESOLVED_UNIT); 541 context.computeResult(target, RESOLVED_UNIT);
538 } 542 }
539 543
540 @override 544 @override
541 void setUp() { 545 void setUp() {
542 super.setUp(); 546 super.setUp();
543 index = createMemoryIndex(); 547 index = createMemoryIndex();
544 searchEngine = new SearchEngineImpl(index); 548 searchEngine = new SearchEngineImpl(index);
545 contributor = createContributor(); 549 contributor = createContributor();
546 } 550 }
547 } 551 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/protocol_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698