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

Side by Side Diff: test/dart_codegen/expect/async/stream.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 Stream<T> {Stream(); 2 abstract class Stream<T> {Stream();
3 factory Stream.fromFuture(Future<T> future) { 3 factory Stream.fromFuture(Future<T> future) {
4 _StreamController<T> controller = new StreamController<T>(sync: true); 4 _StreamController<T> controller = new StreamController<T>(sync: true);
5 future.then((value) { 5 future.then((value) {
6 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89, column 25 of dart:async/stream.dart: """, value is T, false)); 6 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89, column 25 of dart:async/stream.dart: """, value is T, false));
7 controller._closeUnchecked(); 7 controller._closeUnchecked();
8 } 8 }
9 , onError: (error, stackTrace) { 9 , onError: (error, stackTrace) {
10 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true)); 10 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true));
11 controller._closeUnchecked(); 11 controller._closeUnchecked();
12 } 12 }
13 ); 13 );
14 return controller.stream; 14 return controller.stream;
15 } 15 }
16 factory Stream.fromIterable(Iterable<T> data) { 16 factory Stream.fromIterable(Iterable<T> data) {
17 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); 17 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data));
18 } 18 }
19 factory Stream.periodic(Duration period, [T computation(int computationCount)]) { 19 factory Stream.periodic(Duration period, [T computation(int computationCount)]) {
20 if (computation == null) computation = ((__x25) => DEVC$RT.cast(__x25, __t23, DEVC$RT.type((__t21<T> _) { 20 if (computation == null) computation = ((__x23) => DEVC$RT.cast(__x23, __t21, DEVC$RT.type((__t19<T> _) {
21 } 21 }
22 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x 25 is __t21<T>, false))(((i) => null)); 22 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x 23 is __t19<T>, false))(((i) => null));
23 Timer timer; 23 Timer timer;
24 int computationCount = 0; 24 int computationCount = 0;
25 StreamController<T> controller; 25 StreamController<T> controller;
26 Stopwatch watch = new Stopwatch(); 26 Stopwatch watch = new Stopwatch();
27 void sendEvent() { 27 void sendEvent() {
28 watch.reset(); 28 watch.reset();
29 T data = computation(computationCount++); 29 T data = computation(computationCount++);
30 controller.add(data); 30 controller.add(data);
31 } 31 }
32 void startPeriodicTimer() { 32 void startPeriodicTimer() {
(...skipping 22 matching lines...) Expand all
55 ); 55 );
56 } 56 }
57 , onCancel: () { 57 , onCancel: () {
58 if (timer != null) timer.cancel(); 58 if (timer != null) timer.cancel();
59 timer = null; 59 timer = null;
60 } 60 }
61 ); 61 );
62 return controller.stream; 62 return controller.stream;
63 } 63 }
64 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) { 64 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) {
65 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT. type((__t28<T> _) { 65 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT. type((__t24<T> _) {
66 } 66 }
67 ), __t26, "CompositeCast", """line 216, column 41 of dart:async/stream.dart: " "", mapSink is __t26, false)); 67 ), DEVC$RT.type((_SinkMapper<dynamic, dynamic> _) {
68 }
69 ), "CompositeCast", """line 216, column 41 of dart:async/stream.dart: """, map Sink is _SinkMapper<dynamic, dynamic>, false));
68 } 70 }
69 bool get isBroadcast => false; 71 bool get isBroadcast => false;
70 Stream<T> asBroadcastStream({ 72 Stream<T> asBroadcastStream({
71 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)} 73 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)}
72 ) { 74 ) {
73 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__ t32<T> _) { 75 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__ t28<T> _) {
74 } 76 }
75 ), __t30, "CompositeCast", """line 248, column 44 of dart:async/stream.dart: " "", onListen is __t30, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__t32<T> _) { 77 ), __t26, "CompositeCast", """line 248, column 44 of dart:async/stream.dart: " "", onListen is __t26, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__t28<T> _) {
76 } 78 }
77 ), __t30, "CompositeCast", """line 248, column 54 of dart:async/stream.dart: " "", onCancel is __t30, false)); 79 ), __t26, "CompositeCast", """line 248, column 54 of dart:async/stream.dart: " "", onCancel is __t26, false));
78 } 80 }
79 StreamSubscription<T> listen(void onData(T event), { 81 StreamSubscription<T> listen(void onData(T event), {
80 Function onError, void onDone(), bool cancelOnError} 82 Function onError, void onDone(), bool cancelOnError}
81 ); 83 );
82 Stream<T> where(bool test(T event)) { 84 Stream<T> where(bool test(T event)) {
83 return new _WhereStream<T>(this, test); 85 return new _WhereStream<T>(this, test);
84 } 86 }
85 Stream map(convert(T event)) { 87 Stream map(convert(T event)) {
86 return new _MapStream<T, dynamic>(this, convert); 88 return new _MapStream<T, dynamic>(this, convert);
87 } 89 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 Future<T> reduce(T combine(T previous, T element)) { 189 Future<T> reduce(T combine(T previous, T element)) {
188 _Future<T> result = new _Future<T>(); 190 _Future<T> result = new _Future<T>();
189 bool seenFirst = false; 191 bool seenFirst = false;
190 T value; 192 T value;
191 StreamSubscription subscription; 193 StreamSubscription subscription;
192 subscription = this.listen((T element) { 194 subscription = this.listen((T element) {
193 if (seenFirst) { 195 if (seenFirst) {
194 _runUserCode(() => combine(value, element), (T newValue) { 196 _runUserCode(() => combine(value, element), (T newValue) {
195 value = newValue; 197 value = newValue;
196 } 198 }
197 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __t34, "CompositeCast", """line 501, column 24 of dart:async/stream.dart: """, __x37 is __t34, false))(_cancelA ndErrorClosure(subscription, result))); 199 , ((__x33) => DEVC$RT.cast(__x33, dynamic, __t30, "CompositeCast", """line 501, column 24 of dart:async/stream.dart: """, __x33 is __t30, false))(_cancelA ndErrorClosure(subscription, result)));
198 } 200 }
199 else { 201 else {
200 value = element; 202 value = element;
201 seenFirst = true; 203 seenFirst = true;
202 } 204 }
203 } 205 }
204 , onError: result._completeError, onDone: () { 206 , onError: result._completeError, onDone: () {
205 if (!seenFirst) { 207 if (!seenFirst) {
206 try { 208 try {
207 throw IterableElementError.noElement(); 209 throw IterableElementError.noElement();
(...skipping 10 matching lines...) Expand all
218 return result; 220 return result;
219 } 221 }
220 Future fold(var initialValue, combine(var previous, T element)) { 222 Future fold(var initialValue, combine(var previous, T element)) {
221 _Future result = new _Future(); 223 _Future result = new _Future();
222 var value = initialValue; 224 var value = initialValue;
223 StreamSubscription subscription; 225 StreamSubscription subscription;
224 subscription = this.listen((T element) { 226 subscription = this.listen((T element) {
225 _runUserCode(() => combine(value, element), (newValue) { 227 _runUserCode(() => combine(value, element), (newValue) {
226 value = newValue; 228 value = newValue;
227 } 229 }
228 , ((__x38) => DEVC$RT.cast(__x38, dynamic, __t34, "CompositeCast", """line 5 34, column 11 of dart:async/stream.dart: """, __x38 is __t34, false))(_cancelAnd ErrorClosure(subscription, result))); 230 , ((__x34) => DEVC$RT.cast(__x34, dynamic, __t30, "CompositeCast", """line 5 34, column 11 of dart:async/stream.dart: """, __x34 is __t30, false))(_cancelAnd ErrorClosure(subscription, result)));
229 } 231 }
230 , onError: (e, st) { 232 , onError: (e, st) {
231 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) ); 233 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) );
232 } 234 }
233 , onDone: () { 235 , onDone: () {
234 result._complete(value); 236 result._complete(value);
235 } 237 }
236 , cancelOnError: true); 238 , cancelOnError: true);
237 return result; 239 return result;
238 } 240 }
(...skipping 25 matching lines...) Expand all
264 } 266 }
265 Future<bool> contains(Object needle) { 267 Future<bool> contains(Object needle) {
266 _Future<bool> future = new _Future<bool>(); 268 _Future<bool> future = new _Future<bool>();
267 StreamSubscription subscription; 269 StreamSubscription subscription;
268 subscription = this.listen((T element) { 270 subscription = this.listen((T element) {
269 _runUserCode(() => (element == needle), (bool isMatch) { 271 _runUserCode(() => (element == needle), (bool isMatch) {
270 if (isMatch) { 272 if (isMatch) {
271 _cancelAndValue(subscription, future, true); 273 _cancelAndValue(subscription, future, true);
272 } 274 }
273 } 275 }
274 , ((__x39) => DEVC$RT.cast(__x39, dynamic, __t34, "CompositeCast", """line 6 02, column 13 of dart:async/stream.dart: """, __x39 is __t34, false))(_cancelAnd ErrorClosure(subscription, future))); 276 , ((__x35) => DEVC$RT.cast(__x35, dynamic, __t30, "CompositeCast", """line 6 02, column 13 of dart:async/stream.dart: """, __x35 is __t30, false))(_cancelAnd ErrorClosure(subscription, future)));
275 } 277 }
276 , onError: future._completeError, onDone: () { 278 , onError: future._completeError, onDone: () {
277 future._complete(false); 279 future._complete(false);
278 } 280 }
279 , cancelOnError: true); 281 , cancelOnError: true);
280 return future; 282 return future;
281 } 283 }
282 Future forEach(void action(T element)) { 284 Future forEach(void action(T element)) {
283 _Future future = new _Future(); 285 _Future future = new _Future();
284 StreamSubscription subscription; 286 StreamSubscription subscription;
285 subscription = this.listen((T element) { 287 subscription = this.listen((T element) {
286 _runUserCode(() => action(element), (_) { 288 _runUserCode(() => action(element), (_) {
287 } 289 }
288 , ((__x40) => DEVC$RT.cast(__x40, dynamic, __t34, "CompositeCast", """line 6 28, column 13 of dart:async/stream.dart: """, __x40 is __t34, false))(_cancelAnd ErrorClosure(subscription, future))); 290 , ((__x36) => DEVC$RT.cast(__x36, dynamic, __t30, "CompositeCast", """line 6 28, column 13 of dart:async/stream.dart: """, __x36 is __t30, false))(_cancelAnd ErrorClosure(subscription, future)));
289 } 291 }
290 , onError: future._completeError, onDone: () { 292 , onError: future._completeError, onDone: () {
291 future._complete(null); 293 future._complete(null);
292 } 294 }
293 , cancelOnError: true); 295 , cancelOnError: true);
294 return future; 296 return future;
295 } 297 }
296 Future<bool> every(bool test(T element)) { 298 Future<bool> every(bool test(T element)) {
297 _Future<bool> future = new _Future<bool>(); 299 _Future<bool> future = new _Future<bool>();
298 StreamSubscription subscription; 300 StreamSubscription subscription;
299 subscription = this.listen((T element) { 301 subscription = this.listen((T element) {
300 _runUserCode(() => test(element), (bool isMatch) { 302 _runUserCode(() => test(element), (bool isMatch) {
301 if (!isMatch) { 303 if (!isMatch) {
302 _cancelAndValue(subscription, future, false); 304 _cancelAndValue(subscription, future, false);
303 } 305 }
304 } 306 }
305 , ((__x41) => DEVC$RT.cast(__x41, dynamic, __t34, "CompositeCast", """line 6 57, column 13 of dart:async/stream.dart: """, __x41 is __t34, false))(_cancelAnd ErrorClosure(subscription, future))); 307 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __t30, "CompositeCast", """line 6 57, column 13 of dart:async/stream.dart: """, __x37 is __t30, false))(_cancelAnd ErrorClosure(subscription, future)));
306 } 308 }
307 , onError: future._completeError, onDone: () { 309 , onError: future._completeError, onDone: () {
308 future._complete(true); 310 future._complete(true);
309 } 311 }
310 , cancelOnError: true); 312 , cancelOnError: true);
311 return future; 313 return future;
312 } 314 }
313 Future<bool> any(bool test(T element)) { 315 Future<bool> any(bool test(T element)) {
314 _Future<bool> future = new _Future<bool>(); 316 _Future<bool> future = new _Future<bool>();
315 StreamSubscription subscription; 317 StreamSubscription subscription;
316 subscription = this.listen((T element) { 318 subscription = this.listen((T element) {
317 _runUserCode(() => test(element), (bool isMatch) { 319 _runUserCode(() => test(element), (bool isMatch) {
318 if (isMatch) { 320 if (isMatch) {
319 _cancelAndValue(subscription, future, true); 321 _cancelAndValue(subscription, future, true);
320 } 322 }
321 } 323 }
322 , ((__x42) => DEVC$RT.cast(__x42, dynamic, __t34, "CompositeCast", """line 6 94, column 13 of dart:async/stream.dart: """, __x42 is __t34, false))(_cancelAnd ErrorClosure(subscription, future))); 324 , ((__x38) => DEVC$RT.cast(__x38, dynamic, __t30, "CompositeCast", """line 6 94, column 13 of dart:async/stream.dart: """, __x38 is __t30, false))(_cancelAnd ErrorClosure(subscription, future)));
323 } 325 }
324 , onError: future._completeError, onDone: () { 326 , onError: future._completeError, onDone: () {
325 future._complete(false); 327 future._complete(false);
326 } 328 }
327 , cancelOnError: true); 329 , cancelOnError: true);
328 return future; 330 return future;
329 } 331 }
330 Future<int> get length { 332 Future<int> get length {
331 _Future<int> future = new _Future<int>(); 333 _Future<int> future = new _Future<int>();
332 int count = 0; 334 int count = 0;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 Object defaultValue()} 468 Object defaultValue()}
467 ) { 469 ) {
468 _Future<dynamic> future = new _Future(); 470 _Future<dynamic> future = new _Future();
469 StreamSubscription subscription; 471 StreamSubscription subscription;
470 subscription = this.listen((T value) { 472 subscription = this.listen((T value) {
471 _runUserCode(() => test(value), (bool isMatch) { 473 _runUserCode(() => test(value), (bool isMatch) {
472 if (isMatch) { 474 if (isMatch) {
473 _cancelAndValue(subscription, future, value); 475 _cancelAndValue(subscription, future, value);
474 } 476 }
475 } 477 }
476 , ((__x43) => DEVC$RT.cast(__x43, dynamic, __t34, "CompositeCast", """line 1 036, column 11 of dart:async/stream.dart: """, __x43 is __t34, false))(_cancelAn dErrorClosure(subscription, future))); 478 , ((__x39) => DEVC$RT.cast(__x39, dynamic, __t30, "CompositeCast", """line 1 036, column 11 of dart:async/stream.dart: """, __x39 is __t30, false))(_cancelAn dErrorClosure(subscription, future)));
477 } 479 }
478 , onError: future._completeError, onDone: () { 480 , onError: future._completeError, onDone: () {
479 if (defaultValue != null) { 481 if (defaultValue != null) {
480 _runUserCode(defaultValue, future._complete, future._completeError); 482 _runUserCode(defaultValue, future._complete, future._completeError);
481 return;} 483 return;}
482 try { 484 try {
483 throw IterableElementError.noElement(); 485 throw IterableElementError.noElement();
484 } 486 }
485 catch (e, s) { 487 catch (e, s) {
486 _completeWithErrorCallback(future, e, s); 488 _completeWithErrorCallback(future, e, s);
487 } 489 }
488 } 490 }
489 , cancelOnError: true); 491 , cancelOnError: true);
490 return future; 492 return future;
491 } 493 }
492 Future<dynamic> lastWhere(bool test(T element), { 494 Future<dynamic> lastWhere(bool test(T element), {
493 Object defaultValue()} 495 Object defaultValue()}
494 ) { 496 ) {
495 _Future<dynamic> future = new _Future(); 497 _Future<dynamic> future = new _Future();
496 T result = null; 498 T result = null;
497 bool foundResult = false; 499 bool foundResult = false;
498 StreamSubscription subscription; 500 StreamSubscription subscription;
499 subscription = this.listen((T value) { 501 subscription = this.listen((T value) {
500 _runUserCode(() => true == test(value), (bool isMatch) { 502 _runUserCode(() => true == test(value), (bool isMatch) {
501 if (isMatch) { 503 if (isMatch) {
502 foundResult = true; 504 foundResult = true;
503 result = value; 505 result = value;
504 } 506 }
505 } 507 }
506 , ((__x44) => DEVC$RT.cast(__x44, dynamic, __t34, "CompositeCast", """line 1 077, column 11 of dart:async/stream.dart: """, __x44 is __t34, false))(_cancelAn dErrorClosure(subscription, future))); 508 , ((__x40) => DEVC$RT.cast(__x40, dynamic, __t30, "CompositeCast", """line 1 077, column 11 of dart:async/stream.dart: """, __x40 is __t30, false))(_cancelAn dErrorClosure(subscription, future)));
507 } 509 }
508 , onError: future._completeError, onDone: () { 510 , onError: future._completeError, onDone: () {
509 if (foundResult) { 511 if (foundResult) {
510 future._complete(result); 512 future._complete(result);
511 return;} 513 return;}
512 if (defaultValue != null) { 514 if (defaultValue != null) {
513 _runUserCode(defaultValue, future._complete, future._completeError); 515 _runUserCode(defaultValue, future._complete, future._completeError);
514 return;} 516 return;}
515 try { 517 try {
516 throw IterableElementError.noElement(); 518 throw IterableElementError.noElement();
(...skipping 18 matching lines...) Expand all
535 throw IterableElementError.tooMany(); 537 throw IterableElementError.tooMany();
536 } 538 }
537 catch (e, s) { 539 catch (e, s) {
538 _cancelAndErrorWithReplacement(subscription, future, e, s); 540 _cancelAndErrorWithReplacement(subscription, future, e, s);
539 } 541 }
540 return;} 542 return;}
541 foundResult = true; 543 foundResult = true;
542 result = value; 544 result = value;
543 } 545 }
544 } 546 }
545 , ((__x45) => DEVC$RT.cast(__x45, dynamic, __t34, "CompositeCast", """line 1 129, column 11 of dart:async/stream.dart: """, __x45 is __t34, false))(_cancelAn dErrorClosure(subscription, future))); 547 , ((__x41) => DEVC$RT.cast(__x41, dynamic, __t30, "CompositeCast", """line 1 129, column 11 of dart:async/stream.dart: """, __x41 is __t30, false))(_cancelAn dErrorClosure(subscription, future)));
546 } 548 }
547 , onError: future._completeError, onDone: () { 549 , onError: future._completeError, onDone: () {
548 if (foundResult) { 550 if (foundResult) {
549 future._complete(result); 551 future._complete(result);
550 return;} 552 return;}
551 try { 553 try {
552 throw IterableElementError.noElement(); 554 throw IterableElementError.noElement();
553 } 555 }
554 catch (e, s) { 556 catch (e, s) {
555 _completeWithErrorCallback(future, e, s); 557 _completeWithErrorCallback(future, e, s);
(...skipping 23 matching lines...) Expand all
579 void onTimeout(EventSink sink)} 581 void onTimeout(EventSink sink)}
580 ) { 582 ) {
581 StreamController controller; 583 StreamController controller;
582 StreamSubscription<T> subscription; 584 StreamSubscription<T> subscription;
583 Timer timer; 585 Timer timer;
584 Zone zone; 586 Zone zone;
585 Function timeout; 587 Function timeout;
586 void onData(T event) { 588 void onData(T event) {
587 timer.cancel(); 589 timer.cancel();
588 controller.add(event); 590 controller.add(event);
589 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46, "CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout is __t46, false)); 591 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42, "CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout is __t42, false));
590 } 592 }
591 void onError(error, StackTrace stackTrace) { 593 void onError(error, StackTrace stackTrace) {
592 timer.cancel(); 594 timer.cancel();
593 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller; 595 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller;
594 eventSink._addError(error, stackTrace); 596 eventSink._addError(error, stackTrace);
595 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46, "CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout is __t46, false)); 597 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42, "CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout is __t42, false));
596 } 598 }
597 void onDone() { 599 void onDone() {
598 timer.cancel(); 600 timer.cancel();
599 controller.close(); 601 controller.close();
600 } 602 }
601 void onListen() { 603 void onListen() {
602 zone = Zone.current; 604 zone = Zone.current;
603 if (onTimeout == null) { 605 if (onTimeout == null) {
604 timeout = () { 606 timeout = () {
605 controller.addError(new TimeoutException("No stream event", timeLimit), null); 607 controller.addError(new TimeoutException("No stream event", timeLimit), null);
606 } 608 }
607 ; 609 ;
608 } 610 }
609 else { 611 else {
610 onTimeout = ((__x51) => DEVC$RT.cast(__x51, __t49, __t47, "CompositeCast", """line 1245, column 21 of dart:async/stream.dart: """, __x51 is __t47, false)) (zone.registerUnaryCallback(onTimeout)); 612 onTimeout = ((__x45) => DEVC$RT.cast(__x45, ZoneUnaryCallback, __t43, "Com positeCast", """line 1245, column 21 of dart:async/stream.dart: """, __x45 is __ t43, false))(zone.registerUnaryCallback(onTimeout));
611 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l); 613 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l);
612 timeout = () { 614 timeout = () {
613 wrapper._sink = controller; 615 wrapper._sink = controller;
614 zone.runUnaryGuarded(onTimeout, wrapper); 616 zone.runUnaryGuarded(onTimeout, wrapper);
615 wrapper._sink = null; 617 wrapper._sink = null;
616 } 618 }
617 ; 619 ;
618 } 620 }
619 subscription = this.listen(onData, onError: onError, onDone: onDone); 621 subscription = this.listen(onData, onError: onError, onDone: onDone);
620 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46, "CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout is __t46, false)); 622 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42, "CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout is __t42, false));
621 } 623 }
622 Future onCancel() { 624 Future onCancel() {
623 timer.cancel(); 625 timer.cancel();
624 Future result = subscription.cancel(); 626 Future result = subscription.cancel();
625 subscription = null; 627 subscription = null;
626 return result; 628 return result;
627 } 629 }
628 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () { 630 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () {
629 timer.cancel(); 631 timer.cancel();
630 subscription.pause(); 632 subscription.pause();
631 } 633 }
632 , () { 634 , () {
633 subscription.resume(); 635 subscription.resume();
634 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46, "CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout is __t46, false)); 636 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42, "CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout is __t42, false));
635 } 637 }
636 , onCancel); 638 , onCancel);
637 return controller.stream; 639 return controller.stream;
638 } 640 }
639 } 641 }
640 abstract class StreamSubscription<T> {Future cancel(); 642 abstract class StreamSubscription<T> {Future cancel();
641 void onData(void handleData(T data)); 643 void onData(void handleData(T data));
642 void onError(Function handleError); 644 void onError(Function handleError);
643 void onDone(void handleDone()); 645 void onDone(void handleDone());
644 void pause([Future resumeSignal]); 646 void pause([Future resumeSignal]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 void add(T data) { 686 void add(T data) {
685 _sink.add(data); 687 _sink.add(data);
686 } 688 }
687 void addError(error, [StackTrace stackTrace]) { 689 void addError(error, [StackTrace stackTrace]) {
688 _sink.addError(error, stackTrace); 690 _sink.addError(error, stackTrace);
689 } 691 }
690 void close() { 692 void close() {
691 _sink.close(); 693 _sink.close();
692 } 694 }
693 } 695 }
694 typedef T __t21<T>(int __u22); 696 typedef T __t19<T>(int __u20);
695 typedef dynamic __t23(dynamic __u24); 697 typedef dynamic __t21(dynamic __u22);
696 typedef EventSink<dynamic> __t26(EventSink<dynamic> __u27); 698 typedef EventSink<dynamic> __t24<T>(EventSink<T> __u25);
697 typedef EventSink<dynamic> __t28<T>(EventSink<T> __u29); 699 typedef void __t26(StreamSubscription<dynamic> __u27);
698 typedef void __t30(StreamSubscription<dynamic> __u31); 700 typedef void __t28<T>(StreamSubscription<T> __u29);
699 typedef void __t32<T>(StreamSubscription<T> __u33); 701 typedef dynamic __t30(dynamic __u31, StackTrace __u32);
700 typedef dynamic __t34(dynamic __u35, StackTrace __u36); 702 typedef void __t42();
701 typedef void __t46(); 703 typedef void __t43(EventSink<dynamic> __u44);
702 typedef void __t47(EventSink<dynamic> __u48);
703 typedef dynamic __t49(dynamic __u50);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/schedule_microtask.dart ('k') | test/dart_codegen/expect/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698