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

Side by Side Diff: test/dart_codegen/expect/async/stream_impl.dart

Issue 967933005: rename ddc -> dev_compiler, fixes #84 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 part of dart.async; 1 part of dart.async;
2 abstract class _EventSink<T> {void _add(T data); 2 abstract class _EventSink<T> {void _add(T data);
3 void _addError(Object error, StackTrace stackTrace); 3 void _addError(Object error, StackTrace stackTrace);
4 void _close(); 4 void _close();
5 } 5 }
6 abstract class _EventDispatch<T> {void _sendData(T data); 6 abstract class _EventDispatch<T> {void _sendData(T data);
7 void _sendError(Object error, StackTrace stackTrace); 7 void _sendError(Object error, StackTrace stackTrace);
8 void _sendDone(); 8 void _sendDone();
9 } 9 }
10 class _BufferingStreamSubscription<T> implements StreamSubscription<T>, _EventS ink<T>, _EventDispatch<T> {static const int _STATE_CANCEL_ON_ERROR = 1; 10 class _BufferingStreamSubscription<T> implements StreamSubscription<T>, _EventS ink<T>, _EventDispatch<T> {static const int _STATE_CANCEL_ON_ERROR = 1;
(...skipping 24 matching lines...) Expand all
35 _pending.schedule(this); 35 _pending.schedule(this);
36 } 36 }
37 } 37 }
38 _PendingEvents _extractPending() { 38 _PendingEvents _extractPending() {
39 assert (_isCanceled); _PendingEvents events = _pending; 39 assert (_isCanceled); _PendingEvents events = _pending;
40 _pending = null; 40 _pending = null;
41 return events; 41 return events;
42 } 42 }
43 void onData(void handleData(T event)) { 43 void onData(void handleData(T event)) {
44 if (handleData == null) handleData = _nullDataHandler; 44 if (handleData == null) handleData = _nullDataHandler;
45 _onData = _zone.registerUnaryCallback(DDC$RT.wrap((void f(T __u118)) { 45 _onData = _zone.registerUnaryCallback(DEVC$RT.wrap((void f(T __u118)) {
46 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 154, column 4 3 of dart:async/stream_impl.dart: """, x0 is T, false)); 46 void c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 154, column 43 of dart:async/stream_impl.dart: """, x0 is T, false));
47 return f == null ? null : c; 47 return f == null ? null : c;
48 } 48 }
49 , handleData, DDC$RT.type((__t121<T> _) { 49 , handleData, DEVC$RT.type((__t121<T> _) {
50 } 50 }
51 ), __t119, "Wrap", """line 154, column 43 of dart:async/stream_impl.dart: """, h andleData is __t119)); 51 ), __t119, "Wrap", """line 154, column 43 of dart:async/stream_impl.dart: """, h andleData is __t119));
52 } 52 }
53 void onError(Function handleError) { 53 void onError(Function handleError) {
54 if (handleError == null) handleError = _nullErrorHandler; 54 if (handleError == null) handleError = _nullErrorHandler;
55 _onError = _registerErrorHandler(handleError, _zone); 55 _onError = _registerErrorHandler(handleError, _zone);
56 } 56 }
57 void onDone(void handleDone()) { 57 void onDone(void handleDone()) {
58 if (handleDone == null) handleDone = _nullDoneHandler; 58 if (handleDone == null) handleDone = _nullDoneHandler;
59 _onDone = _zone.registerCallback(handleDone); 59 _onDone = _zone.registerCallback(handleDone);
(...skipping 27 matching lines...) Expand all
87 return _cancelFuture; 87 return _cancelFuture;
88 } 88 }
89 Future asFuture([var futureValue]) { 89 Future asFuture([var futureValue]) {
90 _Future<T> result = new _Future<T>(); 90 _Future<T> result = new _Future<T>();
91 _onDone = () { 91 _onDone = () {
92 result._complete(futureValue); 92 result._complete(futureValue);
93 } 93 }
94 ; 94 ;
95 _onError = (error, stackTrace) { 95 _onError = (error, stackTrace) {
96 cancel(); 96 cancel();
97 result._completeError(error, DDC$RT.cast(stackTrace, dynamic, StackTrace, "Cast General", """line 212, column 36 of dart:async/stream_impl.dart: """, stackTrace is StackTrace, true)); 97 result._completeError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "Cas tGeneral", """line 212, column 36 of dart:async/stream_impl.dart: """, stackTrac e is StackTrace, true));
98 } 98 }
99 ; 99 ;
100 return result; 100 return result;
101 } 101 }
102 bool get _isInputPaused => (_state & _STATE_INPUT_PAUSED) != 0; 102 bool get _isInputPaused => (_state & _STATE_INPUT_PAUSED) != 0;
103 bool get _isClosed => (_state & _STATE_CLOSED) != 0; 103 bool get _isClosed => (_state & _STATE_CLOSED) != 0;
104 bool get _isCanceled => (_state & _STATE_CANCELED) != 0; 104 bool get _isCanceled => (_state & _STATE_CANCELED) != 0;
105 bool get _waitsForCancel => (_state & _STATE_WAIT_FOR_CANCEL) != 0; 105 bool get _waitsForCancel => (_state & _STATE_WAIT_FOR_CANCEL) != 0;
106 bool get _inCallback => (_state & _STATE_IN_CALLBACK) != 0; 106 bool get _inCallback => (_state & _STATE_IN_CALLBACK) != 0;
107 bool get _hasPending => (_state & _STATE_HAS_PENDING) != 0; 107 bool get _hasPending => (_state & _STATE_HAS_PENDING) != 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 } 151 }
152 void _onPause() { 152 void _onPause() {
153 assert (_isInputPaused);} 153 assert (_isInputPaused);}
154 void _onResume() { 154 void _onResume() {
155 assert (!_isInputPaused);} 155 assert (!_isInputPaused);}
156 Future _onCancel() { 156 Future _onCancel() {
157 assert (_isCanceled); return null; 157 assert (_isCanceled); return null;
158 } 158 }
159 void _addPending(_DelayedEvent event) { 159 void _addPending(_DelayedEvent event) {
160 _StreamImplEvents pending = DDC$RT.cast(_pending, _PendingEvents, _StreamImplEve nts, "CastGeneral", """line 322, column 33 of dart:async/stream_impl.dart: """, _pending is _StreamImplEvents, true); 160 _StreamImplEvents pending = DEVC$RT.cast(_pending, _PendingEvents, _StreamImplEv ents, "CastGeneral", """line 322, column 33 of dart:async/stream_impl.dart: """, _pending is _StreamImplEvents, true);
161 if (_pending == null) pending = _pending = new _StreamImplEvents(); 161 if (_pending == null) pending = _pending = new _StreamImplEvents();
162 pending.add(event); 162 pending.add(event);
163 if (!_hasPending) { 163 if (!_hasPending) {
164 _state |= _STATE_HAS_PENDING; 164 _state |= _STATE_HAS_PENDING;
165 if (!_isPaused) { 165 if (!_isPaused) {
166 _pending.schedule(this); 166 _pending.schedule(this);
167 } 167 }
168 } 168 }
169 } 169 }
170 void _sendData(T data) { 170 void _sendData(T data) {
171 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput Paused = _isInputPaused; 171 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput Paused = _isInputPaused;
172 _state |= _STATE_IN_CALLBACK; 172 _state |= _STATE_IN_CALLBACK;
173 _zone.runUnaryGuarded(DDC$RT.wrap((void f(T __u123)) { 173 _zone.runUnaryGuarded(DEVC$RT.wrap((void f(T __u123)) {
174 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 341, column 2 7 of dart:async/stream_impl.dart: """, x0 is T, false)); 174 void c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 341, column 27 of dart:async/stream_impl.dart: """, x0 is T, false));
175 return f == null ? null : c; 175 return f == null ? null : c;
176 } 176 }
177 , _onData, DDC$RT.type((__t121<T> _) { 177 , _onData, DEVC$RT.type((__t121<T> _) {
178 } 178 }
179 ), __t119, "Wrap", """line 341, column 27 of dart:async/stream_impl.dart: """, _ onData is __t119), data); 179 ), __t119, "Wrap", """line 341, column 27 of dart:async/stream_impl.dart: """, _ onData is __t119), data);
180 _state &= ~_STATE_IN_CALLBACK; 180 _state &= ~_STATE_IN_CALLBACK;
181 _checkState(wasInputPaused); 181 _checkState(wasInputPaused);
182 } 182 }
183 void _sendError(var error, StackTrace stackTrace) { 183 void _sendError(var error, StackTrace stackTrace) {
184 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput Paused = _isInputPaused; 184 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput Paused = _isInputPaused;
185 void sendError() { 185 void sendError() {
186 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; 186 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK;
187 if (_onError is ZoneBinaryCallback) { 187 if (_onError is ZoneBinaryCallback) {
188 _zone.runBinaryGuarded(DDC$RT.cast(_onError, Function, __t124, "CastGeneral", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __t124, false), error, stackTrace); 188 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __t124, "CastGeneral", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __t124, false), error, stackTrace);
189 } 189 }
190 else { 190 else {
191 _zone.runUnaryGuarded(DDC$RT.cast(_onError, Function, __t119, "CastGeneral", " ""line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __t119, f alse), error); 191 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __t119, "CastGeneral", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __t119, false), error);
192 } 192 }
193 _state &= ~_STATE_IN_CALLBACK; 193 _state &= ~_STATE_IN_CALLBACK;
194 } 194 }
195 if (_cancelOnError) { 195 if (_cancelOnError) {
196 _state |= _STATE_WAIT_FOR_CANCEL; 196 _state |= _STATE_WAIT_FOR_CANCEL;
197 _cancel(); 197 _cancel();
198 if (_cancelFuture is Future) { 198 if (_cancelFuture is Future) {
199 _cancelFuture.whenComplete(sendError); 199 _cancelFuture.whenComplete(sendError);
200 } 200 }
201 else { 201 else {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 _pending.schedule(this); 256 _pending.schedule(this);
257 } 257 }
258 } 258 }
259 } 259 }
260 abstract class _StreamImpl<T> extends Stream<T> {StreamSubscription<T> listen(v oid onData(T data), { 260 abstract class _StreamImpl<T> extends Stream<T> {StreamSubscription<T> listen(v oid onData(T data), {
261 Function onError, void onDone(), bool cancelOnError} 261 Function onError, void onDone(), bool cancelOnError}
262 ) { 262 ) {
263 cancelOnError = identical(true, cancelOnError); 263 cancelOnError = identical(true, cancelOnError);
264 StreamSubscription subscription = _createSubscription(onData, onError, onDone, cancelOnError); 264 StreamSubscription subscription = _createSubscription(onData, onError, onDone, cancelOnError);
265 _onListen(subscription); 265 _onListen(subscription);
266 return DDC$RT.cast(subscription, DDC$RT.type((StreamSubscription<dynamic> _) { 266 return DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynamic> _) {
267 } 267 }
268 ), DDC$RT.type((StreamSubscription<T> _) { 268 ), DEVC$RT.type((StreamSubscription<T> _) {
269 } 269 }
270 ), "CastDynamic", """line 476, column 12 of dart:async/stream_impl.dart: """, su bscription is StreamSubscription<T>, false); 270 ), "CastDynamic", """line 476, column 12 of dart:async/stream_impl.dart: """, su bscription is StreamSubscription<T>, false);
271 } 271 }
272 _BufferingStreamSubscription<T> _createSubscription(void onData(T data), Functi on onError, void onDone(), bool cancelOnError) { 272 _BufferingStreamSubscription<T> _createSubscription(void onData(T data), Functi on onError, void onDone(), bool cancelOnError) {
273 return new _BufferingStreamSubscription<T>(onData, onError, onDone, cancelOnErro r); 273 return new _BufferingStreamSubscription<T>(onData, onError, onDone, cancelOnErro r);
274 } 274 }
275 void _onListen(StreamSubscription subscription) { 275 void _onListen(StreamSubscription subscription) {
276 } 276 }
277 } 277 }
278 typedef _PendingEvents _EventGenerator(); 278 typedef _PendingEvents _EventGenerator();
279 class _GeneratedStreamImpl<T> extends _StreamImpl<T> {final _EventGenerator _pe nding; 279 class _GeneratedStreamImpl<T> extends _StreamImpl<T> {final _EventGenerator _pe nding;
280 bool _isUsed = false; 280 bool _isUsed = false;
281 _GeneratedStreamImpl(this._pending); 281 _GeneratedStreamImpl(this._pending);
282 StreamSubscription _createSubscription(void onData(T data), Function onError, v oid onDone(), bool cancelOnError) { 282 StreamSubscription _createSubscription(void onData(T data), Function onError, v oid onDone(), bool cancelOnError) {
283 if (_isUsed) throw new StateError("Stream has already been listened to."); 283 if (_isUsed) throw new StateError("Stream has already been listened to.");
284 _isUsed = true; 284 _isUsed = true;
285 return new _BufferingStreamSubscription(DDC$RT.wrap((void f(T __u127)) { 285 return new _BufferingStreamSubscription(DEVC$RT.wrap((void f(T __u127)) {
286 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 516, column 9 of dart:async/stream_impl.dart: """, x0 is T, false)); 286 void c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 516, column 9 of dart:async/stream_impl.dart: """, x0 is T, false));
287 return f == null ? null : c; 287 return f == null ? null : c;
288 } 288 }
289 , onData, DDC$RT.type((__t130<T> _) { 289 , onData, DEVC$RT.type((__t130<T> _) {
290 } 290 }
291 ), __t128, "Wrap", """line 516, column 9 of dart:async/stream_impl.dart: """, on Data is __t128), onError, onDone, cancelOnError).._setPendingEvents(_pending()); 291 ), __t128, "Wrap", """line 516, column 9 of dart:async/stream_impl.dart: """, on Data is __t128), onError, onDone, cancelOnError).._setPendingEvents(_pending());
292 } 292 }
293 } 293 }
294 class _IterablePendingEvents<T> extends _PendingEvents {Iterator<T> _iterator; 294 class _IterablePendingEvents<T> extends _PendingEvents {Iterator<T> _iterator;
295 _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator; 295 _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator;
296 bool get isEmpty => _iterator == null; 296 bool get isEmpty => _iterator == null;
297 void handleNext(_EventDispatch dispatch) { 297 void handleNext(_EventDispatch dispatch) {
298 if (_iterator == null) { 298 if (_iterator == null) {
299 throw new StateError("No events pending."); 299 throw new StateError("No events pending.");
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (isPaused) return; _state |= _DONE_SENT; 467 if (isPaused) return; _state |= _DONE_SENT;
468 if (_onDone != null) _zone.runGuarded(_onDone); 468 if (_onDone != null) _zone.runGuarded(_onDone);
469 } 469 }
470 } 470 }
471 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source; 471 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source;
472 final _broadcastCallback _onListenHandler; 472 final _broadcastCallback _onListenHandler;
473 final _broadcastCallback _onCancelHandler; 473 final _broadcastCallback _onCancelHandler;
474 final Zone _zone; 474 final Zone _zone;
475 _AsBroadcastStreamController<T> _controller; 475 _AsBroadcastStreamController<T> _controller;
476 StreamSubscription<T> _subscription; 476 StreamSubscription<T> _subscription;
477 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl er = Zone.current.registerUnaryCallback(DDC$RT.wrap((void f(StreamSubscription<d ynamic> __u132)) { 477 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl er = Zone.current.registerUnaryCallback(DEVC$RT.wrap((void f(StreamSubscription< dynamic> __u132)) {
478 void c(StreamSubscription<dynamic> x0) => f(DDC$RT.cast(x0, dynamic, DDC$RT.type ((StreamSubscription<dynamic> _) { 478 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty pe((StreamSubscription<dynamic> _) {
479 } 479 }
480 ), "CastParam", """line 813, column 63 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true)); 480 ), "CastParam", """line 813, column 63 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true));
481 return f == null ? null : c; 481 return f == null ? null : c;
482 } 482 }
483 , onListenHandler, __t133, __t119, "Wrap", """line 813, column 63 of dart:async/ stream_impl.dart: """, onListenHandler is __t119)), _onCancelHandler = Zone.curr ent.registerUnaryCallback(DDC$RT.wrap((void f(StreamSubscription<dynamic> __u135 )) { 483 , onListenHandler, __t133, __t119, "Wrap", """line 813, column 63 of dart:async/ stream_impl.dart: """, onListenHandler is __t119)), _onCancelHandler = Zone.curr ent.registerUnaryCallback(DEVC$RT.wrap((void f(StreamSubscription<dynamic> __u13 5)) {
484 void c(StreamSubscription<dynamic> x0) => f(DDC$RT.cast(x0, dynamic, DDC$RT.type ((StreamSubscription<dynamic> _) { 484 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty pe((StreamSubscription<dynamic> _) {
485 } 485 }
486 ), "CastParam", """line 814, column 63 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true)); 486 ), "CastParam", """line 814, column 63 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true));
487 return f == null ? null : c; 487 return f == null ? null : c;
488 } 488 }
489 , onCancelHandler, __t133, __t119, "Wrap", """line 814, column 63 of dart:async/ stream_impl.dart: """, onCancelHandler is __t119)), _zone = Zone.current { 489 , onCancelHandler, __t133, __t119, "Wrap", """line 814, column 63 of dart:async/ stream_impl.dart: """, onCancelHandler is __t119)), _zone = Zone.current {
490 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel); 490 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel);
491 } 491 }
492 bool get isBroadcast => true; 492 bool get isBroadcast => true;
493 StreamSubscription<T> listen(void onData(T data), { 493 StreamSubscription<T> listen(void onData(T data), {
494 Function onError, void onDone(), bool cancelOnError} 494 Function onError, void onDone(), bool cancelOnError}
495 ) { 495 ) {
496 if (_controller == null || _controller.isClosed) { 496 if (_controller == null || _controller.isClosed) {
497 return new _DoneStreamSubscription<T>(onDone); 497 return new _DoneStreamSubscription<T>(onDone);
498 } 498 }
499 if (_subscription == null) { 499 if (_subscription == null) {
500 _subscription = _source.listen(_controller.add, onError: _controller.addError, o nDone: _controller.close); 500 _subscription = _source.listen(_controller.add, onError: _controller.addError, o nDone: _controller.close);
501 } 501 }
502 cancelOnError = identical(true, cancelOnError); 502 cancelOnError = identical(true, cancelOnError);
503 return _controller._subscribe(onData, onError, onDone, cancelOnError); 503 return _controller._subscribe(onData, onError, onDone, cancelOnError);
504 } 504 }
505 void _onCancel() { 505 void _onCancel() {
506 bool shutdown = (_controller == null) || _controller.isClosed; 506 bool shutdown = (_controller == null) || _controller.isClosed;
507 if (_onCancelHandler != null) { 507 if (_onCancelHandler != null) {
508 _zone.runUnary(DDC$RT.wrap((void f(StreamSubscription<dynamic> __u136)) { 508 _zone.runUnary(DEVC$RT.wrap((void f(StreamSubscription<dynamic> __u136)) {
509 void c(StreamSubscription<dynamic> x0) => f(DDC$RT.cast(x0, dynamic, DDC$RT.type ((StreamSubscription<dynamic> _) { 509 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty pe((StreamSubscription<dynamic> _) {
510 } 510 }
511 ), "CastParam", """line 842, column 22 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true)); 511 ), "CastParam", """line 842, column 22 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true));
512 return f == null ? null : c; 512 return f == null ? null : c;
513 } 513 }
514 , _onCancelHandler, __t133, __t119, "Wrap", """line 842, column 22 of dart:async /stream_impl.dart: """, _onCancelHandler is __t119), new _BroadcastSubscriptionW rapper(this)); 514 , _onCancelHandler, __t133, __t119, "Wrap", """line 842, column 22 of dart:async /stream_impl.dart: """, _onCancelHandler is __t119), new _BroadcastSubscriptionW rapper(this));
515 } 515 }
516 if (shutdown) { 516 if (shutdown) {
517 if (_subscription != null) { 517 if (_subscription != null) {
518 _subscription.cancel(); 518 _subscription.cancel();
519 _subscription = null; 519 _subscription = null;
520 } 520 }
521 } 521 }
522 } 522 }
523 void _onListen() { 523 void _onListen() {
524 if (_onListenHandler != null) { 524 if (_onListenHandler != null) {
525 _zone.runUnary(DDC$RT.wrap((void f(StreamSubscription<dynamic> __u137)) { 525 _zone.runUnary(DEVC$RT.wrap((void f(StreamSubscription<dynamic> __u137)) {
526 void c(StreamSubscription<dynamic> x0) => f(DDC$RT.cast(x0, dynamic, DDC$RT.type ((StreamSubscription<dynamic> _) { 526 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty pe((StreamSubscription<dynamic> _) {
527 } 527 }
528 ), "CastParam", """line 854, column 22 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true)); 528 ), "CastParam", """line 854, column 22 of dart:async/stream_impl.dart: """, x0 i s StreamSubscription<dynamic>, true));
529 return f == null ? null : c; 529 return f == null ? null : c;
530 } 530 }
531 , _onListenHandler, __t133, __t119, "Wrap", """line 854, column 22 of dart:async /stream_impl.dart: """, _onListenHandler is __t119), new _BroadcastSubscriptionW rapper(this)); 531 , _onListenHandler, __t133, __t119, "Wrap", """line 854, column 22 of dart:async /stream_impl.dart: """, _onListenHandler is __t119), new _BroadcastSubscriptionW rapper(this));
532 } 532 }
533 } 533 }
534 void _cancelSubscription() { 534 void _cancelSubscription() {
535 if (_subscription == null) return; StreamSubscription subscription = _subscripti on; 535 if (_subscription == null) return; StreamSubscription subscription = _subscripti on;
536 _subscription = null; 536 _subscription = null;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 if (_state == _STATE_DONE) { 594 if (_state == _STATE_DONE) {
595 return new _Future<bool>.immediate(false); 595 return new _Future<bool>.immediate(false);
596 } 596 }
597 if (_state == _STATE_MOVING) { 597 if (_state == _STATE_MOVING) {
598 throw new StateError("Already waiting for next."); 598 throw new StateError("Already waiting for next.");
599 } 599 }
600 if (_state == _STATE_FOUND) { 600 if (_state == _STATE_FOUND) {
601 _state = _STATE_MOVING; 601 _state = _STATE_MOVING;
602 _current = null; 602 _current = null;
603 _futureOrPrefetch = new _Future<bool>(); 603 _futureOrPrefetch = new _Future<bool>();
604 return DDC$RT.cast(_futureOrPrefetch, dynamic, DDC$RT.type((Future<bool> _) { 604 return DEVC$RT.cast(_futureOrPrefetch, dynamic, DEVC$RT.type((Future<bool> _) {
605 } 605 }
606 ), "CastGeneral", """line 1000, column 14 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is Future<bool>, false); 606 ), "CastGeneral", """line 1000, column 14 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is Future<bool>, false);
607 } 607 }
608 else { 608 else {
609 assert (_state >= _STATE_EXTRA_DATA); switch (_state) {case _STATE_EXTRA_DATA: _ state = _STATE_FOUND; 609 assert (_state >= _STATE_EXTRA_DATA); switch (_state) {case _STATE_EXTRA_DATA: _ state = _STATE_FOUND;
610 _current = DDC$RT.cast(_futureOrPrefetch, dynamic, T, "CastGeneral", """line 10 06, column 22 of dart:async/stream_impl.dart: """, _futureOrPrefetch is T, false ); 610 _current = DEVC$RT.cast(_futureOrPrefetch, dynamic, T, "CastGeneral", """line 1 006, column 22 of dart:async/stream_impl.dart: """, _futureOrPrefetch is T, fals e);
611 _futureOrPrefetch = null; 611 _futureOrPrefetch = null;
612 _subscription.resume(); 612 _subscription.resume();
613 return new _Future<bool>.immediate(true); 613 return new _Future<bool>.immediate(true);
614 case _STATE_EXTRA_ERROR: AsyncError prefetch = DDC$RT.cast(_futureOrPrefetch, d ynamic, AsyncError, "CastGeneral", """line 1011, column 33 of dart:async/stream_ impl.dart: """, _futureOrPrefetch is AsyncError, true); 614 case _STATE_EXTRA_ERROR: AsyncError prefetch = DEVC$RT.cast(_futureOrPrefetch, dynamic, AsyncError, "CastGeneral", """line 1011, column 33 of dart:async/stream _impl.dart: """, _futureOrPrefetch is AsyncError, true);
615 _clear(); 615 _clear();
616 return new _Future<bool>.immediateError(prefetch.error, prefetch.stackTrace); 616 return new _Future<bool>.immediateError(prefetch.error, prefetch.stackTrace);
617 case _STATE_EXTRA_DONE: _clear(); 617 case _STATE_EXTRA_DONE: _clear();
618 return new _Future<bool>.immediate(false); 618 return new _Future<bool>.immediate(false);
619 } 619 }
620 } 620 }
621 } 621 }
622 void _clear() { 622 void _clear() {
623 _subscription = null; 623 _subscription = null;
624 _futureOrPrefetch = null; 624 _futureOrPrefetch = null;
625 _current = null; 625 _current = null;
626 _state = _STATE_DONE; 626 _state = _STATE_DONE;
627 } 627 }
628 Future cancel() { 628 Future cancel() {
629 StreamSubscription subscription = _subscription; 629 StreamSubscription subscription = _subscription;
630 if (_state == _STATE_MOVING) { 630 if (_state == _STATE_MOVING) {
631 _Future<bool> hasNext = DDC$RT.cast(_futureOrPrefetch, dynamic, DDC$RT.type((_Fu ture<bool> _) { 631 _Future<bool> hasNext = DEVC$RT.cast(_futureOrPrefetch, dynamic, DEVC$RT.type((_ Future<bool> _) {
632 } 632 }
633 ), "CastGeneral", """line 1033, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false); 633 ), "CastGeneral", """line 1033, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false);
634 _clear(); 634 _clear();
635 hasNext._complete(false); 635 hasNext._complete(false);
636 } 636 }
637 else { 637 else {
638 _clear(); 638 _clear();
639 } 639 }
640 return subscription.cancel(); 640 return subscription.cancel();
641 } 641 }
642 void _onData(T data) { 642 void _onData(T data) {
643 if (_state == _STATE_MOVING) { 643 if (_state == _STATE_MOVING) {
644 _current = data; 644 _current = data;
645 _Future<bool> hasNext = DDC$RT.cast(_futureOrPrefetch, dynamic, DDC$RT.type((_F uture<bool> _) { 645 _Future<bool> hasNext = DEVC$RT.cast(_futureOrPrefetch, dynamic, DEVC$RT.type(( _Future<bool> _) {
646 } 646 }
647 ), "CastGeneral", """line 1045, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false); 647 ), "CastGeneral", """line 1045, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false);
648 _futureOrPrefetch = null; 648 _futureOrPrefetch = null;
649 _state = _STATE_FOUND; 649 _state = _STATE_FOUND;
650 hasNext._complete(true); 650 hasNext._complete(true);
651 return;} 651 return;}
652 _subscription.pause(); 652 _subscription.pause();
653 assert (_futureOrPrefetch == null); _futureOrPrefetch = data; 653 assert (_futureOrPrefetch == null); _futureOrPrefetch = data;
654 _state = _STATE_EXTRA_DATA; 654 _state = _STATE_EXTRA_DATA;
655 } 655 }
656 void _onError(Object error, [StackTrace stackTrace]) { 656 void _onError(Object error, [StackTrace stackTrace]) {
657 if (_state == _STATE_MOVING) { 657 if (_state == _STATE_MOVING) {
658 _Future<bool> hasNext = DDC$RT.cast(_futureOrPrefetch, dynamic, DDC$RT.type((_Fu ture<bool> _) { 658 _Future<bool> hasNext = DEVC$RT.cast(_futureOrPrefetch, dynamic, DEVC$RT.type((_ Future<bool> _) {
659 } 659 }
660 ), "CastGeneral", """line 1059, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false); 660 ), "CastGeneral", """line 1059, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false);
661 _clear(); 661 _clear();
662 hasNext._completeError(error, stackTrace); 662 hasNext._completeError(error, stackTrace);
663 return;} 663 return;}
664 _subscription.pause(); 664 _subscription.pause();
665 assert (_futureOrPrefetch == null); _futureOrPrefetch = new AsyncError(error, s tackTrace); 665 assert (_futureOrPrefetch == null); _futureOrPrefetch = new AsyncError(error, s tackTrace);
666 _state = _STATE_EXTRA_ERROR; 666 _state = _STATE_EXTRA_ERROR;
667 } 667 }
668 void _onDone() { 668 void _onDone() {
669 if (_state == _STATE_MOVING) { 669 if (_state == _STATE_MOVING) {
670 _Future<bool> hasNext = DDC$RT.cast(_futureOrPrefetch, dynamic, DDC$RT.type((_Fu ture<bool> _) { 670 _Future<bool> hasNext = DEVC$RT.cast(_futureOrPrefetch, dynamic, DEVC$RT.type((_ Future<bool> _) {
671 } 671 }
672 ), "CastGeneral", """line 1073, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false); 672 ), "CastGeneral", """line 1073, column 31 of dart:async/stream_impl.dart: """, _ futureOrPrefetch is _Future<bool>, false);
673 _clear(); 673 _clear();
674 hasNext._complete(false); 674 hasNext._complete(false);
675 return;} 675 return;}
676 _subscription.pause(); 676 _subscription.pause();
677 _futureOrPrefetch = null; 677 _futureOrPrefetch = null;
678 _state = _STATE_EXTRA_DONE; 678 _state = _STATE_EXTRA_DONE;
679 } 679 }
680 } 680 }
681 typedef dynamic __t119(dynamic __u120); 681 typedef dynamic __t119(dynamic __u120);
682 typedef void __t121<T>(T __u122); 682 typedef void __t121<T>(T __u122);
683 typedef dynamic __t124(dynamic __u125, dynamic __u126); 683 typedef dynamic __t124(dynamic __u125, dynamic __u126);
684 typedef void __t128(dynamic __u129); 684 typedef void __t128(dynamic __u129);
685 typedef void __t130<T>(T __u131); 685 typedef void __t130<T>(T __u131);
686 typedef void __t133(StreamSubscription<dynamic> __u134); 686 typedef void __t133(StreamSubscription<dynamic> __u134);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/stream_controller.dart ('k') | test/dart_codegen/expect/async/stream_pipe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698