Index: sdk/lib/async/stream_pipe.dart |
diff --git a/sdk/lib/async/stream_pipe.dart b/sdk/lib/async/stream_pipe.dart |
index b126747d848bcaa84ebe0315132ecc37ff042330..dde13f82670df2f0a764e7b334304869748dc27d 100644 |
--- a/sdk/lib/async/stream_pipe.dart |
+++ b/sdk/lib/async/stream_pipe.dart |
@@ -27,8 +27,23 @@ _runUserCode(userCode(), onSuccess(value), onError(error)) { |
/** Helper function to make an onError argument to [_runUserCode]. */ |
_cancelAndError(StreamSubscription subscription, _Future future) => |
(error) { |
floitsch
2013/10/12 18:53:57
You will need to update this for the stack-trace a
Lasse Reichstein Nielsen
2013/10/14 11:32:33
And not make it curried.
Anders Johnsen
2013/10/16 11:52:21
Done.
Anders Johnsen
2013/10/16 11:52:21
Done.
|
- subscription.cancel(); |
- future._completeError(error); |
+ var cancelFuture = subscription.cancel(); |
+ if (cancelFuture != null) { |
floitsch
2013/10/12 18:53:57
if (cancelFuture is Future)
Users are used to wri
Anders Johnsen
2013/10/16 11:52:21
Done.
|
+ cancelFuture.whenComplete(() => future._completeError(error)); |
+ } else { |
+ future._completeError(error); |
+ } |
+ }; |
+ |
+/** Helper function to make an onError argument to [_runUserCode]. */ |
+_cancelAndValue(StreamSubscription subscription, _Future future) => |
+ (value) { |
+ var cancelFuture = subscription.cancel(); |
+ if (cancelFuture != null) { |
floitsch
2013/10/12 18:53:57
ditto.
Anders Johnsen
2013/10/16 11:52:21
Done.
|
+ cancelFuture.whenComplete(() => future._complete(value)); |
+ } else { |
+ future._complete(value); |
+ } |
}; |