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

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

Issue 1070453002: Refactor reifier to make it less dart_codegen specific. (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Address comments, rebase Created 5 years, 8 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 23 matching lines...) Expand all
34 _state |= _STATE_HAS_PENDING; 34 _state |= _STATE_HAS_PENDING;
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 = DEVC$RT.cast(_nullDataHandler, __t57, DEVC$ RT.type((__t55<T> _) { 44 if (handleData == null) handleData = DEVC$RT.cast(_nullDataHandler, __t51, DEVC$ RT.type((__t49<T> _) {
45 } 45 }
46 ), "CompositeCast", """line 153, column 42 of dart:async/stream_impl.dart: """, _nullDataHandler is __t55<T>, false); 46 ), "CompositeCast", """line 153, column 42 of dart:async/stream_impl.dart: """, _nullDataHandler is __t49<T>, false);
47 _onData = ((__x61) => DEVC$RT.cast(__x61, __t59, DEVC$RT.type((__t55<T> _) { 47 _onData = ((__x53) => DEVC$RT.cast(__x53, ZoneUnaryCallback, DEVC$RT.type((_Dat aHandler<T> _) {
48 } 48 }
49 ), "CompositeCast", """line 154, column 15 of dart:async/stream_impl.dart: """, __x61 is __t55<T>, false))(_zone.registerUnaryCallback(handleData)); 49 ), "CompositeCast", """line 154, column 15 of dart:async/stream_impl.dart: """, __x53 is _DataHandler<T>, false))(_zone.registerUnaryCallback(handleData));
50 } 50 }
51 void onError(Function handleError) { 51 void onError(Function handleError) {
52 if (handleError == null) handleError = _nullErrorHandler; 52 if (handleError == null) handleError = _nullErrorHandler;
53 _onError = _registerErrorHandler(handleError, _zone); 53 _onError = _registerErrorHandler(handleError, _zone);
54 } 54 }
55 void onDone(void handleDone()) { 55 void onDone(void handleDone()) {
56 if (handleDone == null) handleDone = _nullDoneHandler; 56 if (handleDone == null) handleDone = _nullDoneHandler;
57 _onDone = _zone.registerCallback(handleDone); 57 _onDone = _zone.registerCallback(handleDone);
58 } 58 }
59 void pause([Future resumeSignal]) { 59 void pause([Future resumeSignal]) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 _state |= _STATE_IN_CALLBACK; 170 _state |= _STATE_IN_CALLBACK;
171 _zone.runUnaryGuarded(_onData, data); 171 _zone.runUnaryGuarded(_onData, data);
172 _state &= ~_STATE_IN_CALLBACK; 172 _state &= ~_STATE_IN_CALLBACK;
173 _checkState(wasInputPaused); 173 _checkState(wasInputPaused);
174 } 174 }
175 void _sendError(var error, StackTrace stackTrace) { 175 void _sendError(var error, StackTrace stackTrace) {
176 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput Paused = _isInputPaused; 176 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput Paused = _isInputPaused;
177 void sendError() { 177 void sendError() {
178 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; 178 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK;
179 if (_onError is ZoneBinaryCallback) { 179 if (_onError is ZoneBinaryCallback) {
180 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __t62, "ImplicitCast", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __t62, true), error, stackTrace); 180 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __t54, "ImplicitCast", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __t54, true), error, stackTrace);
181 } 181 }
182 else { 182 else {
183 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __t59, "ImplicitCast", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __t59, t rue), error); 183 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __t57, "ImplicitCast", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __t57, t rue), error);
184 } 184 }
185 _state &= ~_STATE_IN_CALLBACK; 185 _state &= ~_STATE_IN_CALLBACK;
186 } 186 }
187 if (_cancelOnError) { 187 if (_cancelOnError) {
188 _state |= _STATE_WAIT_FOR_CANCEL; 188 _state |= _STATE_WAIT_FOR_CANCEL;
189 _cancel(); 189 _cancel();
190 if (_cancelFuture is Future) { 190 if (_cancelFuture is Future) {
191 _cancelFuture.whenComplete(sendError); 191 _cancelFuture.whenComplete(sendError);
192 } 192 }
193 else { 193 else {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if (isPaused) return; _state |= _DONE_SENT; 453 if (isPaused) return; _state |= _DONE_SENT;
454 if (_onDone != null) _zone.runGuarded(_onDone); 454 if (_onDone != null) _zone.runGuarded(_onDone);
455 } 455 }
456 } 456 }
457 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source; 457 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source;
458 final _broadcastCallback _onListenHandler; 458 final _broadcastCallback _onListenHandler;
459 final _broadcastCallback _onCancelHandler; 459 final _broadcastCallback _onCancelHandler;
460 final Zone _zone; 460 final Zone _zone;
461 _AsBroadcastStreamController<T> _controller; 461 _AsBroadcastStreamController<T> _controller;
462 StreamSubscription<T> _subscription; 462 StreamSubscription<T> _subscription;
463 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl er = ((__x67) => DEVC$RT.cast(__x67, __t59, __t65, "CompositeCast", """line 813, column 28 of dart:async/stream_impl.dart: """, __x67 is __t65, false))(Zone.cur rent.registerUnaryCallback(onListenHandler)), _onCancelHandler = ((__x68) => DEV C$RT.cast(__x68, __t59, __t65, "CompositeCast", """line 814, column 28 of dart:a sync/stream_impl.dart: """, __x68 is __t65, false))(Zone.current.registerUnaryCa llback(onCancelHandler)), _zone = Zone.current { 463 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl er = ((__x59) => DEVC$RT.cast(__x59, ZoneUnaryCallback, _broadcastCallback, "Com positeCast", """line 813, column 28 of dart:async/stream_impl.dart: """, __x59 i s _broadcastCallback, false))(Zone.current.registerUnaryCallback(onListenHandler )), _onCancelHandler = ((__x60) => DEVC$RT.cast(__x60, ZoneUnaryCallback, _broad castCallback, "CompositeCast", """line 814, column 28 of dart:async/stream_impl. dart: """, __x60 is _broadcastCallback, false))(Zone.current.registerUnaryCallba ck(onCancelHandler)), _zone = Zone.current {
464 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel); 464 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel);
465 } 465 }
466 bool get isBroadcast => true; 466 bool get isBroadcast => true;
467 StreamSubscription<T> listen(void onData(T data), { 467 StreamSubscription<T> listen(void onData(T data), {
468 Function onError, void onDone(), bool cancelOnError} 468 Function onError, void onDone(), bool cancelOnError}
469 ) { 469 ) {
470 if (_controller == null || _controller.isClosed) { 470 if (_controller == null || _controller.isClosed) {
471 return new _DoneStreamSubscription<T>(onDone); 471 return new _DoneStreamSubscription<T>(onDone);
472 } 472 }
473 if (_subscription == null) { 473 if (_subscription == null) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 633 }
634 ), "CompositeCast", """line 1073, column 31 of dart:async/stream_impl.dart: """, _futureOrPrefetch is _Future<bool>, false); 634 ), "CompositeCast", """line 1073, column 31 of dart:async/stream_impl.dart: """, _futureOrPrefetch is _Future<bool>, false);
635 _clear(); 635 _clear();
636 hasNext._complete(false); 636 hasNext._complete(false);
637 return;} 637 return;}
638 _subscription.pause(); 638 _subscription.pause();
639 _futureOrPrefetch = null; 639 _futureOrPrefetch = null;
640 _state = _STATE_EXTRA_DONE; 640 _state = _STATE_EXTRA_DONE;
641 } 641 }
642 } 642 }
643 typedef void __t55<T>(T __u56); 643 typedef void __t49<T>(T __u50);
644 typedef void __t57(dynamic __u58); 644 typedef void __t51(dynamic __u52);
645 typedef dynamic __t59(dynamic __u60); 645 typedef dynamic __t54(dynamic __u55, dynamic __u56);
646 typedef dynamic __t62(dynamic __u63, dynamic __u64); 646 typedef dynamic __t57(dynamic __u58);
647 typedef void __t65(StreamSubscription<dynamic> __u66);
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