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

Unified Diff: sdk/lib/async/future_impl.dart

Issue 11833032: Fix pub tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/archive/input_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future_impl.dart
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index aaf005efc470f310097ddcd8288238c4b8c272b4..02513781cef70727bddf1b7b38a060483e95b833 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -420,17 +420,16 @@ class _WhenFuture<T> extends _TransformFuture<T, T> {
var result = _action();
if (result is Future) {
Future resultFuture = result;
- result.then((_) {
+ resultFuture.then((_) {
_setValue(value);
- }, onError: (AsyncError e) {
- _setError(e);
- });
+ }, onError: _setError);
return;
}
} catch (e, s) {
_setError(new AsyncError(e, s));
return;
}
+
_setValue(value);
}
@@ -439,13 +438,10 @@ class _WhenFuture<T> extends _TransformFuture<T, T> {
var result = _action();
if (result is Future) {
Future resultFuture = result;
- result.then((_) {
+ // TODO(lrn): Find a way to combine [error] into [e].
+ resultFuture.then((_) {
_setError(error);
- }, onError: (AsyncError e) {
- // TODO(lrn): Find a way to combine error into the
- // resulting error.
- _setError(e);
- });
+ }, onError: _setError);
return;
}
} catch (e, s) {
@@ -475,9 +471,9 @@ class _FutureWrapper<T> implements Future<T> {
return _future.catchError(function, test: test);
}
- Future whenComplete(action()) {
+ Future<T> whenComplete(action()) {
return _future.whenComplete(action);
}
- Stream<T> asStream() => new Stream.fromFuture(this);
+ Stream<T> asStream() => new Stream.fromFuture(_future);
}
« no previous file with comments | « no previous file | utils/archive/input_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698