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

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

Issue 1122313002: Typing fixes to eliminate casts/dcalls (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 7 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
« no previous file with comments | « test/checker/checker_test.dart ('k') | test/dart_codegen/expect/async/stream_controller.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 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 = ((__x19) => DEVC$RT.cast(__x19, DEVC$RT.type ((StreamController<T> _) { 4 _StreamController<T> controller = ((__x19) => DEVC$RT.cast(__x19, DEVC$RT.type ((StreamController<T> _) {
5 } 5 }
6 ), DEVC$RT.type((_StreamController<T> _) { 6 ), DEVC$RT.type((_StreamController<T> _) {
7 } 7 }
8 ), "CastUser", """line 88, column 9 of dart:async/stream.dart: """, __x19 is _ StreamController<T>, false))(new StreamController<T>(sync: true)); 8 ), "CastUser", """line 88, column 9 of dart:async/stream.dart: """, __x19 is _ StreamController<T>, false))(new StreamController<T>(sync: true));
9 future.then((value) { 9 future.then((value) {
10 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 90, column 25 of dart:async/stream.dart: """, value is T, false)); 10 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 90, column 25 of dart:async/stream.dart: """, value is T, false));
11 controller._closeUnchecked(); 11 controller._closeUnchecked();
12 } 12 }
13 , onError: (error, stackTrace) { 13 , onError: (error, stackTrace) {
14 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 94, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true)); 14 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 94, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true));
15 controller._closeUnchecked(); 15 controller._closeUnchecked();
16 } 16 }
17 ); 17 );
18 return controller.stream; 18 return controller.stream;
19 } 19 }
20 factory Stream.fromIterable(Iterable<T> data) { 20 factory Stream.fromIterable(Iterable<T> data) {
21 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); 21 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data));
22 } 22 }
23 factory Stream.periodic(Duration period, [T computation(int computationCount)]) { 23 factory Stream.periodic(Duration period, [T computation(int computationCount)]) {
24 if (computation == null) computation = ((__x24) => DEVC$RT.cast(__x24, __CastT ype22, DEVC$RT.type((__CastType20<T> _) { 24 if (computation == null) computation = ((i) => null);
25 }
26 ), "CompositeCast", """line 127, column 44 of dart:async/stream.dart: """, __x 24 is __CastType20<T>, false))(((i) => null));
27 Timer timer; 25 Timer timer;
28 int computationCount = 0; 26 int computationCount = 0;
29 StreamController<T> controller; 27 StreamController<T> controller;
30 Stopwatch watch = new Stopwatch(); 28 Stopwatch watch = new Stopwatch();
31 void sendEvent() { 29 void sendEvent() {
32 watch.reset(); 30 watch.reset();
33 T data = computation(computationCount++); 31 T data = computation(computationCount++);
34 controller.add(data); 32 controller.add(data);
35 } 33 }
36 void startPeriodicTimer() { 34 void startPeriodicTimer() {
(...skipping 22 matching lines...) Expand all
59 ); 57 );
60 } 58 }
61 , onCancel: () { 59 , onCancel: () {
62 if (timer != null) timer.cancel(); 60 if (timer != null) timer.cancel();
63 timer = null; 61 timer = null;
64 } 62 }
65 ); 63 );
66 return controller.stream; 64 return controller.stream;
67 } 65 }
68 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) { 66 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) {
69 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT. type((__CastType25<T> _) { 67 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT. type((__CastType20<T> _) {
70 } 68 }
71 ), DEVC$RT.type((_SinkMapper<dynamic, dynamic> _) { 69 ), DEVC$RT.type((_SinkMapper<dynamic, dynamic> _) {
72 } 70 }
73 ), "CompositeCast", """line 217, column 41 of dart:async/stream.dart: """, map Sink is _SinkMapper<dynamic, dynamic>, false)); 71 ), "CompositeCast", """line 217, column 41 of dart:async/stream.dart: """, map Sink is _SinkMapper<dynamic, dynamic>, false));
74 } 72 }
75 bool get isBroadcast => false; 73 bool get isBroadcast => false;
76 Stream<T> asBroadcastStream({ 74 Stream<T> asBroadcastStream({
77 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)} 75 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)}
78 ) { 76 ) {
79 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__ CastType29<T> _) { 77 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__ CastType24<T> _) {
80 } 78 }
81 ), __CastType27, "CompositeCast", """line 249, column 44 of dart:async/stream. dart: """, onListen is __CastType27, false), DEVC$RT.cast(onCancel, DEVC$RT.type ((__CastType29<T> _) { 79 ), __CastType22, "CompositeCast", """line 249, column 44 of dart:async/stream. dart: """, onListen is __CastType22, false), DEVC$RT.cast(onCancel, DEVC$RT.type ((__CastType24<T> _) {
82 } 80 }
83 ), __CastType27, "CompositeCast", """line 249, column 54 of dart:async/stream. dart: """, onCancel is __CastType27, false)); 81 ), __CastType22, "CompositeCast", """line 249, column 54 of dart:async/stream. dart: """, onCancel is __CastType22, false));
84 } 82 }
85 StreamSubscription<T> listen(void onData(T event), { 83 StreamSubscription<T> listen(void onData(T event), {
86 Function onError, void onDone(), bool cancelOnError} 84 Function onError, void onDone(), bool cancelOnError}
87 ); 85 );
88 Stream<T> where(bool test(T event)) { 86 Stream<T> where(bool test(T event)) {
89 return new _WhereStream<T>(this, test); 87 return new _WhereStream<T>(this, test);
90 } 88 }
91 Stream map(convert(T event)) { 89 Stream map(convert(T event)) {
92 return new _MapStream<T, dynamic>(this, convert); 90 return new _MapStream<T, dynamic>(this, convert);
93 } 91 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 Future<T> reduce(T combine(T previous, T element)) { 191 Future<T> reduce(T combine(T previous, T element)) {
194 _Future<T> result = new _Future<T>(); 192 _Future<T> result = new _Future<T>();
195 bool seenFirst = false; 193 bool seenFirst = false;
196 T value; 194 T value;
197 StreamSubscription subscription; 195 StreamSubscription subscription;
198 subscription = this.listen((T element) { 196 subscription = this.listen((T element) {
199 if (seenFirst) { 197 if (seenFirst) {
200 _runUserCode(() => combine(value, element), (T newValue) { 198 _runUserCode(() => combine(value, element), (T newValue) {
201 value = newValue; 199 value = newValue;
202 } 200 }
203 , ((__x34) => DEVC$RT.cast(__x34, dynamic, __CastType31, "CompositeCast", """line 502, column 24 of dart:async/stream.dart: """, __x34 is __CastType31, fa lse))(_cancelAndErrorClosure(subscription, result))); 201 , ((__x29) => DEVC$RT.cast(__x29, dynamic, __CastType26, "CompositeCast", """line 502, column 24 of dart:async/stream.dart: """, __x29 is __CastType26, fa lse))(_cancelAndErrorClosure(subscription, result)));
204 } 202 }
205 else { 203 else {
206 value = element; 204 value = element;
207 seenFirst = true; 205 seenFirst = true;
208 } 206 }
209 } 207 }
210 , onError: result._completeError, onDone: () { 208 , onError: result._completeError, onDone: () {
211 if (!seenFirst) { 209 if (!seenFirst) {
212 try { 210 try {
213 throw IterableElementError.noElement(); 211 throw IterableElementError.noElement();
(...skipping 10 matching lines...) Expand all
224 return result; 222 return result;
225 } 223 }
226 Future fold(var initialValue, combine(var previous, T element)) { 224 Future fold(var initialValue, combine(var previous, T element)) {
227 _Future result = new _Future(); 225 _Future result = new _Future();
228 var value = initialValue; 226 var value = initialValue;
229 StreamSubscription subscription; 227 StreamSubscription subscription;
230 subscription = this.listen((T element) { 228 subscription = this.listen((T element) {
231 _runUserCode(() => combine(value, element), (newValue) { 229 _runUserCode(() => combine(value, element), (newValue) {
232 value = newValue; 230 value = newValue;
233 } 231 }
234 , ((__x35) => DEVC$RT.cast(__x35, dynamic, __CastType31, "CompositeCast", "" "line 535, column 11 of dart:async/stream.dart: """, __x35 is __CastType31, fals e))(_cancelAndErrorClosure(subscription, result))); 232 , ((__x30) => DEVC$RT.cast(__x30, dynamic, __CastType26, "CompositeCast", "" "line 535, column 11 of dart:async/stream.dart: """, __x30 is __CastType26, fals e))(_cancelAndErrorClosure(subscription, result)));
235 } 233 }
236 , onError: (e, st) { 234 , onError: (e, st) {
237 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 539, column 34 of dart:async/stream.dart: """, st is StackTrace, true) ); 235 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 539, column 34 of dart:async/stream.dart: """, st is StackTrace, true) );
238 } 236 }
239 , onDone: () { 237 , onDone: () {
240 result._complete(value); 238 result._complete(value);
241 } 239 }
242 , cancelOnError: true); 240 , cancelOnError: true);
243 return result; 241 return result;
244 } 242 }
(...skipping 25 matching lines...) Expand all
270 } 268 }
271 Future<bool> contains(Object needle) { 269 Future<bool> contains(Object needle) {
272 _Future<bool> future = new _Future<bool>(); 270 _Future<bool> future = new _Future<bool>();
273 StreamSubscription subscription; 271 StreamSubscription subscription;
274 subscription = this.listen((T element) { 272 subscription = this.listen((T element) {
275 _runUserCode(() => (element == needle), (bool isMatch) { 273 _runUserCode(() => (element == needle), (bool isMatch) {
276 if (isMatch) { 274 if (isMatch) {
277 _cancelAndValue(subscription, future, true); 275 _cancelAndValue(subscription, future, true);
278 } 276 }
279 } 277 }
280 , ((__x36) => DEVC$RT.cast(__x36, dynamic, __CastType31, "CompositeCast", "" "line 603, column 13 of dart:async/stream.dart: """, __x36 is __CastType31, fals e))(_cancelAndErrorClosure(subscription, future))); 278 , ((__x31) => DEVC$RT.cast(__x31, dynamic, __CastType26, "CompositeCast", "" "line 603, column 13 of dart:async/stream.dart: """, __x31 is __CastType26, fals e))(_cancelAndErrorClosure(subscription, future)));
281 } 279 }
282 , onError: future._completeError, onDone: () { 280 , onError: future._completeError, onDone: () {
283 future._complete(false); 281 future._complete(false);
284 } 282 }
285 , cancelOnError: true); 283 , cancelOnError: true);
286 return future; 284 return future;
287 } 285 }
288 Future forEach(void action(T element)) { 286 Future forEach(void action(T element)) {
289 _Future future = new _Future(); 287 _Future future = new _Future();
290 StreamSubscription subscription; 288 StreamSubscription subscription;
291 subscription = this.listen((T element) { 289 subscription = this.listen((T element) {
292 _runUserCode(() => action(element), (_) { 290 _runUserCode(() => action(element), (_) {
293 } 291 }
294 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __CastType31, "CompositeCast", "" "line 629, column 13 of dart:async/stream.dart: """, __x37 is __CastType31, fals e))(_cancelAndErrorClosure(subscription, future))); 292 , ((__x32) => DEVC$RT.cast(__x32, dynamic, __CastType26, "CompositeCast", "" "line 629, column 13 of dart:async/stream.dart: """, __x32 is __CastType26, fals e))(_cancelAndErrorClosure(subscription, future)));
295 } 293 }
296 , onError: future._completeError, onDone: () { 294 , onError: future._completeError, onDone: () {
297 future._complete(null); 295 future._complete(null);
298 } 296 }
299 , cancelOnError: true); 297 , cancelOnError: true);
300 return future; 298 return future;
301 } 299 }
302 Future<bool> every(bool test(T element)) { 300 Future<bool> every(bool test(T element)) {
303 _Future<bool> future = new _Future<bool>(); 301 _Future<bool> future = new _Future<bool>();
304 StreamSubscription subscription; 302 StreamSubscription subscription;
305 subscription = this.listen((T element) { 303 subscription = this.listen((T element) {
306 _runUserCode(() => test(element), (bool isMatch) { 304 _runUserCode(() => test(element), (bool isMatch) {
307 if (!isMatch) { 305 if (!isMatch) {
308 _cancelAndValue(subscription, future, false); 306 _cancelAndValue(subscription, future, false);
309 } 307 }
310 } 308 }
311 , ((__x38) => DEVC$RT.cast(__x38, dynamic, __CastType31, "CompositeCast", "" "line 658, column 13 of dart:async/stream.dart: """, __x38 is __CastType31, fals e))(_cancelAndErrorClosure(subscription, future))); 309 , ((__x33) => DEVC$RT.cast(__x33, dynamic, __CastType26, "CompositeCast", "" "line 658, column 13 of dart:async/stream.dart: """, __x33 is __CastType26, fals e))(_cancelAndErrorClosure(subscription, future)));
312 } 310 }
313 , onError: future._completeError, onDone: () { 311 , onError: future._completeError, onDone: () {
314 future._complete(true); 312 future._complete(true);
315 } 313 }
316 , cancelOnError: true); 314 , cancelOnError: true);
317 return future; 315 return future;
318 } 316 }
319 Future<bool> any(bool test(T element)) { 317 Future<bool> any(bool test(T element)) {
320 _Future<bool> future = new _Future<bool>(); 318 _Future<bool> future = new _Future<bool>();
321 StreamSubscription subscription; 319 StreamSubscription subscription;
322 subscription = this.listen((T element) { 320 subscription = this.listen((T element) {
323 _runUserCode(() => test(element), (bool isMatch) { 321 _runUserCode(() => test(element), (bool isMatch) {
324 if (isMatch) { 322 if (isMatch) {
325 _cancelAndValue(subscription, future, true); 323 _cancelAndValue(subscription, future, true);
326 } 324 }
327 } 325 }
328 , ((__x39) => DEVC$RT.cast(__x39, dynamic, __CastType31, "CompositeCast", "" "line 695, column 13 of dart:async/stream.dart: """, __x39 is __CastType31, fals e))(_cancelAndErrorClosure(subscription, future))); 326 , ((__x34) => DEVC$RT.cast(__x34, dynamic, __CastType26, "CompositeCast", "" "line 695, column 13 of dart:async/stream.dart: """, __x34 is __CastType26, fals e))(_cancelAndErrorClosure(subscription, future)));
329 } 327 }
330 , onError: future._completeError, onDone: () { 328 , onError: future._completeError, onDone: () {
331 future._complete(false); 329 future._complete(false);
332 } 330 }
333 , cancelOnError: true); 331 , cancelOnError: true);
334 return future; 332 return future;
335 } 333 }
336 Future<int> get length { 334 Future<int> get length {
337 _Future<int> future = new _Future<int>(); 335 _Future<int> future = new _Future<int>();
338 int count = 0; 336 int count = 0;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 Object defaultValue()} 470 Object defaultValue()}
473 ) { 471 ) {
474 _Future<dynamic> future = new _Future(); 472 _Future<dynamic> future = new _Future();
475 StreamSubscription subscription; 473 StreamSubscription subscription;
476 subscription = this.listen((T value) { 474 subscription = this.listen((T value) {
477 _runUserCode(() => test(value), (bool isMatch) { 475 _runUserCode(() => test(value), (bool isMatch) {
478 if (isMatch) { 476 if (isMatch) {
479 _cancelAndValue(subscription, future, value); 477 _cancelAndValue(subscription, future, value);
480 } 478 }
481 } 479 }
482 , ((__x40) => DEVC$RT.cast(__x40, dynamic, __CastType31, "CompositeCast", "" "line 1037, column 11 of dart:async/stream.dart: """, __x40 is __CastType31, fal se))(_cancelAndErrorClosure(subscription, future))); 480 , ((__x35) => DEVC$RT.cast(__x35, dynamic, __CastType26, "CompositeCast", "" "line 1037, column 11 of dart:async/stream.dart: """, __x35 is __CastType26, fal se))(_cancelAndErrorClosure(subscription, future)));
483 } 481 }
484 , onError: future._completeError, onDone: () { 482 , onError: future._completeError, onDone: () {
485 if (defaultValue != null) { 483 if (defaultValue != null) {
486 _runUserCode(defaultValue, future._complete, future._completeError); 484 _runUserCode(defaultValue, future._complete, future._completeError);
487 return;} 485 return;}
488 try { 486 try {
489 throw IterableElementError.noElement(); 487 throw IterableElementError.noElement();
490 } 488 }
491 catch (e, s) { 489 catch (e, s) {
492 _completeWithErrorCallback(future, e, s); 490 _completeWithErrorCallback(future, e, s);
493 } 491 }
494 } 492 }
495 , cancelOnError: true); 493 , cancelOnError: true);
496 return future; 494 return future;
497 } 495 }
498 Future<dynamic> lastWhere(bool test(T element), { 496 Future<dynamic> lastWhere(bool test(T element), {
499 Object defaultValue()} 497 Object defaultValue()}
500 ) { 498 ) {
501 _Future<dynamic> future = new _Future(); 499 _Future<dynamic> future = new _Future();
502 T result = null; 500 T result = null;
503 bool foundResult = false; 501 bool foundResult = false;
504 StreamSubscription subscription; 502 StreamSubscription subscription;
505 subscription = this.listen((T value) { 503 subscription = this.listen((T value) {
506 _runUserCode(() => true == test(value), (bool isMatch) { 504 _runUserCode(() => true == test(value), (bool isMatch) {
507 if (isMatch) { 505 if (isMatch) {
508 foundResult = true; 506 foundResult = true;
509 result = value; 507 result = value;
510 } 508 }
511 } 509 }
512 , ((__x41) => DEVC$RT.cast(__x41, dynamic, __CastType31, "CompositeCast", "" "line 1078, column 11 of dart:async/stream.dart: """, __x41 is __CastType31, fal se))(_cancelAndErrorClosure(subscription, future))); 510 , ((__x36) => DEVC$RT.cast(__x36, dynamic, __CastType26, "CompositeCast", "" "line 1078, column 11 of dart:async/stream.dart: """, __x36 is __CastType26, fal se))(_cancelAndErrorClosure(subscription, future)));
513 } 511 }
514 , onError: future._completeError, onDone: () { 512 , onError: future._completeError, onDone: () {
515 if (foundResult) { 513 if (foundResult) {
516 future._complete(result); 514 future._complete(result);
517 return;} 515 return;}
518 if (defaultValue != null) { 516 if (defaultValue != null) {
519 _runUserCode(defaultValue, future._complete, future._completeError); 517 _runUserCode(defaultValue, future._complete, future._completeError);
520 return;} 518 return;}
521 try { 519 try {
522 throw IterableElementError.noElement(); 520 throw IterableElementError.noElement();
(...skipping 18 matching lines...) Expand all
541 throw IterableElementError.tooMany(); 539 throw IterableElementError.tooMany();
542 } 540 }
543 catch (e, s) { 541 catch (e, s) {
544 _cancelAndErrorWithReplacement(subscription, future, e, s); 542 _cancelAndErrorWithReplacement(subscription, future, e, s);
545 } 543 }
546 return;} 544 return;}
547 foundResult = true; 545 foundResult = true;
548 result = value; 546 result = value;
549 } 547 }
550 } 548 }
551 , ((__x42) => DEVC$RT.cast(__x42, dynamic, __CastType31, "CompositeCast", "" "line 1130, column 11 of dart:async/stream.dart: """, __x42 is __CastType31, fal se))(_cancelAndErrorClosure(subscription, future))); 549 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __CastType26, "CompositeCast", "" "line 1130, column 11 of dart:async/stream.dart: """, __x37 is __CastType26, fal se))(_cancelAndErrorClosure(subscription, future)));
552 } 550 }
553 , onError: future._completeError, onDone: () { 551 , onError: future._completeError, onDone: () {
554 if (foundResult) { 552 if (foundResult) {
555 future._complete(result); 553 future._complete(result);
556 return;} 554 return;}
557 try { 555 try {
558 throw IterableElementError.noElement(); 556 throw IterableElementError.noElement();
559 } 557 }
560 catch (e, s) { 558 catch (e, s) {
561 _completeWithErrorCallback(future, e, s); 559 _completeWithErrorCallback(future, e, s);
(...skipping 23 matching lines...) Expand all
585 void onTimeout(EventSink sink)} 583 void onTimeout(EventSink sink)}
586 ) { 584 ) {
587 StreamController controller; 585 StreamController controller;
588 StreamSubscription<T> subscription; 586 StreamSubscription<T> subscription;
589 Timer timer; 587 Timer timer;
590 Zone zone; 588 Zone zone;
591 Function timeout; 589 Function timeout;
592 void onData(T event) { 590 void onData(T event) {
593 timer.cancel(); 591 timer.cancel();
594 controller.add(event); 592 controller.add(event);
595 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype43, "CompositeCast", """line 1220, column 43 of dart:async/stream.dart: """, timeout is __CastType43, false)); 593 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype38, "CompositeCast", """line 1220, column 43 of dart:async/stream.dart: """, timeout is __CastType38, false));
596 } 594 }
597 void onError(error, StackTrace stackTrace) { 595 void onError(error, StackTrace stackTrace) {
598 timer.cancel(); 596 timer.cancel();
599 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller; 597 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller;
600 eventSink._addError(error, stackTrace); 598 eventSink._addError(error, stackTrace);
601 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype43, "CompositeCast", """line 1228, column 43 of dart:async/stream.dart: """, timeout is __CastType43, false)); 599 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype38, "CompositeCast", """line 1228, column 43 of dart:async/stream.dart: """, timeout is __CastType38, false));
602 } 600 }
603 void onDone() { 601 void onDone() {
604 timer.cancel(); 602 timer.cancel();
605 controller.close(); 603 controller.close();
606 } 604 }
607 void onListen() { 605 void onListen() {
608 zone = Zone.current; 606 zone = Zone.current;
609 if (onTimeout == null) { 607 if (onTimeout == null) {
610 timeout = () { 608 timeout = () {
611 controller.addError(new TimeoutException("No stream event", timeLimit), null); 609 controller.addError(new TimeoutException("No stream event", timeLimit), null);
612 } 610 }
613 ; 611 ;
614 } 612 }
615 else { 613 else {
616 onTimeout = ((__x46) => DEVC$RT.cast(__x46, ZoneUnaryCallback, __CastType4 4, "CompositeCast", """line 1246, column 21 of dart:async/stream.dart: """, __x4 6 is __CastType44, false))(zone.registerUnaryCallback(onTimeout)); 614 onTimeout = ((__x41) => DEVC$RT.cast(__x41, ZoneUnaryCallback, __CastType3 9, "CompositeCast", """line 1246, column 21 of dart:async/stream.dart: """, __x4 1 is __CastType39, false))(zone.registerUnaryCallback(onTimeout));
617 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l); 615 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l);
618 timeout = () { 616 timeout = () {
619 wrapper._sink = controller; 617 wrapper._sink = controller;
620 zone.runUnaryGuarded(onTimeout, wrapper); 618 zone.runUnaryGuarded(onTimeout, wrapper);
621 wrapper._sink = null; 619 wrapper._sink = null;
622 } 620 }
623 ; 621 ;
624 } 622 }
625 subscription = this.listen(onData, onError: onError, onDone: onDone); 623 subscription = this.listen(onData, onError: onError, onDone: onDone);
626 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype43, "CompositeCast", """line 1257, column 43 of dart:async/stream.dart: """, timeout is __CastType43, false)); 624 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype38, "CompositeCast", """line 1257, column 43 of dart:async/stream.dart: """, timeout is __CastType38, false));
627 } 625 }
628 Future onCancel() { 626 Future onCancel() {
629 timer.cancel(); 627 timer.cancel();
630 Future result = subscription.cancel(); 628 Future result = subscription.cancel();
631 subscription = null; 629 subscription = null;
632 return result; 630 return result;
633 } 631 }
634 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () { 632 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () {
635 timer.cancel(); 633 timer.cancel();
636 subscription.pause(); 634 subscription.pause();
637 } 635 }
638 , () { 636 , () {
639 subscription.resume(); 637 subscription.resume();
640 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype43, "CompositeCast", """line 1276, column 53 of dart:async/stream.dart: """, timeout is __CastType43, false)); 638 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT ype38, "CompositeCast", """line 1276, column 53 of dart:async/stream.dart: """, timeout is __CastType38, false));
641 } 639 }
642 , onCancel); 640 , onCancel);
643 return controller.stream; 641 return controller.stream;
644 } 642 }
645 } 643 }
646 abstract class StreamSubscription<T> {Future cancel(); 644 abstract class StreamSubscription<T> {Future cancel();
647 void onData(void handleData(T data)); 645 void onData(void handleData(T data));
648 void onError(Function handleError); 646 void onError(Function handleError);
649 void onDone(void handleDone()); 647 void onDone(void handleDone());
650 void pause([Future resumeSignal]); 648 void pause([Future resumeSignal]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 void add(T data) { 688 void add(T data) {
691 _sink.add(data); 689 _sink.add(data);
692 } 690 }
693 void addError(error, [StackTrace stackTrace]) { 691 void addError(error, [StackTrace stackTrace]) {
694 _sink.addError(error, stackTrace); 692 _sink.addError(error, stackTrace);
695 } 693 }
696 void close() { 694 void close() {
697 _sink.close(); 695 _sink.close();
698 } 696 }
699 } 697 }
700 typedef T __CastType20<T>(int __u21); 698 typedef EventSink<dynamic> __CastType20<T>(EventSink<T> __u21);
701 typedef dynamic __CastType22(dynamic __u23); 699 typedef void __CastType22(StreamSubscription<dynamic> __u23);
702 typedef EventSink<dynamic> __CastType25<T>(EventSink<T> __u26); 700 typedef void __CastType24<T>(StreamSubscription<T> __u25);
703 typedef void __CastType27(StreamSubscription<dynamic> __u28); 701 typedef dynamic __CastType26(dynamic __u27, StackTrace __u28);
704 typedef void __CastType29<T>(StreamSubscription<T> __u30); 702 typedef void __CastType38();
705 typedef dynamic __CastType31(dynamic __u32, StackTrace __u33); 703 typedef void __CastType39(EventSink<dynamic> __u40);
706 typedef void __CastType43();
707 typedef void __CastType44(EventSink<dynamic> __u45);
OLDNEW
« no previous file with comments | « test/checker/checker_test.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