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

Side by Side Diff: sdk/lib/async/stream.dart

Issue 2954383002: Relax typing on Stream.transform
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 * ``` 608 * ```
609 * stream.map(mapping).transform(transformation).toList() 609 * stream.map(mapping).transform(transformation).toList()
610 * ``` 610 * ```
611 * which can be more convenient than calling `bind` directly. 611 * which can be more convenient than calling `bind` directly.
612 * 612 *
613 * The [streamTransformer] can return any stream. 613 * The [streamTransformer] can return any stream.
614 * Whether the returned stream is a broadcast stream or not, 614 * Whether the returned stream is a broadcast stream or not,
615 * and which elements it will contain, 615 * and which elements it will contain,
616 * is entirely up to the transformation. 616 * is entirely up to the transformation.
617 */ 617 */
618 Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer) { 618 Stream<S> transform<S>(StreamTransformer<dynamic, S> streamTransformer) {
619 return streamTransformer.bind(this); 619 return streamTransformer.bind(this.map<T>((x) => x));
vsm 2017/06/26 18:28:51 Actually, not sure the map is necessary at this po
Lasse Reichstein Nielsen 2017/06/27 05:45:18 It should work, the transformer claims to handle a
620 } 620 }
621 621
622 /** 622 /**
623 * Combines a sequence of values by repeatedly applying [combine]. 623 * Combines a sequence of values by repeatedly applying [combine].
624 * 624 *
625 * Similar to [Iterable.reduce], this function maintains a value, 625 * Similar to [Iterable.reduce], this function maintains a value,
626 * starting with the first element of the stream 626 * starting with the first element of the stream
627 * and updated for each further element of this stream. 627 * and updated for each further element of this stream.
628 * For each element after the first, 628 * For each element after the first,
629 * the value is updated to the result of calling [combine] 629 * the value is updated to the result of calling [combine]
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 } 1990 }
1991 1991
1992 void addError(error, [StackTrace stackTrace]) { 1992 void addError(error, [StackTrace stackTrace]) {
1993 _sink.addError(error, stackTrace); 1993 _sink.addError(error, stackTrace);
1994 } 1994 }
1995 1995
1996 void close() { 1996 void close() {
1997 _sink.close(); 1997 _sink.close();
1998 } 1998 }
1999 } 1999 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698