OLD | NEW |
1 var async; | 1 var async; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic | 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic |
5 function _invokeErrorHandler(errorHandler, error, stackTrace) { | 5 function _invokeErrorHandler(errorHandler, error, stackTrace) { |
6 if (dart.is(errorHandler, ZoneBinaryCallback)) { | 6 if (dart.is(errorHandler, ZoneBinaryCallback)) { |
7 return dart.dcall(errorHandler, error, stackTrace); | 7 return dart.dcall(errorHandler, error, stackTrace); |
8 } else { | 8 } else { |
9 return dart.dcall(errorHandler, error); | 9 return dart.dcall(errorHandler, error); |
10 } | 10 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return new (_WhereStream$(T))(this, test); | 149 return new (_WhereStream$(T))(this, test); |
150 } | 150 } |
151 map(convert) { | 151 map(convert) { |
152 return new (_MapStream$(T, dart.dynamic))(this, convert); | 152 return new (_MapStream$(T, dart.dynamic))(this, convert); |
153 } | 153 } |
154 asyncMap(convert) { | 154 asyncMap(convert) { |
155 let controller = null; | 155 let controller = null; |
156 let subscription = null; | 156 let subscription = null; |
157 // Function onListen: () → void | 157 // Function onListen: () → void |
158 function onListen() { | 158 function onListen() { |
159 let add = controller.add; | 159 let add = controller.add.bind(controller); |
160 dart.assert(dart.is(controller, _StreamController) || dart.is(controll
er, _BroadcastStreamController)); | 160 dart.assert(dart.is(controller, _StreamController) || dart.is(controll
er, _BroadcastStreamController)); |
161 let eventSink = controller; | 161 let eventSink = controller; |
162 let addError = eventSink[_addError]; | 162 let addError = eventSink[_addError]; |
163 subscription = this.listen(event => { | 163 subscription = this.listen(event => { |
164 let newValue = null; | 164 let newValue = null; |
165 try { | 165 try { |
166 newValue = convert(event); | 166 newValue = convert(event); |
167 } catch (e) { | 167 } catch (e) { |
168 let s = dart.stackTrace(e); | 168 let s = dart.stackTrace(e); |
169 controller.addError(e, s); | 169 controller.addError(e, s); |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 if (dart.is(newValue, Future)) { | 173 if (dart.is(newValue, Future)) { |
174 subscription.pause(); | 174 subscription.pause(); |
175 dart.dsend(dart.dsend(newValue, 'then', add, {onError: addError}),
'whenComplete', subscription.resume); | 175 dart.dsend(dart.dsend(newValue, 'then', add, {onError: addError}),
'whenComplete', dart.bind(subscription, 'resume')); |
176 } else { | 176 } else { |
177 controller.add(newValue); | 177 controller.add(newValue); |
178 } | 178 } |
179 }, {onError: dart.as(addError, core.Function), onDone: controller.clos
e}); | 179 }, {onError: dart.as(addError, core.Function), onDone: controller.clos
e.bind(controller)}); |
180 } | 180 } |
181 if (this.isBroadcast) { | 181 if (this.isBroadcast) { |
182 controller = new StreamController.broadcast({ | 182 controller = new StreamController.broadcast({ |
183 onListen: onListen, | 183 onListen: onListen, |
184 onCancel: () => { | 184 onCancel: () => { |
185 subscription.cancel(); | 185 subscription.cancel(); |
186 }, | 186 }, |
187 sync: true | 187 sync: true |
188 }); | 188 }); |
189 } else { | 189 } else { |
(...skipping 25 matching lines...) Expand all Loading... |
215 try { | 215 try { |
216 newStream = convert(event); | 216 newStream = convert(event); |
217 } catch (e) { | 217 } catch (e) { |
218 let s = dart.stackTrace(e); | 218 let s = dart.stackTrace(e); |
219 controller.addError(e, s); | 219 controller.addError(e, s); |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 if (newStream != null) { | 223 if (newStream != null) { |
224 subscription.pause(); | 224 subscription.pause(); |
225 controller.addStream(newStream).whenComplete(subscription.resume); | 225 controller.addStream(newStream).whenComplete(dart.bind(subscriptio
n, 'resume')); |
226 } | 226 } |
227 }, {onError: dart.as(eventSink[_addError], core.Function), onDone: con
troller.close}); | 227 }, {onError: dart.as(eventSink[_addError], core.Function), onDone: con
troller.close.bind(controller)}); |
228 } | 228 } |
229 if (this.isBroadcast) { | 229 if (this.isBroadcast) { |
230 controller = new StreamController.broadcast({ | 230 controller = new StreamController.broadcast({ |
231 onListen: onListen, | 231 onListen: onListen, |
232 onCancel: () => { | 232 onCancel: () => { |
233 subscription.cancel(); | 233 subscription.cancel(); |
234 }, | 234 }, |
235 sync: true | 235 sync: true |
236 }); | 236 }); |
237 } else { | 237 } else { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 subscription = this.listen(element => { | 272 subscription = this.listen(element => { |
273 if (seenFirst) { | 273 if (seenFirst) { |
274 _runUserCode(() => combine(value, element), newValue => { | 274 _runUserCode(() => combine(value, element), newValue => { |
275 value = newValue; | 275 value = newValue; |
276 }, dart.as(_cancelAndErrorClosure(subscription, result), __CastType1
6)); | 276 }, dart.as(_cancelAndErrorClosure(subscription, result), __CastType1
6)); |
277 } else { | 277 } else { |
278 value = element; | 278 value = element; |
279 seenFirst = true; | 279 seenFirst = true; |
280 } | 280 } |
281 }, { | 281 }, { |
282 onError: result[_completeError], | 282 onError: result[_completeError].bind(result), |
283 onDone: () => { | 283 onDone: () => { |
284 if (!dart.notNull(seenFirst)) { | 284 if (!dart.notNull(seenFirst)) { |
285 try { | 285 try { |
286 throw _internal.IterableElementError.noElement(); | 286 throw _internal.IterableElementError.noElement(); |
287 } catch (e) { | 287 } catch (e) { |
288 let s = dart.stackTrace(e); | 288 let s = dart.stackTrace(e); |
289 _completeWithErrorCallback(result, e, s); | 289 _completeWithErrorCallback(result, e, s); |
290 } | 290 } |
291 | 291 |
292 } else { | 292 } else { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 contains(needle) { | 349 contains(needle) { |
350 let future = new (_Future$(core.bool))(); | 350 let future = new (_Future$(core.bool))(); |
351 let subscription = null; | 351 let subscription = null; |
352 subscription = this.listen(element => { | 352 subscription = this.listen(element => { |
353 _runUserCode(() => dart.equals(element, needle), isMatch => { | 353 _runUserCode(() => dart.equals(element, needle), isMatch => { |
354 if (isMatch) { | 354 if (isMatch) { |
355 _cancelAndValue(subscription, future, true); | 355 _cancelAndValue(subscription, future, true); |
356 } | 356 } |
357 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 357 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
358 }, { | 358 }, { |
359 onError: future[_completeError], | 359 onError: future[_completeError].bind(future), |
360 onDone: () => { | 360 onDone: () => { |
361 future[_complete](false); | 361 future[_complete](false); |
362 }, | 362 }, |
363 cancelOnError: true | 363 cancelOnError: true |
364 }); | 364 }); |
365 return future; | 365 return future; |
366 } | 366 } |
367 forEach(action) { | 367 forEach(action) { |
368 let future = new _Future(); | 368 let future = new _Future(); |
369 let subscription = null; | 369 let subscription = null; |
370 subscription = this.listen(element => { | 370 subscription = this.listen(element => { |
371 _runUserCode(() => action(element), _ => { | 371 _runUserCode(() => action(element), _ => { |
372 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 372 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
373 }, { | 373 }, { |
374 onError: future[_completeError], | 374 onError: future[_completeError].bind(future), |
375 onDone: () => { | 375 onDone: () => { |
376 future[_complete](null); | 376 future[_complete](null); |
377 }, | 377 }, |
378 cancelOnError: true | 378 cancelOnError: true |
379 }); | 379 }); |
380 return future; | 380 return future; |
381 } | 381 } |
382 every(test) { | 382 every(test) { |
383 let future = new (_Future$(core.bool))(); | 383 let future = new (_Future$(core.bool))(); |
384 let subscription = null; | 384 let subscription = null; |
385 subscription = this.listen(element => { | 385 subscription = this.listen(element => { |
386 _runUserCode(() => test(element), isMatch => { | 386 _runUserCode(() => test(element), isMatch => { |
387 if (!dart.notNull(isMatch)) { | 387 if (!dart.notNull(isMatch)) { |
388 _cancelAndValue(subscription, future, false); | 388 _cancelAndValue(subscription, future, false); |
389 } | 389 } |
390 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 390 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
391 }, { | 391 }, { |
392 onError: future[_completeError], | 392 onError: future[_completeError].bind(future), |
393 onDone: () => { | 393 onDone: () => { |
394 future[_complete](true); | 394 future[_complete](true); |
395 }, | 395 }, |
396 cancelOnError: true | 396 cancelOnError: true |
397 }); | 397 }); |
398 return future; | 398 return future; |
399 } | 399 } |
400 any(test) { | 400 any(test) { |
401 let future = new (_Future$(core.bool))(); | 401 let future = new (_Future$(core.bool))(); |
402 let subscription = null; | 402 let subscription = null; |
403 subscription = this.listen(element => { | 403 subscription = this.listen(element => { |
404 _runUserCode(() => test(element), isMatch => { | 404 _runUserCode(() => test(element), isMatch => { |
405 if (isMatch) { | 405 if (isMatch) { |
406 _cancelAndValue(subscription, future, true); | 406 _cancelAndValue(subscription, future, true); |
407 } | 407 } |
408 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 408 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
409 }, { | 409 }, { |
410 onError: future[_completeError], | 410 onError: future[_completeError].bind(future), |
411 onDone: () => { | 411 onDone: () => { |
412 future[_complete](false); | 412 future[_complete](false); |
413 }, | 413 }, |
414 cancelOnError: true | 414 cancelOnError: true |
415 }); | 415 }); |
416 return future; | 416 return future; |
417 } | 417 } |
418 get length() { | 418 get length() { |
419 let future = new (_Future$(core.int))(); | 419 let future = new (_Future$(core.int))(); |
420 let count = 0; | 420 let count = 0; |
421 this.listen(_ => { | 421 this.listen(_ => { |
422 count = dart.notNull(count) + 1; | 422 count = dart.notNull(count) + 1; |
423 }, { | 423 }, { |
424 onError: future[_completeError], | 424 onError: future[_completeError].bind(future), |
425 onDone: () => { | 425 onDone: () => { |
426 future[_complete](count); | 426 future[_complete](count); |
427 }, | 427 }, |
428 cancelOnError: true | 428 cancelOnError: true |
429 }); | 429 }); |
430 return future; | 430 return future; |
431 } | 431 } |
432 get isEmpty() { | 432 get isEmpty() { |
433 let future = new (_Future$(core.bool))(); | 433 let future = new (_Future$(core.bool))(); |
434 let subscription = null; | 434 let subscription = null; |
435 subscription = this.listen(_ => { | 435 subscription = this.listen(_ => { |
436 _cancelAndValue(subscription, future, false); | 436 _cancelAndValue(subscription, future, false); |
437 }, { | 437 }, { |
438 onError: future[_completeError], | 438 onError: future[_completeError].bind(future), |
439 onDone: () => { | 439 onDone: () => { |
440 future[_complete](true); | 440 future[_complete](true); |
441 }, | 441 }, |
442 cancelOnError: true | 442 cancelOnError: true |
443 }); | 443 }); |
444 return future; | 444 return future; |
445 } | 445 } |
446 toList() { | 446 toList() { |
447 let result = dart.setType([], core.List$(T)); | 447 let result = dart.setType([], core.List$(T)); |
448 let future = new (_Future$(core.List$(T)))(); | 448 let future = new (_Future$(core.List$(T)))(); |
449 this.listen(data => { | 449 this.listen(data => { |
450 result[core.$add](data); | 450 result[core.$add](data); |
451 }, { | 451 }, { |
452 onError: future[_completeError], | 452 onError: future[_completeError].bind(future), |
453 onDone: () => { | 453 onDone: () => { |
454 future[_complete](result); | 454 future[_complete](result); |
455 }, | 455 }, |
456 cancelOnError: true | 456 cancelOnError: true |
457 }); | 457 }); |
458 return future; | 458 return future; |
459 } | 459 } |
460 toSet() { | 460 toSet() { |
461 let result = new (core.Set$(T))(); | 461 let result = new (core.Set$(T))(); |
462 let future = new (_Future$(core.Set$(T)))(); | 462 let future = new (_Future$(core.Set$(T)))(); |
463 this.listen(data => { | 463 this.listen(data => { |
464 result.add(data); | 464 result.add(data); |
465 }, { | 465 }, { |
466 onError: future[_completeError], | 466 onError: future[_completeError].bind(future), |
467 onDone: () => { | 467 onDone: () => { |
468 future[_complete](result); | 468 future[_complete](result); |
469 }, | 469 }, |
470 cancelOnError: true | 470 cancelOnError: true |
471 }); | 471 }); |
472 return future; | 472 return future; |
473 } | 473 } |
474 drain(futureValue) { | 474 drain(futureValue) { |
475 if (futureValue === void 0) | 475 if (futureValue === void 0) |
476 futureValue = null; | 476 futureValue = null; |
(...skipping 15 matching lines...) Expand all Loading... |
492 if (equals === void 0) | 492 if (equals === void 0) |
493 equals = null; | 493 equals = null; |
494 return new (_DistinctStream$(T))(this, equals); | 494 return new (_DistinctStream$(T))(this, equals); |
495 } | 495 } |
496 get first() { | 496 get first() { |
497 let future = new (_Future$(T))(); | 497 let future = new (_Future$(T))(); |
498 let subscription = null; | 498 let subscription = null; |
499 subscription = this.listen(value => { | 499 subscription = this.listen(value => { |
500 _cancelAndValue(subscription, future, value); | 500 _cancelAndValue(subscription, future, value); |
501 }, { | 501 }, { |
502 onError: future[_completeError], | 502 onError: future[_completeError].bind(future), |
503 onDone: () => { | 503 onDone: () => { |
504 try { | 504 try { |
505 throw _internal.IterableElementError.noElement(); | 505 throw _internal.IterableElementError.noElement(); |
506 } catch (e) { | 506 } catch (e) { |
507 let s = dart.stackTrace(e); | 507 let s = dart.stackTrace(e); |
508 _completeWithErrorCallback(future, e, s); | 508 _completeWithErrorCallback(future, e, s); |
509 } | 509 } |
510 | 510 |
511 }, | 511 }, |
512 cancelOnError: true | 512 cancelOnError: true |
513 }); | 513 }); |
514 return future; | 514 return future; |
515 } | 515 } |
516 get last() { | 516 get last() { |
517 let future = new (_Future$(T))(); | 517 let future = new (_Future$(T))(); |
518 let result = null; | 518 let result = null; |
519 let foundResult = false; | 519 let foundResult = false; |
520 let subscription = null; | 520 let subscription = null; |
521 subscription = this.listen(value => { | 521 subscription = this.listen(value => { |
522 foundResult = true; | 522 foundResult = true; |
523 result = value; | 523 result = value; |
524 }, { | 524 }, { |
525 onError: future[_completeError], | 525 onError: future[_completeError].bind(future), |
526 onDone: () => { | 526 onDone: () => { |
527 if (foundResult) { | 527 if (foundResult) { |
528 future[_complete](result); | 528 future[_complete](result); |
529 return; | 529 return; |
530 } | 530 } |
531 try { | 531 try { |
532 throw _internal.IterableElementError.noElement(); | 532 throw _internal.IterableElementError.noElement(); |
533 } catch (e) { | 533 } catch (e) { |
534 let s = dart.stackTrace(e); | 534 let s = dart.stackTrace(e); |
535 _completeWithErrorCallback(future, e, s); | 535 _completeWithErrorCallback(future, e, s); |
(...skipping 16 matching lines...) Expand all Loading... |
552 } catch (e) { | 552 } catch (e) { |
553 let s = dart.stackTrace(e); | 553 let s = dart.stackTrace(e); |
554 _cancelAndErrorWithReplacement(subscription, future, e, s); | 554 _cancelAndErrorWithReplacement(subscription, future, e, s); |
555 } | 555 } |
556 | 556 |
557 return; | 557 return; |
558 } | 558 } |
559 foundResult = true; | 559 foundResult = true; |
560 result = value; | 560 result = value; |
561 }, { | 561 }, { |
562 onError: future[_completeError], | 562 onError: future[_completeError].bind(future), |
563 onDone: () => { | 563 onDone: () => { |
564 if (foundResult) { | 564 if (foundResult) { |
565 future[_complete](result); | 565 future[_complete](result); |
566 return; | 566 return; |
567 } | 567 } |
568 try { | 568 try { |
569 throw _internal.IterableElementError.noElement(); | 569 throw _internal.IterableElementError.noElement(); |
570 } catch (e) { | 570 } catch (e) { |
571 let s = dart.stackTrace(e); | 571 let s = dart.stackTrace(e); |
572 _completeWithErrorCallback(future, e, s); | 572 _completeWithErrorCallback(future, e, s); |
573 } | 573 } |
574 | 574 |
575 }, | 575 }, |
576 cancelOnError: true | 576 cancelOnError: true |
577 }); | 577 }); |
578 return future; | 578 return future; |
579 } | 579 } |
580 firstWhere(test, opts) { | 580 firstWhere(test, opts) { |
581 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; | 581 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; |
582 let future = new _Future(); | 582 let future = new _Future(); |
583 let subscription = null; | 583 let subscription = null; |
584 subscription = this.listen(value => { | 584 subscription = this.listen(value => { |
585 _runUserCode(() => test(value), isMatch => { | 585 _runUserCode(() => test(value), isMatch => { |
586 if (isMatch) { | 586 if (isMatch) { |
587 _cancelAndValue(subscription, future, value); | 587 _cancelAndValue(subscription, future, value); |
588 } | 588 } |
589 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 589 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
590 }, { | 590 }, { |
591 onError: future[_completeError], | 591 onError: future[_completeError].bind(future), |
592 onDone: () => { | 592 onDone: () => { |
593 if (defaultValue != null) { | 593 if (defaultValue != null) { |
594 _runUserCode(defaultValue, future[_complete], future[_completeErro
r]); | 594 _runUserCode(defaultValue, future[_complete].bind(future), future[
_completeError].bind(future)); |
595 return; | 595 return; |
596 } | 596 } |
597 try { | 597 try { |
598 throw _internal.IterableElementError.noElement(); | 598 throw _internal.IterableElementError.noElement(); |
599 } catch (e) { | 599 } catch (e) { |
600 let s = dart.stackTrace(e); | 600 let s = dart.stackTrace(e); |
601 _completeWithErrorCallback(future, e, s); | 601 _completeWithErrorCallback(future, e, s); |
602 } | 602 } |
603 | 603 |
604 }, | 604 }, |
605 cancelOnError: true | 605 cancelOnError: true |
606 }); | 606 }); |
607 return future; | 607 return future; |
608 } | 608 } |
609 lastWhere(test, opts) { | 609 lastWhere(test, opts) { |
610 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; | 610 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; |
611 let future = new _Future(); | 611 let future = new _Future(); |
612 let result = null; | 612 let result = null; |
613 let foundResult = false; | 613 let foundResult = false; |
614 let subscription = null; | 614 let subscription = null; |
615 subscription = this.listen(value => { | 615 subscription = this.listen(value => { |
616 _runUserCode(() => true == test(value), isMatch => { | 616 _runUserCode(() => true == test(value), isMatch => { |
617 if (isMatch) { | 617 if (isMatch) { |
618 foundResult = true; | 618 foundResult = true; |
619 result = value; | 619 result = value; |
620 } | 620 } |
621 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 621 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
622 }, { | 622 }, { |
623 onError: future[_completeError], | 623 onError: future[_completeError].bind(future), |
624 onDone: () => { | 624 onDone: () => { |
625 if (foundResult) { | 625 if (foundResult) { |
626 future[_complete](result); | 626 future[_complete](result); |
627 return; | 627 return; |
628 } | 628 } |
629 if (defaultValue != null) { | 629 if (defaultValue != null) { |
630 _runUserCode(defaultValue, future[_complete], future[_completeErro
r]); | 630 _runUserCode(defaultValue, future[_complete].bind(future), future[
_completeError].bind(future)); |
631 return; | 631 return; |
632 } | 632 } |
633 try { | 633 try { |
634 throw _internal.IterableElementError.noElement(); | 634 throw _internal.IterableElementError.noElement(); |
635 } catch (e) { | 635 } catch (e) { |
636 let s = dart.stackTrace(e); | 636 let s = dart.stackTrace(e); |
637 _completeWithErrorCallback(future, e, s); | 637 _completeWithErrorCallback(future, e, s); |
638 } | 638 } |
639 | 639 |
640 }, | 640 }, |
(...skipping 17 matching lines...) Expand all Loading... |
658 _cancelAndErrorWithReplacement(subscription, future, e, s); | 658 _cancelAndErrorWithReplacement(subscription, future, e, s); |
659 } | 659 } |
660 | 660 |
661 return; | 661 return; |
662 } | 662 } |
663 foundResult = true; | 663 foundResult = true; |
664 result = value; | 664 result = value; |
665 } | 665 } |
666 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); | 666 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function
Type(dart.dynamic, [dart.dynamic, core.StackTrace]))); |
667 }, { | 667 }, { |
668 onError: future[_completeError], | 668 onError: future[_completeError].bind(future), |
669 onDone: () => { | 669 onDone: () => { |
670 if (foundResult) { | 670 if (foundResult) { |
671 future[_complete](result); | 671 future[_complete](result); |
672 return; | 672 return; |
673 } | 673 } |
674 try { | 674 try { |
675 throw _internal.IterableElementError.noElement(); | 675 throw _internal.IterableElementError.noElement(); |
676 } catch (e) { | 676 } catch (e) { |
677 let s = dart.stackTrace(e); | 677 let s = dart.stackTrace(e); |
678 _completeWithErrorCallback(future, e, s); | 678 _completeWithErrorCallback(future, e, s); |
(...skipping 10 matching lines...) Expand all Loading... |
689 let future = new (_Future$(T))(); | 689 let future = new (_Future$(T))(); |
690 let subscription = null; | 690 let subscription = null; |
691 let elementIndex = 0; | 691 let elementIndex = 0; |
692 subscription = this.listen(value => { | 692 subscription = this.listen(value => { |
693 if (index == elementIndex) { | 693 if (index == elementIndex) { |
694 _cancelAndValue(subscription, future, value); | 694 _cancelAndValue(subscription, future, value); |
695 return; | 695 return; |
696 } | 696 } |
697 elementIndex = dart.notNull(elementIndex) + 1; | 697 elementIndex = dart.notNull(elementIndex) + 1; |
698 }, { | 698 }, { |
699 onError: future[_completeError], | 699 onError: future[_completeError].bind(future), |
700 onDone: (() => { | 700 onDone: (() => { |
701 future[_completeError](new core.RangeError.index(index, this, "index
", null, elementIndex)); | 701 future[_completeError](new core.RangeError.index(index, this, "index
", null, elementIndex)); |
702 }).bind(this), | 702 }).bind(this), |
703 cancelOnError: true | 703 cancelOnError: true |
704 }); | 704 }); |
705 return future; | 705 return future; |
706 } | 706 } |
707 timeout(timeLimit, opts) { | 707 timeout(timeLimit, opts) { |
708 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; | 708 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; |
709 let controller = null; | 709 let controller = null; |
710 let subscription = null; | 710 let subscription = null; |
711 let timer = null; | 711 let timer = null; |
712 let zone = null; | 712 let zone = null; |
713 let timeout = null; | 713 let timeout = null; |
714 // Function onData: (T) → void | 714 // Function onData: (T) → void |
715 function onData(event) { | 715 function onData(event) { |
716 timer.cancel(); | 716 timer.cancel(); |
717 controller.add(event); | 717 controller.add(event); |
718 timer = zone.createTimer(timeLimit, dart.as(timeout, __CastType19)); | 718 timer = zone.createTimer(timeLimit, dart.as(timeout, __CastType19)); |
719 } | 719 } |
720 // Function onError: (dynamic, StackTrace) → void | 720 // Function onError: (dynamic, StackTrace) → void |
721 function onError(error, stackTrace) { | 721 function onError(error, stackTrace) { |
722 timer.cancel(); | 722 timer.cancel(); |
723 dart.assert(dart.is(controller, _StreamController) || dart.is(controll
er, _BroadcastStreamController)); | 723 dart.assert(dart.is(controller, _StreamController) || dart.is(controll
er, _BroadcastStreamController)); |
724 let eventSink = controller; | 724 let eventSink = controller; |
725 dart.dsend(eventSink, _addError, error, stackTrace); | 725 dart.dcall(eventSink[_addError], error, stackTrace); |
726 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType
(dart.void, []))); | 726 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType
(dart.void, []))); |
727 } | 727 } |
728 // Function onDone: () → void | 728 // Function onDone: () → void |
729 function onDone() { | 729 function onDone() { |
730 timer.cancel(); | 730 timer.cancel(); |
731 controller.close(); | 731 controller.close(); |
732 } | 732 } |
733 // Function onListen: () → void | 733 // Function onListen: () → void |
734 function onListen() { | 734 function onListen() { |
735 zone = Zone.current; | 735 zone = Zone.current; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 } | 934 } |
935 pause(resumeSignal) { | 935 pause(resumeSignal) { |
936 if (resumeSignal === void 0) | 936 if (resumeSignal === void 0) |
937 resumeSignal = null; | 937 resumeSignal = null; |
938 if (this[_isCanceled]) | 938 if (this[_isCanceled]) |
939 return; | 939 return; |
940 let wasPaused = this[_isPaused]; | 940 let wasPaused = this[_isPaused]; |
941 let wasInputPaused = this[_isInputPaused]; | 941 let wasInputPaused = this[_isInputPaused]; |
942 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea
mSubscription[_STATE_PAUSE_COUNT]) | dart.notNull(_BufferingStreamSubscription[_
STATE_INPUT_PAUSED]); | 942 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea
mSubscription[_STATE_PAUSE_COUNT]) | dart.notNull(_BufferingStreamSubscription[_
STATE_INPUT_PAUSED]); |
943 if (resumeSignal != null) | 943 if (resumeSignal != null) |
944 resumeSignal.whenComplete(this.resume); | 944 resumeSignal.whenComplete(this.resume.bind(this)); |
945 if (!dart.notNull(wasPaused) && dart.notNull(this[_pending] != null)) | 945 if (!dart.notNull(wasPaused) && dart.notNull(this[_pending] != null)) |
946 this[_pending].cancelSchedule(); | 946 this[_pending].cancelSchedule(); |
947 if (!dart.notNull(wasInputPaused) && !dart.notNull(this[_inCallback])) | 947 if (!dart.notNull(wasInputPaused) && !dart.notNull(this[_inCallback])) |
948 this[_guardCallback](this[_onPause]); | 948 this[_guardCallback](this[_onPause].bind(this)); |
949 } | 949 } |
950 resume() { | 950 resume() { |
951 if (this[_isCanceled]) | 951 if (this[_isCanceled]) |
952 return; | 952 return; |
953 if (this[_isPaused]) { | 953 if (this[_isPaused]) { |
954 this[_decrementPauseCount](); | 954 this[_decrementPauseCount](); |
955 if (!dart.notNull(this[_isPaused])) { | 955 if (!dart.notNull(this[_isPaused])) { |
956 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending].
isEmpty)) { | 956 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending].
isEmpty)) { |
957 this[_pending].schedule(this); | 957 this[_pending].schedule(this); |
958 } else { | 958 } else { |
959 dart.assert(this[_mayResumeInput]); | 959 dart.assert(this[_mayResumeInput]); |
960 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi
ngStreamSubscription[_STATE_INPUT_PAUSED]); | 960 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi
ngStreamSubscription[_STATE_INPUT_PAUSED]); |
961 if (!dart.notNull(this[_inCallback])) | 961 if (!dart.notNull(this[_inCallback])) |
962 this[_guardCallback](this[_onResume]); | 962 this[_guardCallback](this[_onResume].bind(this)); |
963 } | 963 } |
964 } | 964 } |
965 } | 965 } |
966 } | 966 } |
967 cancel() { | 967 cancel() { |
968 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre
amSubscription[_STATE_WAIT_FOR_CANCEL]); | 968 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre
amSubscription[_STATE_WAIT_FOR_CANCEL]); |
969 if (this[_isCanceled]) | 969 if (this[_isCanceled]) |
970 return this[_cancelFuture]; | 970 return this[_cancelFuture]; |
971 this[_cancel](); | 971 this[_cancel](); |
972 return this[_cancelFuture]; | 972 return this[_cancelFuture]; |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 _DoneSubscription() { | 1617 _DoneSubscription() { |
1618 this[_pauseCount] = 0; | 1618 this[_pauseCount] = 0; |
1619 } | 1619 } |
1620 onData(handleData) {} | 1620 onData(handleData) {} |
1621 onError(handleError) {} | 1621 onError(handleError) {} |
1622 onDone(handleDone) {} | 1622 onDone(handleDone) {} |
1623 pause(resumeSignal) { | 1623 pause(resumeSignal) { |
1624 if (resumeSignal === void 0) | 1624 if (resumeSignal === void 0) |
1625 resumeSignal = null; | 1625 resumeSignal = null; |
1626 if (resumeSignal != null) | 1626 if (resumeSignal != null) |
1627 resumeSignal.then(this[_resume]); | 1627 resumeSignal.then(this[_resume].bind(this)); |
1628 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1; | 1628 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1; |
1629 } | 1629 } |
1630 resume() { | 1630 resume() { |
1631 this[_resume](null); | 1631 this[_resume](null); |
1632 } | 1632 } |
1633 [_resume](_) { | 1633 [_resume](_) { |
1634 if (dart.notNull(this[_pauseCount]) > 0) { | 1634 if (dart.notNull(this[_pauseCount]) > 0) { |
1635 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1; | 1635 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1; |
1636 } | 1636 } |
1637 } | 1637 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 if (!dart.notNull(iterator.moveNext())) | 1814 if (!dart.notNull(iterator.moveNext())) |
1815 return false; | 1815 return false; |
1816 return new Future.sync(() => dart.dcall(f, iterator.current)).then(_ =
> true); | 1816 return new Future.sync(() => dart.dcall(f, iterator.current)).then(_ =
> true); |
1817 }); | 1817 }); |
1818 } | 1818 } |
1819 static doWhile(f) { | 1819 static doWhile(f) { |
1820 let doneSignal = new _Future(); | 1820 let doneSignal = new _Future(); |
1821 let nextIteration = null; | 1821 let nextIteration = null; |
1822 nextIteration = Zone.current.bindUnaryCallback(keepGoing => { | 1822 nextIteration = Zone.current.bindUnaryCallback(keepGoing => { |
1823 if (keepGoing) { | 1823 if (keepGoing) { |
1824 new Future.sync(f).then(dart.as(nextIteration, __CastType4), {onErro
r: doneSignal[_completeError]}); | 1824 new Future.sync(f).then(dart.as(nextIteration, __CastType4), {onErro
r: doneSignal[_completeError].bind(doneSignal)}); |
1825 } else { | 1825 } else { |
1826 doneSignal[_complete](null); | 1826 doneSignal[_complete](null); |
1827 } | 1827 } |
1828 }, {runGuarded: true}); | 1828 }, {runGuarded: true}); |
1829 dart.dcall(nextIteration, true); | 1829 dart.dcall(nextIteration, true); |
1830 return doneSignal; | 1830 return doneSignal; |
1831 } | 1831 } |
1832 } | 1832 } |
1833 dart.defineNamedConstructor(Future, 'microtask'); | 1833 dart.defineNamedConstructor(Future, 'microtask'); |
1834 dart.defineNamedConstructor(Future, 'sync'); | 1834 dart.defineNamedConstructor(Future, 'sync'); |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3116 } | 3116 } |
3117 } | 3117 } |
3118 _StreamSinkWrapper[dart.implements] = () => [StreamSink$(T)]; | 3118 _StreamSinkWrapper[dart.implements] = () => [StreamSink$(T)]; |
3119 return _StreamSinkWrapper; | 3119 return _StreamSinkWrapper; |
3120 }); | 3120 }); |
3121 let _StreamSinkWrapper = _StreamSinkWrapper$(); | 3121 let _StreamSinkWrapper = _StreamSinkWrapper$(); |
3122 let _AddStreamState$ = dart.generic(function(T) { | 3122 let _AddStreamState$ = dart.generic(function(T) { |
3123 class _AddStreamState extends core.Object { | 3123 class _AddStreamState extends core.Object { |
3124 _AddStreamState(controller, source, cancelOnError) { | 3124 _AddStreamState(controller, source, cancelOnError) { |
3125 this.addStreamFuture = new _Future(); | 3125 this.addStreamFuture = new _Future(); |
3126 this.addSubscription = source.listen(controller[_add], {onError: dart.as
(cancelOnError ? _AddStreamState.makeErrorHandler(controller) : controller[_addE
rror], core.Function), onDone: controller[_close], cancelOnError: cancelOnError}
); | 3126 this.addSubscription = source.listen(controller[_add].bind(controller),
{onError: dart.as(cancelOnError ? _AddStreamState.makeErrorHandler(controller) :
controller[_addError].bind(controller), core.Function), onDone: controller[_clo
se].bind(controller), cancelOnError: cancelOnError}); |
3127 } | 3127 } |
3128 static makeErrorHandler(controller) { | 3128 static makeErrorHandler(controller) { |
3129 return (e, s) => { | 3129 return (e, s) => { |
3130 controller[_addError](e, s); | 3130 controller[_addError](e, s); |
3131 controller[_close](); | 3131 controller[_close](); |
3132 }; | 3132 }; |
3133 } | 3133 } |
3134 pause() { | 3134 pause() { |
3135 this.addSubscription.pause(); | 3135 this.addSubscription.pause(); |
3136 } | 3136 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3407 } | 3407 } |
3408 get [_isScheduled]() { | 3408 get [_isScheduled]() { |
3409 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio
n[_SCHEDULED])) != 0; | 3409 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio
n[_SCHEDULED])) != 0; |
3410 } | 3410 } |
3411 get isPaused() { | 3411 get isPaused() { |
3412 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio
n[_PAUSED]); | 3412 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio
n[_PAUSED]); |
3413 } | 3413 } |
3414 [_schedule]() { | 3414 [_schedule]() { |
3415 if (this[_isScheduled]) | 3415 if (this[_isScheduled]) |
3416 return; | 3416 return; |
3417 this[_zone].scheduleMicrotask(this[_sendDone]); | 3417 this[_zone].scheduleMicrotask(this[_sendDone].bind(this)); |
3418 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs
cription[_SCHEDULED]); | 3418 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs
cription[_SCHEDULED]); |
3419 } | 3419 } |
3420 onData(handleData) {} | 3420 onData(handleData) {} |
3421 onError(handleError) {} | 3421 onError(handleError) {} |
3422 onDone(handleDone) { | 3422 onDone(handleDone) { |
3423 this[_onDone] = handleDone; | 3423 this[_onDone] = handleDone; |
3424 } | 3424 } |
3425 pause(resumeSignal) { | 3425 pause(resumeSignal) { |
3426 if (resumeSignal === void 0) | 3426 if (resumeSignal === void 0) |
3427 resumeSignal = null; | 3427 resumeSignal = null; |
3428 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs
cription[_PAUSED]); | 3428 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs
cription[_PAUSED]); |
3429 if (resumeSignal != null) | 3429 if (resumeSignal != null) |
3430 resumeSignal.whenComplete(this.resume); | 3430 resumeSignal.whenComplete(this.resume.bind(this)); |
3431 } | 3431 } |
3432 resume() { | 3432 resume() { |
3433 if (this.isPaused) { | 3433 if (this.isPaused) { |
3434 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu
bscription[_PAUSED]); | 3434 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu
bscription[_PAUSED]); |
3435 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { | 3435 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { |
3436 this[_schedule](); | 3436 this[_schedule](); |
3437 } | 3437 } |
3438 } | 3438 } |
3439 } | 3439 } |
3440 cancel() { | 3440 cancel() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 let _AsBroadcastStream$ = dart.generic(function(T) { | 3475 let _AsBroadcastStream$ = dart.generic(function(T) { |
3476 class _AsBroadcastStream extends Stream$(T) { | 3476 class _AsBroadcastStream extends Stream$(T) { |
3477 _AsBroadcastStream(source, onListenHandler, onCancelHandler) { | 3477 _AsBroadcastStream(source, onListenHandler, onCancelHandler) { |
3478 this[_source] = source; | 3478 this[_source] = source; |
3479 this[_onListenHandler] = dart.as(Zone.current.registerUnaryCallback(onLi
stenHandler), _broadcastCallback); | 3479 this[_onListenHandler] = dart.as(Zone.current.registerUnaryCallback(onLi
stenHandler), _broadcastCallback); |
3480 this[_onCancelHandler] = dart.as(Zone.current.registerUnaryCallback(onCa
ncelHandler), _broadcastCallback); | 3480 this[_onCancelHandler] = dart.as(Zone.current.registerUnaryCallback(onCa
ncelHandler), _broadcastCallback); |
3481 this[_zone] = Zone.current; | 3481 this[_zone] = Zone.current; |
3482 this[_controller] = null; | 3482 this[_controller] = null; |
3483 this[_subscription] = null; | 3483 this[_subscription] = null; |
3484 super.Stream(); | 3484 super.Stream(); |
3485 this[_controller] = new (_AsBroadcastStreamController$(T))(this[_onListe
n], this[_onCancel]); | 3485 this[_controller] = new (_AsBroadcastStreamController$(T))(this[_onListe
n].bind(this), this[_onCancel].bind(this)); |
3486 } | 3486 } |
3487 get isBroadcast() { | 3487 get isBroadcast() { |
3488 return true; | 3488 return true; |
3489 } | 3489 } |
3490 listen(onData, opts) { | 3490 listen(onData, opts) { |
3491 let onError = opts && 'onError' in opts ? opts.onError : null; | 3491 let onError = opts && 'onError' in opts ? opts.onError : null; |
3492 let onDone = opts && 'onDone' in opts ? opts.onDone : null; | 3492 let onDone = opts && 'onDone' in opts ? opts.onDone : null; |
3493 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; | 3493 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; |
3494 if (dart.notNull(this[_controller] == null) || dart.notNull(this[_contro
ller].isClosed)) { | 3494 if (dart.notNull(this[_controller] == null) || dart.notNull(this[_contro
ller].isClosed)) { |
3495 return new (_DoneStreamSubscription$(T))(onDone); | 3495 return new (_DoneStreamSubscription$(T))(onDone); |
3496 } | 3496 } |
3497 if (this[_subscription] == null) { | 3497 if (this[_subscription] == null) { |
3498 this[_subscription] = this[_source].listen(this[_controller].add, {onE
rror: this[_controller].addError, onDone: this[_controller].close}); | 3498 this[_subscription] = this[_source].listen(dart.bind(this[_controller]
, 'add'), {onError: dart.bind(this[_controller], 'addError'), onDone: dart.bind(
this[_controller], 'close')}); |
3499 } | 3499 } |
3500 cancelOnError = core.identical(true, cancelOnError); | 3500 cancelOnError = core.identical(true, cancelOnError); |
3501 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr
ror); | 3501 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr
ror); |
3502 } | 3502 } |
3503 [_onCancel]() { | 3503 [_onCancel]() { |
3504 let shutdown = dart.notNull(this[_controller] == null) || dart.notNull(t
his[_controller].isClosed); | 3504 let shutdown = dart.notNull(this[_controller] == null) || dart.notNull(t
his[_controller].isClosed); |
3505 if (this[_onCancelHandler] != null) { | 3505 if (this[_onCancelHandler] != null) { |
3506 this[_zone].runUnary(this[_onCancelHandler], new _BroadcastSubscriptio
nWrapper(this)); | 3506 this[_zone].runUnary(this[_onCancelHandler], new _BroadcastSubscriptio
nWrapper(this)); |
3507 } | 3507 } |
3508 if (shutdown) { | 3508 if (shutdown) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3592 let _STATE_EXTRA_ERROR = Symbol('_STATE_EXTRA_ERROR'); | 3592 let _STATE_EXTRA_ERROR = Symbol('_STATE_EXTRA_ERROR'); |
3593 let _clear = Symbol('_clear'); | 3593 let _clear = Symbol('_clear'); |
3594 let _STATE_EXTRA_DONE = Symbol('_STATE_EXTRA_DONE'); | 3594 let _STATE_EXTRA_DONE = Symbol('_STATE_EXTRA_DONE'); |
3595 let _StreamIteratorImpl$ = dart.generic(function(T) { | 3595 let _StreamIteratorImpl$ = dart.generic(function(T) { |
3596 class _StreamIteratorImpl extends core.Object { | 3596 class _StreamIteratorImpl extends core.Object { |
3597 _StreamIteratorImpl(stream) { | 3597 _StreamIteratorImpl(stream) { |
3598 this[_subscription] = null; | 3598 this[_subscription] = null; |
3599 this[_current] = null; | 3599 this[_current] = null; |
3600 this[_futureOrPrefetch] = null; | 3600 this[_futureOrPrefetch] = null; |
3601 this[_state] = _StreamIteratorImpl[_STATE_FOUND]; | 3601 this[_state] = _StreamIteratorImpl[_STATE_FOUND]; |
3602 this[_subscription] = stream.listen(this[_onData], {onError: this[_onErr
or], onDone: this[_onDone], cancelOnError: true}); | 3602 this[_subscription] = stream.listen(this[_onData].bind(this), {onError:
this[_onError].bind(this), onDone: this[_onDone].bind(this), cancelOnError: true
}); |
3603 } | 3603 } |
3604 get current() { | 3604 get current() { |
3605 return this[_current]; | 3605 return this[_current]; |
3606 } | 3606 } |
3607 moveNext() { | 3607 moveNext() { |
3608 if (this[_state] == _StreamIteratorImpl[_STATE_DONE]) { | 3608 if (this[_state] == _StreamIteratorImpl[_STATE_DONE]) { |
3609 return new _Future$(core.bool).immediate(false); | 3609 return new _Future$(core.bool).immediate(false); |
3610 } | 3610 } |
3611 if (this[_state] == _StreamIteratorImpl[_STATE_MOVING]) { | 3611 if (this[_state] == _StreamIteratorImpl[_STATE_MOVING]) { |
3612 throw new core.StateError("Already waiting for next."); | 3612 throw new core.StateError("Already waiting for next."); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 } | 3798 } |
3799 return _ForwardingStream; | 3799 return _ForwardingStream; |
3800 }); | 3800 }); |
3801 let _ForwardingStream = _ForwardingStream$(); | 3801 let _ForwardingStream = _ForwardingStream$(); |
3802 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) { | 3802 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) { |
3803 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T)
{ | 3803 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T)
{ |
3804 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr
or) { | 3804 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr
or) { |
3805 this[_stream] = stream; | 3805 this[_stream] = stream; |
3806 this[_subscription] = null; | 3806 this[_subscription] = null; |
3807 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); | 3807 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); |
3808 this[_subscription] = this[_stream][_source].listen(this[_handleData], {
onError: this[_handleError], onDone: this[_handleDone]}); | 3808 this[_subscription] = this[_stream][_source].listen(this[_handleData].bi
nd(this), {onError: this[_handleError].bind(this), onDone: this[_handleDone].bin
d(this)}); |
3809 } | 3809 } |
3810 [_add](data) { | 3810 [_add](data) { |
3811 if (this[_isClosed]) | 3811 if (this[_isClosed]) |
3812 return; | 3812 return; |
3813 super[_add](data); | 3813 super[_add](data); |
3814 } | 3814 } |
3815 [_addError](error, stackTrace) { | 3815 [_addError](error, stackTrace) { |
3816 if (this[_isClosed]) | 3816 if (this[_isClosed]) |
3817 return; | 3817 return; |
3818 super[_addError](error, stackTrace); | 3818 super[_addError](error, stackTrace); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4150 let _transformerSink = Symbol('_transformerSink'); | 4150 let _transformerSink = Symbol('_transformerSink'); |
4151 let _isSubscribed = Symbol('_isSubscribed'); | 4151 let _isSubscribed = Symbol('_isSubscribed'); |
4152 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) { | 4152 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) { |
4153 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio
n$(T) { | 4153 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio
n$(T) { |
4154 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone
, cancelOnError) { | 4154 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone
, cancelOnError) { |
4155 this[_transformerSink] = null; | 4155 this[_transformerSink] = null; |
4156 this[_subscription] = null; | 4156 this[_subscription] = null; |
4157 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); | 4157 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); |
4158 let eventSink = new (_EventSinkWrapper$(T))(this); | 4158 let eventSink = new (_EventSinkWrapper$(T))(this); |
4159 this[_transformerSink] = mapper(eventSink); | 4159 this[_transformerSink] = mapper(eventSink); |
4160 this[_subscription] = source.listen(this[_handleData], {onError: this[_h
andleError], onDone: this[_handleDone]}); | 4160 this[_subscription] = source.listen(this[_handleData].bind(this), {onErr
or: this[_handleError].bind(this), onDone: this[_handleDone].bind(this)}); |
4161 } | 4161 } |
4162 get [_isSubscribed]() { | 4162 get [_isSubscribed]() { |
4163 return this[_subscription] != null; | 4163 return this[_subscription] != null; |
4164 } | 4164 } |
4165 [_add](data) { | 4165 [_add](data) { |
4166 if (this[_isClosed]) { | 4166 if (this[_isClosed]) { |
4167 throw new core.StateError("Stream is already closed"); | 4167 throw new core.StateError("Stream is already closed"); |
4168 } | 4168 } |
4169 super[_add](data); | 4169 super[_add](data); |
4170 } | 4170 } |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5250 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; | 5250 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; |
5251 exports.CreateTimerHandler = CreateTimerHandler; | 5251 exports.CreateTimerHandler = CreateTimerHandler; |
5252 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; | 5252 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; |
5253 exports.PrintHandler = PrintHandler; | 5253 exports.PrintHandler = PrintHandler; |
5254 exports.ForkHandler = ForkHandler; | 5254 exports.ForkHandler = ForkHandler; |
5255 exports.ZoneSpecification = ZoneSpecification; | 5255 exports.ZoneSpecification = ZoneSpecification; |
5256 exports.ZoneDelegate = ZoneDelegate; | 5256 exports.ZoneDelegate = ZoneDelegate; |
5257 exports.Zone = Zone; | 5257 exports.Zone = Zone; |
5258 exports.runZoned = runZoned; | 5258 exports.runZoned = runZoned; |
5259 })(async || (async = {})); | 5259 })(async || (async = {})); |
OLD | NEW |