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

Side by Side Diff: sdk/lib/async/future_impl.dart

Issue 12324004: Add test for whether a completer or stream controller has been closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. It's isCompleted. Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/stream_controller.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.async; 5 part of dart.async;
6 6
7 deprecatedFutureValue(_FutureImpl future) => 7 deprecatedFutureValue(_FutureImpl future) =>
8 future._isComplete ? future._resultOrListeners : null; 8 future._isComplete ? future._resultOrListeners : null;
9 9
10 10
(...skipping 15 matching lines...) Expand all
26 _isComplete = true; 26 _isComplete = true;
27 AsyncError asyncError; 27 AsyncError asyncError;
28 if (error is AsyncError) { 28 if (error is AsyncError) {
29 asyncError = error; 29 asyncError = error;
30 } else { 30 } else {
31 asyncError = new AsyncError(error, stackTrace); 31 asyncError = new AsyncError(error, stackTrace);
32 } 32 }
33 _FutureImpl future = this.future; 33 _FutureImpl future = this.future;
34 future._setError(asyncError); 34 future._setError(asyncError);
35 } 35 }
36
37 bool get isCompleted => _isComplete;
36 } 38 }
37 39
38 /** 40 /**
39 * A listener on a future. 41 * A listener on a future.
40 * 42 *
41 * When the future completes, the [_sendValue] or [_sendError] method 43 * When the future completes, the [_sendValue] or [_sendError] method
42 * is invoked with the result. 44 * is invoked with the result.
43 * 45 *
44 * Listeners are kept in a linked list. 46 * Listeners are kept in a linked list.
45 */ 47 */
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 Future catchError(function(AsyncError error), {bool test(var error)}) { 526 Future catchError(function(AsyncError error), {bool test(var error)}) {
525 return _future.catchError(function, test: test); 527 return _future.catchError(function, test: test);
526 } 528 }
527 529
528 Future<T> whenComplete(action()) { 530 Future<T> whenComplete(action()) {
529 return _future.whenComplete(action); 531 return _future.whenComplete(action);
530 } 532 }
531 533
532 Stream<T> asStream() => new Stream.fromFuture(_future); 534 Stream<T> asStream() => new Stream.fromFuture(_future);
533 } 535 }
OLDNEW
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698