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

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

Issue 99463005: Update stream iterator doc and add test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test nam Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | tests/lib/async/stream_iterator_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** Abstract and private interface for a place to put events. */ 7 /** Abstract and private interface for a place to put events. */
8 abstract class _EventSink<T> { 8 abstract class _EventSink<T> {
9 void _add(T data); 9 void _add(T data);
10 void _addError(Object error, StackTrace stackTrace); 10 void _addError(Object error, StackTrace stackTrace);
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 945
946 Future<bool> moveNext() { 946 Future<bool> moveNext() {
947 if (_state == _STATE_DONE) { 947 if (_state == _STATE_DONE) {
948 return new _Future<bool>.immediate(false); 948 return new _Future<bool>.immediate(false);
949 } 949 }
950 if (_state == _STATE_MOVING) { 950 if (_state == _STATE_MOVING) {
951 throw new StateError("Already waiting for next."); 951 throw new StateError("Already waiting for next.");
952 } 952 }
953 if (_state == _STATE_FOUND) { 953 if (_state == _STATE_FOUND) {
954 _state = _STATE_MOVING; 954 _state = _STATE_MOVING;
955 _current = null;
955 _futureOrPrefetch = new _Future<bool>(); 956 _futureOrPrefetch = new _Future<bool>();
956 return _futureOrPrefetch; 957 return _futureOrPrefetch;
957 } else { 958 } else {
958 assert(_state >= _STATE_EXTRA_DATA); 959 assert(_state >= _STATE_EXTRA_DATA);
959 switch (_state) { 960 switch (_state) {
960 case _STATE_EXTRA_DATA: 961 case _STATE_EXTRA_DATA:
961 _state = _STATE_FOUND; 962 _state = _STATE_FOUND;
962 _current = _futureOrPrefetch; 963 _current = _futureOrPrefetch;
963 _futureOrPrefetch = null; 964 _futureOrPrefetch = null;
964 _subscription.resume(); 965 _subscription.resume();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 _Future<bool> hasNext = _futureOrPrefetch; 1029 _Future<bool> hasNext = _futureOrPrefetch;
1029 _clear(); 1030 _clear();
1030 hasNext._complete(false); 1031 hasNext._complete(false);
1031 return; 1032 return;
1032 } 1033 }
1033 _subscription.pause(); 1034 _subscription.pause();
1034 _futureOrPrefetch = null; 1035 _futureOrPrefetch = null;
1035 _state = _STATE_EXTRA_DONE; 1036 _state = _STATE_EXTRA_DONE;
1036 } 1037 }
1037 } 1038 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | tests/lib/async/stream_iterator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698