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

Side by Side Diff: test/dart_codegen/expect/async/broadcast_stream_controller.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 class _BroadcastStream<T> extends _ControllerStream<T> {_BroadcastStream(_Strea mControllerLifecycle controller) : super(DDC$RT.cast(controller, DDC$RT.type((_S treamControllerLifecycle<dynamic> _) { 2 class _BroadcastStream<T> extends _ControllerStream<T> {_BroadcastStream(_Strea mControllerLifecycle controller) : super(DEVC$RT.cast(controller, DEVC$RT.type(( _StreamControllerLifecycle<dynamic> _) {
3 } 3 }
4 ), DDC$RT.type((_StreamControllerLifecycle<T> _) { 4 ), DEVC$RT.type((_StreamControllerLifecycle<T> _) {
5 } 5 }
6 ), "CastDynamic", """line 8, column 67 of dart:async/broadcast_stream_controller .dart: """, controller is _StreamControllerLifecycle<T>, false)); 6 ), "CastDynamic", """line 8, column 67 of dart:async/broadcast_stream_controller .dart: """, controller is _StreamControllerLifecycle<T>, false));
7 bool get isBroadcast => true; 7 bool get isBroadcast => true;
8 } 8 }
9 abstract class _BroadcastSubscriptionLink {_BroadcastSubscriptionLink _next; 9 abstract class _BroadcastSubscriptionLink {_BroadcastSubscriptionLink _next;
10 _BroadcastSubscriptionLink _previous; 10 _BroadcastSubscriptionLink _previous;
11 } 11 }
12 class _BroadcastSubscription<T> extends _ControllerSubscription<T> implements _ BroadcastSubscriptionLink {static const int _STATE_EVENT_ID = 1; 12 class _BroadcastSubscription<T> extends _ControllerSubscription<T> implements _ BroadcastSubscriptionLink {static const int _STATE_EVENT_ID = 1;
13 static const int _STATE_FIRING = 2; 13 static const int _STATE_FIRING = 2;
14 static const int _STATE_REMOVE_AFTER_FIRING = 4; 14 static const int _STATE_REMOVE_AFTER_FIRING = 4;
15 int _eventState; 15 int _eventState;
16 _BroadcastSubscriptionLink _next; 16 _BroadcastSubscriptionLink _next;
17 _BroadcastSubscriptionLink _previous; 17 _BroadcastSubscriptionLink _previous;
18 _BroadcastSubscription(_StreamControllerLifecycle controller, void onData(T dat a), Function onError, void onDone(), bool cancelOnError) : super(DDC$RT.cast(con troller, DDC$RT.type((_StreamControllerLifecycle<dynamic> _) { 18 _BroadcastSubscription(_StreamControllerLifecycle controller, void onData(T dat a), Function onError, void onDone(), bool cancelOnError) : super(DEVC$RT.cast(co ntroller, DEVC$RT.type((_StreamControllerLifecycle<dynamic> _) {
19 } 19 }
20 ), DDC$RT.type((_StreamControllerLifecycle<T> _) { 20 ), DEVC$RT.type((_StreamControllerLifecycle<T> _) {
21 } 21 }
22 ), "CastDynamic", """line 36, column 15 of dart:async/broadcast_stream_controlle r.dart: """, controller is _StreamControllerLifecycle<T>, false), onData, onErro r, onDone, cancelOnError) { 22 ), "CastDynamic", """line 36, column 15 of dart:async/broadcast_stream_controlle r.dart: """, controller is _StreamControllerLifecycle<T>, false), onData, onErro r, onDone, cancelOnError) {
23 _next = _previous = this; 23 _next = _previous = this;
24 } 24 }
25 _BroadcastStreamController get _controller => ((__x2) => DDC$RT.cast(__x2, DDC$ RT.type((_StreamControllerLifecycle<T> _) { 25 _BroadcastStreamController get _controller => ((__x2) => DEVC$RT.cast(__x2, DEV C$RT.type((_StreamControllerLifecycle<T> _) {
26 } 26 }
27 ), DDC$RT.type((_BroadcastStreamController<dynamic> _) { 27 ), DEVC$RT.type((_BroadcastStreamController<dynamic> _) {
28 } 28 }
29 ), "CastGeneral", """line 40, column 49 of dart:async/broadcast_stream_controlle r.dart: """, __x2 is _BroadcastStreamController<dynamic>, true))(super._controll er); 29 ), "CastGeneral", """line 40, column 49 of dart:async/broadcast_stream_controlle r.dart: """, __x2 is _BroadcastStreamController<dynamic>, true))(super._controll er);
30 bool _expectsEvent(int eventId) => (_eventState & _STATE_EVENT_ID) == eventId; 30 bool _expectsEvent(int eventId) => (_eventState & _STATE_EVENT_ID) == eventId;
31 void _toggleEventId() { 31 void _toggleEventId() {
32 _eventState ^= _STATE_EVENT_ID; 32 _eventState ^= _STATE_EVENT_ID;
33 } 33 }
34 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; 34 bool get _isFiring => (_eventState & _STATE_FIRING) != 0;
35 void _setRemoveAfterFiring() { 35 void _setRemoveAfterFiring() {
36 assert (_isFiring); _eventState |= _STATE_REMOVE_AFTER_FIRING; 36 assert (_isFiring); _eventState |= _STATE_REMOVE_AFTER_FIRING;
37 } 37 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 previous._next = next; 85 previous._next = next;
86 next._previous = previous; 86 next._previous = previous;
87 subscription._next = subscription._previous = subscription; 87 subscription._next = subscription._previous = subscription;
88 } 88 }
89 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on Done(), bool cancelOnError) { 89 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on Done(), bool cancelOnError) {
90 if (isClosed) { 90 if (isClosed) {
91 if (onDone == null) onDone = _nullDoneHandler; 91 if (onDone == null) onDone = _nullDoneHandler;
92 return new _DoneStreamSubscription<T>(onDone); 92 return new _DoneStreamSubscription<T>(onDone);
93 } 93 }
94 StreamSubscription subscription = new _BroadcastSubscription<T>(this, onData, o nError, onDone, cancelOnError); 94 StreamSubscription subscription = new _BroadcastSubscription<T>(this, onData, o nError, onDone, cancelOnError);
95 _addListener(DDC$RT.cast(subscription, DDC$RT.type((StreamSubscription<dynamic> _) { 95 _addListener(DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynami c> _) {
96 } 96 }
97 ), DDC$RT.type((_BroadcastSubscription<T> _) { 97 ), DEVC$RT.type((_BroadcastSubscription<T> _) {
98 } 98 }
99 ), "CastGeneral", """line 196, column 18 of dart:async/broadcast_stream_controll er.dart: """, subscription is _BroadcastSubscription<T>, false)); 99 ), "CastGeneral", """line 196, column 18 of dart:async/broadcast_stream_controll er.dart: """, subscription is _BroadcastSubscription<T>, false));
100 if (identical(_next, _previous)) { 100 if (identical(_next, _previous)) {
101 _runGuarded(_onListen); 101 _runGuarded(_onListen);
102 } 102 }
103 return DDC$RT.cast(subscription, DDC$RT.type((StreamSubscription<dynamic> _) { 103 return DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynamic> _) {
104 } 104 }
105 ), DDC$RT.type((StreamSubscription<T> _) { 105 ), DEVC$RT.type((StreamSubscription<T> _) {
106 } 106 }
107 ), "CastDynamic", """line 201, column 12 of dart:async/broadcast_stream_controll er.dart: """, subscription is StreamSubscription<T>, false); 107 ), "CastDynamic", """line 201, column 12 of dart:async/broadcast_stream_controll er.dart: """, subscription is StreamSubscription<T>, false);
108 } 108 }
109 Future _recordCancel(_BroadcastSubscription<T> subscription) { 109 Future _recordCancel(_BroadcastSubscription<T> subscription) {
110 if (identical(subscription._next, subscription)) return null; 110 if (identical(subscription._next, subscription)) return null;
111 assert (!identical(subscription._next, subscription)); if (subscription._isFiri ng) { 111 assert (!identical(subscription._next, subscription)); if (subscription._isFiri ng) {
112 subscription._setRemoveAfterFiring(); 112 subscription._setRemoveAfterFiring();
113 } 113 }
114 else { 114 else {
115 assert (!identical(subscription._next, subscription)); _removeListener(subscript ion); 115 assert (!identical(subscription._next, subscription)); _removeListener(subscript ion);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 Future doneFuture = _ensureDoneFuture(); 152 Future doneFuture = _ensureDoneFuture();
153 _sendDone(); 153 _sendDone();
154 return doneFuture; 154 return doneFuture;
155 } 155 }
156 Future get done => _ensureDoneFuture(); 156 Future get done => _ensureDoneFuture();
157 Future addStream(Stream<T> stream, { 157 Future addStream(Stream<T> stream, {
158 bool cancelOnError : true} 158 bool cancelOnError : true}
159 ) { 159 ) {
160 if (!_mayAddEvent) throw _addEventError(); 160 if (!_mayAddEvent) throw _addEventError();
161 _state |= _STATE_ADDSTREAM; 161 _state |= _STATE_ADDSTREAM;
162 _addStreamState = ((__x3) => DDC$RT.cast(__x3, DDC$RT.type((_AddStreamState<dyn amic> _) { 162 _addStreamState = ((__x3) => DEVC$RT.cast(__x3, DEVC$RT.type((_AddStreamState<d ynamic> _) {
163 } 163 }
164 ), DDC$RT.type((_AddStreamState<T> _) { 164 ), DEVC$RT.type((_AddStreamState<T> _) {
165 } 165 }
166 ), "CastExact", """line 268, column 23 of dart:async/broadcast_stream_controller .dart: """, __x3 is _AddStreamState<T>, false))(new _AddStreamState(this, stream , cancelOnError)); 166 ), "CastExact", """line 268, column 23 of dart:async/broadcast_stream_controller .dart: """, __x3 is _AddStreamState<T>, false))(new _AddStreamState(this, stream , cancelOnError));
167 return _addStreamState.addStreamFuture; 167 return _addStreamState.addStreamFuture;
168 } 168 }
169 void _add(T data) { 169 void _add(T data) {
170 _sendData(data); 170 _sendData(data);
171 } 171 }
172 void _addError(Object error, StackTrace stackTrace) { 172 void _addError(Object error, StackTrace stackTrace) {
173 _sendError(error, stackTrace); 173 _sendError(error, stackTrace);
174 } 174 }
175 void _close() { 175 void _close() {
176 assert (_isAddingStream); _AddStreamState addState = _addStreamState; 176 assert (_isAddingStream); _AddStreamState addState = _addStreamState;
177 _addStreamState = null; 177 _addStreamState = null;
178 _state &= ~_STATE_ADDSTREAM; 178 _state &= ~_STATE_ADDSTREAM;
179 addState.complete(); 179 addState.complete();
180 } 180 }
181 void _forEachListener(void action(_BufferingStreamSubscription<T> subscription) ) { 181 void _forEachListener(void action(_BufferingStreamSubscription<T> subscription) ) {
182 if (_isFiring) { 182 if (_isFiring) {
183 throw new StateError("Cannot fire new event. Controller is already firing an eve nt"); 183 throw new StateError("Cannot fire new event. Controller is already firing an eve nt");
184 } 184 }
185 if (_isEmpty) return; int id = (_state & _STATE_EVENT_ID); 185 if (_isEmpty) return; int id = (_state & _STATE_EVENT_ID);
186 _state ^= _STATE_EVENT_ID | _STATE_FIRING; 186 _state ^= _STATE_EVENT_ID | _STATE_FIRING;
187 _BroadcastSubscriptionLink link = _next; 187 _BroadcastSubscriptionLink link = _next;
188 while (!identical(link, this)) { 188 while (!identical(link, this)) {
189 _BroadcastSubscription<T> subscription = DDC$RT.cast(link, _BroadcastSubscriptio nLink, DDC$RT.type((_BroadcastSubscription<T> _) { 189 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti onLink, DEVC$RT.type((_BroadcastSubscription<T> _) {
190 } 190 }
191 ), "CastGeneral", """line 309, column 48 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false); 191 ), "CastGeneral", """line 309, column 48 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false);
192 if (subscription._expectsEvent(id)) { 192 if (subscription._expectsEvent(id)) {
193 subscription._eventState |= _BroadcastSubscription._STATE_FIRING; 193 subscription._eventState |= _BroadcastSubscription._STATE_FIRING;
194 action(subscription); 194 action(subscription);
195 subscription._toggleEventId(); 195 subscription._toggleEventId();
196 link = subscription._next; 196 link = subscription._next;
197 if (subscription._removeAfterFiring) { 197 if (subscription._removeAfterFiring) {
198 _removeListener(subscription); 198 _removeListener(subscription);
199 } 199 }
(...skipping 12 matching lines...) Expand all
212 assert (_isEmpty); if (isClosed && _doneFuture._mayComplete) { 212 assert (_isEmpty); if (isClosed && _doneFuture._mayComplete) {
213 _doneFuture._asyncComplete(null); 213 _doneFuture._asyncComplete(null);
214 } 214 }
215 _runGuarded(_onCancel); 215 _runGuarded(_onCancel);
216 } 216 }
217 } 217 }
218 class _SyncBroadcastStreamController<T> extends _BroadcastStreamController<T> { _SyncBroadcastStreamController(void onListen(), void onCancel()) : super(onListe n, onCancel); 218 class _SyncBroadcastStreamController<T> extends _BroadcastStreamController<T> { _SyncBroadcastStreamController(void onListen(), void onCancel()) : super(onListe n, onCancel);
219 void _sendData(T data) { 219 void _sendData(T data) {
220 if (_isEmpty) return; if (_hasOneListener) { 220 if (_isEmpty) return; if (_hasOneListener) {
221 _state |= _BroadcastStreamController._STATE_FIRING; 221 _state |= _BroadcastStreamController._STATE_FIRING;
222 _BroadcastSubscription subscription = DDC$RT.cast(_next, _BroadcastSubscription Link, DDC$RT.type((_BroadcastSubscription<dynamic> _) { 222 _BroadcastSubscription subscription = DEVC$RT.cast(_next, _BroadcastSubscriptio nLink, DEVC$RT.type((_BroadcastSubscription<dynamic> _) {
223 } 223 }
224 ), "CastGeneral", """line 350, column 45 of dart:async/broadcast_stream_controll er.dart: """, _next is _BroadcastSubscription<dynamic>, true); 224 ), "CastGeneral", """line 350, column 45 of dart:async/broadcast_stream_controll er.dart: """, _next is _BroadcastSubscription<dynamic>, true);
225 subscription._add(data); 225 subscription._add(data);
226 _state &= ~_BroadcastStreamController._STATE_FIRING; 226 _state &= ~_BroadcastStreamController._STATE_FIRING;
227 if (_isEmpty) { 227 if (_isEmpty) {
228 _callOnCancel(); 228 _callOnCancel();
229 } 229 }
230 return;} 230 return;}
231 _forEachListener((_BufferingStreamSubscription<T> subscription) { 231 _forEachListener((_BufferingStreamSubscription<T> subscription) {
232 subscription._add(data); 232 subscription._add(data);
233 } 233 }
234 ); 234 );
235 } 235 }
236 void _sendError(Object error, StackTrace stackTrace) { 236 void _sendError(Object error, StackTrace stackTrace) {
237 if (_isEmpty) return; _forEachListener((_BufferingStreamSubscription<T> subscrip tion) { 237 if (_isEmpty) return; _forEachListener((_BufferingStreamSubscription<T> subscrip tion) {
238 subscription._addError(error, stackTrace); 238 subscription._addError(error, stackTrace);
239 } 239 }
240 ); 240 );
241 } 241 }
242 void _sendDone() { 242 void _sendDone() {
243 if (!_isEmpty) { 243 if (!_isEmpty) {
244 _forEachListener(((__x9) => DDC$RT.wrap((dynamic f(_BroadcastSubscription<T> __u 4)) { 244 _forEachListener(((__x9) => DEVC$RT.wrap((dynamic f(_BroadcastSubscription<T> __ u4)) {
245 dynamic c(_BroadcastSubscription<T> x0) => f(DDC$RT.cast(x0, DDC$RT.type((_Buffe ringStreamSubscription<T> _) { 245 dynamic c(_BroadcastSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((_Buf feringStreamSubscription<T> _) {
246 } 246 }
247 ), DDC$RT.type((_BroadcastSubscription<T> _) { 247 ), DEVC$RT.type((_BroadcastSubscription<T> _) {
248 } 248 }
249 ), "CastParam", """line 372, column 24 of dart:async/broadcast_stream_controller .dart: """, x0 is _BroadcastSubscription<T>, false)); 249 ), "CastParam", """line 372, column 24 of dart:async/broadcast_stream_controller .dart: """, x0 is _BroadcastSubscription<T>, false));
250 return f == null ? null : c; 250 return f == null ? null : c;
251 } 251 }
252 , __x9, DDC$RT.type((__t7<T> _) { 252 , __x9, DEVC$RT.type((__t7<T> _) {
253 } 253 }
254 ), DDC$RT.type((__t5<T> _) { 254 ), DEVC$RT.type((__t5<T> _) {
255 } 255 }
256 ), "WrapLiteral", """line 372, column 24 of dart:async/broadcast_stream_controll er.dart: """, __x9 is __t5<T>))((_BroadcastSubscription<T> subscription) { 256 ), "WrapLiteral", """line 372, column 24 of dart:async/broadcast_stream_controll er.dart: """, __x9 is __t5<T>))((_BroadcastSubscription<T> subscription) {
257 subscription._close(); 257 subscription._close();
258 } 258 }
259 )); 259 ));
260 } 260 }
261 else { 261 else {
262 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as yncComplete(null); 262 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as yncComplete(null);
263 } 263 }
264 } 264 }
265 } 265 }
266 class _AsyncBroadcastStreamController<T> extends _BroadcastStreamController<T> {_AsyncBroadcastStreamController(void onListen(), void onCancel()) : super(onLis ten, onCancel); 266 class _AsyncBroadcastStreamController<T> extends _BroadcastStreamController<T> {_AsyncBroadcastStreamController(void onListen(), void onCancel()) : super(onLis ten, onCancel);
267 void _sendData(T data) { 267 void _sendData(T data) {
268 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin k._next) { 268 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin k._next) {
269 _BroadcastSubscription<T> subscription = DDC$RT.cast(link, _BroadcastSubscriptio nLink, DDC$RT.type((_BroadcastSubscription<T> _) { 269 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti onLink, DEVC$RT.type((_BroadcastSubscription<T> _) {
270 } 270 }
271 ), "CastGeneral", """line 393, column 48 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false); 271 ), "CastGeneral", """line 393, column 48 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false);
272 subscription._addPending(new _DelayedData(data)); 272 subscription._addPending(new _DelayedData(data));
273 } 273 }
274 } 274 }
275 void _sendError(Object error, StackTrace stackTrace) { 275 void _sendError(Object error, StackTrace stackTrace) {
276 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin k._next) { 276 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin k._next) {
277 _BroadcastSubscription<T> subscription = DDC$RT.cast(link, _BroadcastSubscriptio nLink, DDC$RT.type((_BroadcastSubscription<T> _) { 277 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti onLink, DEVC$RT.type((_BroadcastSubscription<T> _) {
278 } 278 }
279 ), "CastGeneral", """line 402, column 48 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false); 279 ), "CastGeneral", """line 402, column 48 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false);
280 subscription._addPending(new _DelayedError(error, stackTrace)); 280 subscription._addPending(new _DelayedError(error, stackTrace));
281 } 281 }
282 } 282 }
283 void _sendDone() { 283 void _sendDone() {
284 if (!_isEmpty) { 284 if (!_isEmpty) {
285 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin k._next) { 285 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin k._next) {
286 _BroadcastSubscription<T> subscription = DDC$RT.cast(link, _BroadcastSubscriptio nLink, DDC$RT.type((_BroadcastSubscription<T> _) { 286 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti onLink, DEVC$RT.type((_BroadcastSubscription<T> _) {
287 } 287 }
288 ), "CastGeneral", """line 412, column 50 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false); 288 ), "CastGeneral", """line 412, column 50 of dart:async/broadcast_stream_controll er.dart: """, link is _BroadcastSubscription<T>, false);
289 subscription._addPending(const _DelayedDone()); 289 subscription._addPending(const _DelayedDone());
290 } 290 }
291 } 291 }
292 else { 292 else {
293 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as yncComplete(null); 293 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as yncComplete(null);
294 } 294 }
295 } 295 }
296 } 296 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (_pauseCount > 0) _pauseCount--; 357 if (_pauseCount > 0) _pauseCount--;
358 } 358 }
359 Future cancel() { 359 Future cancel() {
360 return new _Future.immediate(null); 360 return new _Future.immediate(null);
361 } 361 }
362 bool get isPaused => _pauseCount > 0; 362 bool get isPaused => _pauseCount > 0;
363 Future asFuture([Object value]) => new _Future(); 363 Future asFuture([Object value]) => new _Future();
364 } 364 }
365 typedef void __t5<T>(_BufferingStreamSubscription<T> __u6); 365 typedef void __t5<T>(_BufferingStreamSubscription<T> __u6);
366 typedef dynamic __t7<T>(_BroadcastSubscription<T> __u8); 366 typedef dynamic __t7<T>(_BroadcastSubscription<T> __u8);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/async_error.dart ('k') | test/dart_codegen/expect/async/future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698