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

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

Issue 12091105: Add Future.of that calls a function and captures the result (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Better comment. 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 | « sdk/lib/async/future.dart ('k') | tests/lib/async/future_test.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 e91da2b4182f0b13ceb9b2617909d1b1967916b3..53ba3f3e34768b02c37baa9be0070217e7035f56 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -304,31 +304,8 @@ class _FutureImpl<T> implements Future<T> {
}
}
- _FutureListener _asListener() => new _FutureListener.wrap(this);
-}
-
-/**
- * Transforming future base class.
- *
- * A transforming future is itself a future and a future listener.
- * Subclasses override [_sendValue]/[_sendError] to intercept
- * the results of a previous future.
- */
-abstract class _TransformFuture<S, T> extends _FutureImpl<T>
- implements _FutureListener<S> {
- // _FutureListener implementation.
- _FutureListener _nextListener;
-
- void _sendValue(S value);
-
- void _sendError(AsyncError error);
-
- void _subscribeTo(_FutureImpl future) {
- future._addListener(this);
- }
-
/**
- * Helper function to hand the result of transforming an incoming event.
+ * Helper function to handle the result of transforming an incoming event.
*
* If the result is itself a [Future], this future is linked to that
* future's output. If not, this future is completed with the result.
@@ -351,6 +328,29 @@ abstract class _TransformFuture<S, T> extends _FutureImpl<T>
_setValue(result);
}
}
+
+ _FutureListener _asListener() => new _FutureListener.wrap(this);
+}
+
+/**
+ * Transforming future base class.
+ *
+ * A transforming future is itself a future and a future listener.
+ * Subclasses override [_sendValue]/[_sendError] to intercept
+ * the results of a previous future.
+ */
+abstract class _TransformFuture<S, T> extends _FutureImpl<T>
+ implements _FutureListener<S> {
+ // _FutureListener implementation.
+ _FutureListener _nextListener;
+
+ void _sendValue(S value);
+
+ void _sendError(AsyncError error);
+
+ void _subscribeTo(_FutureImpl future) {
+ future._addListener(this);
+ }
}
/** The onValue and onError handlers return either a value or a future */
« no previous file with comments | « sdk/lib/async/future.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698