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

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

Issue 1250373007: Fix missing generic type parameters on streams. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | sdk/lib/async/stream_controller.dart » ('j') | 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 * 835 *
836 * Internally the method cancels its subscription after these elements. This 836 * Internally the method cancels its subscription after these elements. This
837 * means that single-subscription (non-broadcast) streams are closed and 837 * means that single-subscription (non-broadcast) streams are closed and
838 * cannot be reused after a call to this method. 838 * cannot be reused after a call to this method.
839 * 839 *
840 * The returned stream is a broadcast stream if this stream is. 840 * The returned stream is a broadcast stream if this stream is.
841 * For a broadcast stream, the events are only counted from the time 841 * For a broadcast stream, the events are only counted from the time
842 * the returned stream is listened to. 842 * the returned stream is listened to.
843 */ 843 */
844 Stream<T> take(int count) { 844 Stream<T> take(int count) {
845 return new _TakeStream(this, count); 845 return new _TakeStream<T>(this, count);
846 } 846 }
847 847
848 /** 848 /**
849 * Forwards data events while [test] is successful. 849 * Forwards data events while [test] is successful.
850 * 850 *
851 * The returned stream provides the same events as this stream as long 851 * The returned stream provides the same events as this stream as long
852 * as [test] returns [:true:] for the event data. The stream is done 852 * as [test] returns [:true:] for the event data. The stream is done
853 * when either this stream is done, or when this stream first provides 853 * when either this stream is done, or when this stream first provides
854 * a value that [test] doesn't accept. 854 * a value that [test] doesn't accept.
855 * 855 *
856 * Stops listening to the stream after the accepted elements. 856 * Stops listening to the stream after the accepted elements.
857 * 857 *
858 * Internally the method cancels its subscription after these elements. This 858 * Internally the method cancels its subscription after these elements. This
859 * means that single-subscription (non-broadcast) streams are closed and 859 * means that single-subscription (non-broadcast) streams are closed and
860 * cannot be reused after a call to this method. 860 * cannot be reused after a call to this method.
861 * 861 *
862 * The returned stream is a broadcast stream if this stream is. 862 * The returned stream is a broadcast stream if this stream is.
863 * For a broadcast stream, the events are only tested from the time 863 * For a broadcast stream, the events are only tested from the time
864 * the returned stream is listened to. 864 * the returned stream is listened to.
865 */ 865 */
866 Stream<T> takeWhile(bool test(T element)) { 866 Stream<T> takeWhile(bool test(T element)) {
867 return new _TakeWhileStream(this, test); 867 return new _TakeWhileStream<T>(this, test);
868 } 868 }
869 869
870 /** 870 /**
871 * Skips the first [count] data events from this stream. 871 * Skips the first [count] data events from this stream.
872 * 872 *
873 * The returned stream is a broadcast stream if this stream is. 873 * The returned stream is a broadcast stream if this stream is.
874 * For a broadcast stream, the events are only counted from the time 874 * For a broadcast stream, the events are only counted from the time
875 * the returned stream is listened to. 875 * the returned stream is listened to.
876 */ 876 */
877 Stream<T> skip(int count) { 877 Stream<T> skip(int count) {
878 return new _SkipStream(this, count); 878 return new _SkipStream<T>(this, count);
879 } 879 }
880 880
881 /** 881 /**
882 * Skip data events from this stream while they are matched by [test]. 882 * Skip data events from this stream while they are matched by [test].
883 * 883 *
884 * Error and done events are provided by the returned stream unmodified. 884 * Error and done events are provided by the returned stream unmodified.
885 * 885 *
886 * Starting with the first data event where [test] returns false for the 886 * Starting with the first data event where [test] returns false for the
887 * event data, the returned stream will have the same events as this stream. 887 * event data, the returned stream will have the same events as this stream.
888 * 888 *
889 * The returned stream is a broadcast stream if this stream is. 889 * The returned stream is a broadcast stream if this stream is.
890 * For a broadcast stream, the events are only tested from the time 890 * For a broadcast stream, the events are only tested from the time
891 * the returned stream is listened to. 891 * the returned stream is listened to.
892 */ 892 */
893 Stream<T> skipWhile(bool test(T element)) { 893 Stream<T> skipWhile(bool test(T element)) {
894 return new _SkipWhileStream(this, test); 894 return new _SkipWhileStream<T>(this, test);
895 } 895 }
896 896
897 /** 897 /**
898 * Skips data events if they are equal to the previous data event. 898 * Skips data events if they are equal to the previous data event.
899 * 899 *
900 * The returned stream provides the same events as this stream, except 900 * The returned stream provides the same events as this stream, except
901 * that it never provides two consequtive data events that are equal. 901 * that it never provides two consequtive data events that are equal.
902 * 902 *
903 * Equality is determined by the provided [equals] method. If that is 903 * Equality is determined by the provided [equals] method. If that is
904 * omitted, the '==' operator on the last provided data element is used. 904 * omitted, the '==' operator on the last provided data element is used.
905 * 905 *
906 * The returned stream is a broadcast stream if this stream is. 906 * The returned stream is a broadcast stream if this stream is.
907 * If a broadcast stream is listened to more than once, each subscription 907 * If a broadcast stream is listened to more than once, each subscription
908 * will individually perform the `equals` test. 908 * will individually perform the `equals` test.
909 */ 909 */
910 Stream<T> distinct([bool equals(T previous, T next)]) { 910 Stream<T> distinct([bool equals(T previous, T next)]) {
911 return new _DistinctStream(this, equals); 911 return new _DistinctStream<T>(this, equals);
912 } 912 }
913 913
914 /** 914 /**
915 * Returns the first element of the stream. 915 * Returns the first element of the stream.
916 * 916 *
917 * Stops listening to the stream after the first element has been received. 917 * Stops listening to the stream after the first element has been received.
918 * 918 *
919 * Internally the method cancels its subscription after the first element. 919 * Internally the method cancels its subscription after the first element.
920 * This means that single-subscription (non-broadcast) streams are closed 920 * This means that single-subscription (non-broadcast) streams are closed
921 * and cannot be reused after a call to this getter. 921 * and cannot be reused after a call to this getter.
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 class _ControllerEventSinkWrapper<T> implements EventSink<T> { 1735 class _ControllerEventSinkWrapper<T> implements EventSink<T> {
1736 EventSink _sink; 1736 EventSink _sink;
1737 _ControllerEventSinkWrapper(this._sink); 1737 _ControllerEventSinkWrapper(this._sink);
1738 1738
1739 void add(T data) { _sink.add(data); } 1739 void add(T data) { _sink.add(data); }
1740 void addError(error, [StackTrace stackTrace]) { 1740 void addError(error, [StackTrace stackTrace]) {
1741 _sink.addError(error, stackTrace); 1741 _sink.addError(error, stackTrace);
1742 } 1742 }
1743 void close() { _sink.close(); } 1743 void close() { _sink.close(); }
1744 } 1744 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698