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

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

Issue 2202533003: Return futures on Stream.cancel when possible. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove debug-print. Created 4 years, 5 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
Index: sdk/lib/async/stream_impl.dart
diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
index 8c9af64bb9e01fd4bfe9511e9024117bcce3e8e8..680ed0ef1ad9350c72882a0629b39373337fcccb 100644
--- a/sdk/lib/async/stream_impl.dart
+++ b/sdk/lib/async/stream_impl.dart
@@ -778,7 +778,7 @@ class _DoneStreamSubscription<T> implements StreamSubscription<T> {
}
}
- Future cancel() => null;
+ Future cancel() => new Future.value(null);
Lasse Reichstein Nielsen 2016/08/01 15:23:26 Future._nullFuture
floitsch 2016/08/01 21:00:37 Done.
Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
_Future/*<E>*/ result = new _Future/*<E>*/();
@@ -916,7 +916,7 @@ class _BroadcastSubscriptionWrapper<T> implements StreamSubscription<T> {
Future cancel() {
_stream._cancelSubscription();
- return null;
+ return new Future.value(null);
Lasse Reichstein Nielsen 2016/08/01 15:23:26 Future._nullFuture (I will stop saying it now, but
floitsch 2016/08/01 21:00:37 Done.
}
bool get isPaused {
@@ -1032,7 +1032,7 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
Future cancel() {
StreamSubscription subscription = _subscription;
- if (subscription == null) return null;
+ if (subscription == null) return new Future.value(null);
if (_state == _STATE_MOVING) {
_Future<bool> hasNext = _futureOrPrefetch as Object /*=_Future<bool>*/;
_clear();

Powered by Google App Engine
This is Rietveld 408576698