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

Side by Side Diff: test/generated_sdk/lib/async/future.dart

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 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
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 /** 7 /**
8 * An object representing a delayed computation. 8 * An object representing a delayed computation.
9 * 9 *
10 * A [Future] is used to represent a potential value, or error, 10 * A [Future] is used to represent a potential value, or error,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 * the `then` call, it would not catch errors from the `bar` call. 88 * the `then` call, it would not catch errors from the `bar` call.
89 * 89 *
90 * Futures can have more than one callback-pair registered. Each successor is 90 * Futures can have more than one callback-pair registered. Each successor is
91 * treated independently and is handled as if it was the only successor. 91 * treated independently and is handled as if it was the only successor.
92 * 92 *
93 * A future may also fail to ever complete. In that case, no callbacks are 93 * A future may also fail to ever complete. In that case, no callbacks are
94 * called. 94 * called.
95 */ 95 */
96 abstract class Future<T> { 96 abstract class Future<T> {
97 // The `_nullFuture` is a completed Future with the value `null`. 97 // The `_nullFuture` is a completed Future with the value `null`.
98 static final _Future _nullFuture = new Future.value(null); 98 static final _Future _nullFuture = new _Future.immediate(null);
99 99
100 /** 100 /**
101 * Creates a future containing the result of calling [computation] 101 * Creates a future containing the result of calling [computation]
102 * asynchronously with [Timer.run]. 102 * asynchronously with [Timer.run].
103 * 103 *
104 * If the result of executing [computation] throws, the returned future is 104 * If the result of executing [computation] throws, the returned future is
105 * completed with the error. 105 * completed with the error.
106 * 106 *
107 * If the returned value is itself a [Future], completion of 107 * If the returned value is itself a [Future], completion of
108 * the created future will wait until the returned future completes, 108 * the created future will wait until the returned future completes,
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 if (replacement != null) { 720 if (replacement != null) {
721 error = _nonNullError(replacement.error); 721 error = _nonNullError(replacement.error);
722 stackTrace = replacement.stackTrace; 722 stackTrace = replacement.stackTrace;
723 } 723 }
724 result._completeError(error, stackTrace); 724 result._completeError(error, stackTrace);
725 } 725 }
726 726
727 /** Helper function that converts `null` to a [NullThrownError]. */ 727 /** Helper function that converts `null` to a [NullThrownError]. */
728 Object _nonNullError(Object error) => 728 Object _nonNullError(Object error) =>
729 (error != null) ? error : new NullThrownError(); 729 (error != null) ? error : new NullThrownError();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698