OLD | NEW |
1 var async = dart.defineLibrary(async, {}); | 1 var async = dart.defineLibrary(async, {}); |
2 var core = dart.import(core); | 2 var core = dart.import(core); |
3 var _internal = dart.import(_internal); | 3 var _internal = dart.import(_internal); |
4 var _isolate_helper = dart.lazyImport(_isolate_helper); | 4 var _isolate_helper = dart.lazyImport(_isolate_helper); |
5 var _js_helper = dart.import(_js_helper); | 5 var _js_helper = dart.import(_js_helper); |
6 var collection = dart.import(collection); | 6 var collection = dart.import(collection); |
7 (function(exports, core, _internal, _isolate_helper, _js_helper, collection) { | 7 (function(exports, core, _internal, _isolate_helper, _js_helper, collection) { |
8 'use strict'; | 8 'use strict'; |
9 function _invokeErrorHandler(errorHandler, error, stackTrace) { | 9 function _invokeErrorHandler(errorHandler, error, stackTrace) { |
10 if (dart.is(errorHandler, ZoneBinaryCallback)) { | 10 if (dart.is(errorHandler, ZoneBinaryCallback)) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 if (dart.is(newValue, Future)) { | 178 if (dart.is(newValue, Future)) { |
179 subscription.pause(); | 179 subscription.pause(); |
180 dart.dsend(dart.dsend(newValue, 'then', add, {onError: addError}),
'whenComplete', dart.bind(subscription, 'resume')); | 180 dart.dsend(dart.dsend(newValue, 'then', add, {onError: addError}),
'whenComplete', dart.bind(subscription, 'resume')); |
181 } else { | 181 } else { |
182 controller.add(newValue); | 182 controller.add(newValue); |
183 } | 183 } |
184 }, core.Object, [T]), {onError: dart.as(addError, core.Function), onDo
ne: dart.bind(controller, 'close')}); | 184 }, core.Object, [T]), {onError: dart.as(addError, core.Function), onDo
ne: dart.bind(controller, 'close')}); |
185 }; | 185 }; |
186 dart.fn(onListen, dart.void, []); | 186 dart.fn(onListen, dart.void, []); |
187 if (this.isBroadcast) { | 187 if (dart.notNull(this.isBroadcast)) { |
188 controller = StreamController.broadcast({onListen: onListen, onCancel:
dart.fn(() => { | 188 controller = StreamController.broadcast({onListen: onListen, onCancel:
dart.fn(() => { |
189 subscription.cancel(); | 189 subscription.cancel(); |
190 }), sync: true}); | 190 }), sync: true}); |
191 } else { | 191 } else { |
192 controller = StreamController.new({onListen: onListen, onPause: dart.f
n(() => { | 192 controller = StreamController.new({onListen: onListen, onPause: dart.f
n(() => { |
193 subscription.pause(); | 193 subscription.pause(); |
194 }), onResume: dart.fn(() => { | 194 }), onResume: dart.fn(() => { |
195 subscription.resume(); | 195 subscription.resume(); |
196 }), onCancel: dart.fn(() => { | 196 }), onCancel: dart.fn(() => { |
197 subscription.cancel(); | 197 subscription.cancel(); |
(...skipping 19 matching lines...) Expand all Loading... |
217 return; | 217 return; |
218 } | 218 } |
219 | 219 |
220 if (newStream != null) { | 220 if (newStream != null) { |
221 subscription.pause(); | 221 subscription.pause(); |
222 controller.addStream(newStream).whenComplete(dart.bind(subscriptio
n, 'resume')); | 222 controller.addStream(newStream).whenComplete(dart.bind(subscriptio
n, 'resume')); |
223 } | 223 } |
224 }, core.Object, [T]), {onError: dart.as(eventSink[_addError], core.Fun
ction), onDone: dart.bind(controller, 'close')}); | 224 }, core.Object, [T]), {onError: dart.as(eventSink[_addError], core.Fun
ction), onDone: dart.bind(controller, 'close')}); |
225 }; | 225 }; |
226 dart.fn(onListen, dart.void, []); | 226 dart.fn(onListen, dart.void, []); |
227 if (this.isBroadcast) { | 227 if (dart.notNull(this.isBroadcast)) { |
228 controller = StreamController.broadcast({onListen: onListen, onCancel:
dart.fn(() => { | 228 controller = StreamController.broadcast({onListen: onListen, onCancel:
dart.fn(() => { |
229 subscription.cancel(); | 229 subscription.cancel(); |
230 }), sync: true}); | 230 }), sync: true}); |
231 } else { | 231 } else { |
232 controller = StreamController.new({onListen: onListen, onPause: dart.f
n(() => { | 232 controller = StreamController.new({onListen: onListen, onPause: dart.f
n(() => { |
233 subscription.pause(); | 233 subscription.pause(); |
234 }), onResume: dart.fn(() => { | 234 }), onResume: dart.fn(() => { |
235 subscription.resume(); | 235 subscription.resume(); |
236 }), onCancel: dart.fn(() => { | 236 }), onCancel: dart.fn(() => { |
237 subscription.cancel(); | 237 subscription.cancel(); |
(...skipping 19 matching lines...) Expand all Loading... |
257 return streamTransformer.bind(this); | 257 return streamTransformer.bind(this); |
258 } | 258 } |
259 reduce(combine) { | 259 reduce(combine) { |
260 dart.as(combine, dart.functionType(T, [T, T])); | 260 dart.as(combine, dart.functionType(T, [T, T])); |
261 let result = new (_Future$(T))(); | 261 let result = new (_Future$(T))(); |
262 let seenFirst = false; | 262 let seenFirst = false; |
263 let value = null; | 263 let value = null; |
264 let subscription = null; | 264 let subscription = null; |
265 subscription = this.listen(dart.fn(element => { | 265 subscription = this.listen(dart.fn(element => { |
266 dart.as(element, T); | 266 dart.as(element, T); |
267 if (seenFirst) { | 267 if (dart.notNull(seenFirst)) { |
268 _runUserCode(dart.fn(() => combine(value, element), T, []), dart.fn(
newValue => { | 268 _runUserCode(dart.fn(() => combine(value, element), T, []), dart.fn(
newValue => { |
269 dart.as(newValue, T); | 269 dart.as(newValue, T); |
270 value = newValue; | 270 value = newValue; |
271 }, core.Object, [T]), dart.as(_cancelAndErrorClosure(subscription, r
esult), __CastType14)); | 271 }, core.Object, [T]), dart.as(_cancelAndErrorClosure(subscription, r
esult), __CastType14)); |
272 } else { | 272 } else { |
273 value = element; | 273 value = element; |
274 seenFirst = true; | 274 seenFirst = true; |
275 } | 275 } |
276 }, core.Object, [T]), {onError: dart.bind(result, _completeError), onDon
e: dart.fn(() => { | 276 }, core.Object, [T]), {onError: dart.bind(result, _completeError), onDon
e: dart.fn(() => { |
277 if (!dart.notNull(seenFirst)) { | 277 if (!dart.notNull(seenFirst)) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 result[_complete](dart.toString(buffer)); | 331 result[_complete](dart.toString(buffer)); |
332 }), cancelOnError: true}); | 332 }), cancelOnError: true}); |
333 return result; | 333 return result; |
334 } | 334 } |
335 contains(needle) { | 335 contains(needle) { |
336 let future = new (_Future$(core.bool))(); | 336 let future = new (_Future$(core.bool))(); |
337 let subscription = null; | 337 let subscription = null; |
338 subscription = this.listen(dart.fn(element => { | 338 subscription = this.listen(dart.fn(element => { |
339 dart.as(element, T); | 339 dart.as(element, T); |
340 _runUserCode(dart.fn(() => dart.equals(element, needle), core.bool, []
), dart.fn(isMatch => { | 340 _runUserCode(dart.fn(() => dart.equals(element, needle), core.bool, []
), dart.fn(isMatch => { |
341 if (isMatch) { | 341 if (dart.notNull(isMatch)) { |
342 _cancelAndValue(subscription, future, true); | 342 _cancelAndValue(subscription, future, true); |
343 } | 343 } |
344 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); | 344 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); |
345 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 345 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
346 future[_complete](false); | 346 future[_complete](false); |
347 }), cancelOnError: true}); | 347 }), cancelOnError: true}); |
348 return future; | 348 return future; |
349 } | 349 } |
350 forEach(action) { | 350 forEach(action) { |
351 dart.as(action, dart.functionType(dart.void, [T])); | 351 dart.as(action, dart.functionType(dart.void, [T])); |
(...skipping 24 matching lines...) Expand all Loading... |
376 }), cancelOnError: true}); | 376 }), cancelOnError: true}); |
377 return future; | 377 return future; |
378 } | 378 } |
379 any(test) { | 379 any(test) { |
380 dart.as(test, dart.functionType(core.bool, [T])); | 380 dart.as(test, dart.functionType(core.bool, [T])); |
381 let future = new (_Future$(core.bool))(); | 381 let future = new (_Future$(core.bool))(); |
382 let subscription = null; | 382 let subscription = null; |
383 subscription = this.listen(dart.fn(element => { | 383 subscription = this.listen(dart.fn(element => { |
384 dart.as(element, T); | 384 dart.as(element, T); |
385 _runUserCode(dart.fn(() => test(element), core.bool, []), dart.fn(isMa
tch => { | 385 _runUserCode(dart.fn(() => test(element), core.bool, []), dart.fn(isMa
tch => { |
386 if (isMatch) { | 386 if (dart.notNull(isMatch)) { |
387 _cancelAndValue(subscription, future, true); | 387 _cancelAndValue(subscription, future, true); |
388 } | 388 } |
389 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); | 389 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); |
390 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 390 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
391 future[_complete](false); | 391 future[_complete](false); |
392 }), cancelOnError: true}); | 392 }), cancelOnError: true}); |
393 return future; | 393 return future; |
394 } | 394 } |
395 get length() { | 395 get length() { |
396 let future = new (_Future$(core.int))(); | 396 let future = new (_Future$(core.int))(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 get last() { | 479 get last() { |
480 let future = new (_Future$(T))(); | 480 let future = new (_Future$(T))(); |
481 let result = null; | 481 let result = null; |
482 let foundResult = false; | 482 let foundResult = false; |
483 let subscription = null; | 483 let subscription = null; |
484 subscription = this.listen(dart.fn(value => { | 484 subscription = this.listen(dart.fn(value => { |
485 dart.as(value, T); | 485 dart.as(value, T); |
486 foundResult = true; | 486 foundResult = true; |
487 result = value; | 487 result = value; |
488 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 488 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
489 if (foundResult) { | 489 if (dart.notNull(foundResult)) { |
490 future[_complete](result); | 490 future[_complete](result); |
491 return; | 491 return; |
492 } | 492 } |
493 try { | 493 try { |
494 throw _internal.IterableElementError.noElement(); | 494 throw _internal.IterableElementError.noElement(); |
495 } catch (e) { | 495 } catch (e) { |
496 let s = dart.stackTrace(e); | 496 let s = dart.stackTrace(e); |
497 _completeWithErrorCallback(future, e, s); | 497 _completeWithErrorCallback(future, e, s); |
498 } | 498 } |
499 | 499 |
500 }), cancelOnError: true}); | 500 }), cancelOnError: true}); |
501 return future; | 501 return future; |
502 } | 502 } |
503 get single() { | 503 get single() { |
504 let future = new (_Future$(T))(); | 504 let future = new (_Future$(T))(); |
505 let result = null; | 505 let result = null; |
506 let foundResult = false; | 506 let foundResult = false; |
507 let subscription = null; | 507 let subscription = null; |
508 subscription = this.listen(dart.fn(value => { | 508 subscription = this.listen(dart.fn(value => { |
509 dart.as(value, T); | 509 dart.as(value, T); |
510 if (foundResult) { | 510 if (dart.notNull(foundResult)) { |
511 try { | 511 try { |
512 throw _internal.IterableElementError.tooMany(); | 512 throw _internal.IterableElementError.tooMany(); |
513 } catch (e) { | 513 } catch (e) { |
514 let s = dart.stackTrace(e); | 514 let s = dart.stackTrace(e); |
515 _cancelAndErrorWithReplacement(subscription, future, e, s); | 515 _cancelAndErrorWithReplacement(subscription, future, e, s); |
516 } | 516 } |
517 | 517 |
518 return; | 518 return; |
519 } | 519 } |
520 foundResult = true; | 520 foundResult = true; |
521 result = value; | 521 result = value; |
522 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 522 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
523 if (foundResult) { | 523 if (dart.notNull(foundResult)) { |
524 future[_complete](result); | 524 future[_complete](result); |
525 return; | 525 return; |
526 } | 526 } |
527 try { | 527 try { |
528 throw _internal.IterableElementError.noElement(); | 528 throw _internal.IterableElementError.noElement(); |
529 } catch (e) { | 529 } catch (e) { |
530 let s = dart.stackTrace(e); | 530 let s = dart.stackTrace(e); |
531 _completeWithErrorCallback(future, e, s); | 531 _completeWithErrorCallback(future, e, s); |
532 } | 532 } |
533 | 533 |
534 }), cancelOnError: true}); | 534 }), cancelOnError: true}); |
535 return future; | 535 return future; |
536 } | 536 } |
537 firstWhere(test, opts) { | 537 firstWhere(test, opts) { |
538 dart.as(test, dart.functionType(core.bool, [T])); | 538 dart.as(test, dart.functionType(core.bool, [T])); |
539 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; | 539 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; |
540 dart.as(defaultValue, dart.functionType(core.Object, [])); | 540 dart.as(defaultValue, dart.functionType(core.Object, [])); |
541 let future = new _Future(); | 541 let future = new _Future(); |
542 let subscription = null; | 542 let subscription = null; |
543 subscription = this.listen(dart.fn(value => { | 543 subscription = this.listen(dart.fn(value => { |
544 dart.as(value, T); | 544 dart.as(value, T); |
545 _runUserCode(dart.fn(() => test(value), core.bool, []), dart.fn(isMatc
h => { | 545 _runUserCode(dart.fn(() => test(value), core.bool, []), dart.fn(isMatc
h => { |
546 if (isMatch) { | 546 if (dart.notNull(isMatch)) { |
547 _cancelAndValue(subscription, future, value); | 547 _cancelAndValue(subscription, future, value); |
548 } | 548 } |
549 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); | 549 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); |
550 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 550 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
551 if (defaultValue != null) { | 551 if (defaultValue != null) { |
552 _runUserCode(defaultValue, dart.bind(future, _complete), dart.bind
(future, _completeError)); | 552 _runUserCode(defaultValue, dart.bind(future, _complete), dart.bind
(future, _completeError)); |
553 return; | 553 return; |
554 } | 554 } |
555 try { | 555 try { |
556 throw _internal.IterableElementError.noElement(); | 556 throw _internal.IterableElementError.noElement(); |
557 } catch (e) { | 557 } catch (e) { |
558 let s = dart.stackTrace(e); | 558 let s = dart.stackTrace(e); |
559 _completeWithErrorCallback(future, e, s); | 559 _completeWithErrorCallback(future, e, s); |
560 } | 560 } |
561 | 561 |
562 }), cancelOnError: true}); | 562 }), cancelOnError: true}); |
563 return future; | 563 return future; |
564 } | 564 } |
565 lastWhere(test, opts) { | 565 lastWhere(test, opts) { |
566 dart.as(test, dart.functionType(core.bool, [T])); | 566 dart.as(test, dart.functionType(core.bool, [T])); |
567 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; | 567 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue :
null; |
568 dart.as(defaultValue, dart.functionType(core.Object, [])); | 568 dart.as(defaultValue, dart.functionType(core.Object, [])); |
569 let future = new _Future(); | 569 let future = new _Future(); |
570 let result = null; | 570 let result = null; |
571 let foundResult = false; | 571 let foundResult = false; |
572 let subscription = null; | 572 let subscription = null; |
573 subscription = this.listen(dart.fn(value => { | 573 subscription = this.listen(dart.fn(value => { |
574 dart.as(value, T); | 574 dart.as(value, T); |
575 _runUserCode(dart.fn(() => true == test(value), core.bool, []), dart.f
n(isMatch => { | 575 _runUserCode(dart.fn(() => true == test(value), core.bool, []), dart.f
n(isMatch => { |
576 if (isMatch) { | 576 if (dart.notNull(isMatch)) { |
577 foundResult = true; | 577 foundResult = true; |
578 result = value; | 578 result = value; |
579 } | 579 } |
580 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); | 580 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); |
581 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 581 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
582 if (foundResult) { | 582 if (dart.notNull(foundResult)) { |
583 future[_complete](result); | 583 future[_complete](result); |
584 return; | 584 return; |
585 } | 585 } |
586 if (defaultValue != null) { | 586 if (defaultValue != null) { |
587 _runUserCode(defaultValue, dart.bind(future, _complete), dart.bind
(future, _completeError)); | 587 _runUserCode(defaultValue, dart.bind(future, _complete), dart.bind
(future, _completeError)); |
588 return; | 588 return; |
589 } | 589 } |
590 try { | 590 try { |
591 throw _internal.IterableElementError.noElement(); | 591 throw _internal.IterableElementError.noElement(); |
592 } catch (e) { | 592 } catch (e) { |
593 let s = dart.stackTrace(e); | 593 let s = dart.stackTrace(e); |
594 _completeWithErrorCallback(future, e, s); | 594 _completeWithErrorCallback(future, e, s); |
595 } | 595 } |
596 | 596 |
597 }), cancelOnError: true}); | 597 }), cancelOnError: true}); |
598 return future; | 598 return future; |
599 } | 599 } |
600 singleWhere(test) { | 600 singleWhere(test) { |
601 dart.as(test, dart.functionType(core.bool, [T])); | 601 dart.as(test, dart.functionType(core.bool, [T])); |
602 let future = new (_Future$(T))(); | 602 let future = new (_Future$(T))(); |
603 let result = null; | 603 let result = null; |
604 let foundResult = false; | 604 let foundResult = false; |
605 let subscription = null; | 605 let subscription = null; |
606 subscription = this.listen(dart.fn(value => { | 606 subscription = this.listen(dart.fn(value => { |
607 dart.as(value, T); | 607 dart.as(value, T); |
608 _runUserCode(dart.fn(() => true == test(value), core.bool, []), dart.f
n(isMatch => { | 608 _runUserCode(dart.fn(() => true == test(value), core.bool, []), dart.f
n(isMatch => { |
609 if (isMatch) { | 609 if (dart.notNull(isMatch)) { |
610 if (foundResult) { | 610 if (dart.notNull(foundResult)) { |
611 try { | 611 try { |
612 throw _internal.IterableElementError.tooMany(); | 612 throw _internal.IterableElementError.tooMany(); |
613 } catch (e) { | 613 } catch (e) { |
614 let s = dart.stackTrace(e); | 614 let s = dart.stackTrace(e); |
615 _cancelAndErrorWithReplacement(subscription, future, e, s); | 615 _cancelAndErrorWithReplacement(subscription, future, e, s); |
616 } | 616 } |
617 | 617 |
618 return; | 618 return; |
619 } | 619 } |
620 foundResult = true; | 620 foundResult = true; |
621 result = value; | 621 result = value; |
622 } | 622 } |
623 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); | 623 }, core.Object, [core.bool]), dart.as(_cancelAndErrorClosure(subscript
ion, future), dart.functionType(core.Object, [dart.bottom, core.StackTrace]))); |
624 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 624 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
625 if (foundResult) { | 625 if (dart.notNull(foundResult)) { |
626 future[_complete](result); | 626 future[_complete](result); |
627 return; | 627 return; |
628 } | 628 } |
629 try { | 629 try { |
630 throw _internal.IterableElementError.noElement(); | 630 throw _internal.IterableElementError.noElement(); |
631 } catch (e) { | 631 } catch (e) { |
632 let s = dart.stackTrace(e); | 632 let s = dart.stackTrace(e); |
633 _completeWithErrorCallback(future, e, s); | 633 _completeWithErrorCallback(future, e, s); |
634 } | 634 } |
635 | 635 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType
(dart.void, []))); | 701 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType
(dart.void, []))); |
702 }; | 702 }; |
703 dart.fn(onListen, dart.void, []); | 703 dart.fn(onListen, dart.void, []); |
704 let onCancel = () => { | 704 let onCancel = () => { |
705 timer.cancel(); | 705 timer.cancel(); |
706 let result = subscription.cancel(); | 706 let result = subscription.cancel(); |
707 subscription = null; | 707 subscription = null; |
708 return result; | 708 return result; |
709 }; | 709 }; |
710 dart.fn(onCancel, Future, []); | 710 dart.fn(onCancel, Future, []); |
711 controller = this.isBroadcast ? new _SyncBroadcastStreamController(onLis
ten, onCancel) : new _SyncStreamController(onListen, dart.fn(() => { | 711 controller = dart.notNull(this.isBroadcast) ? new _SyncBroadcastStreamCo
ntroller(onListen, onCancel) : new _SyncStreamController(onListen, dart.fn(() =>
{ |
712 timer.cancel(); | 712 timer.cancel(); |
713 subscription.pause(); | 713 subscription.pause(); |
714 }), dart.fn(() => { | 714 }), dart.fn(() => { |
715 subscription.resume(); | 715 subscription.resume(); |
716 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType
(dart.void, []))); | 716 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType
(dart.void, []))); |
717 }), onCancel); | 717 }), onCancel); |
718 return controller.stream; | 718 return controller.stream; |
719 } | 719 } |
720 } | 720 } |
721 dart.setSignature(Stream, { | 721 dart.setSignature(Stream, { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 } | 805 } |
806 [_createSubscription](onData, onError, onDone, cancelOnError) { | 806 [_createSubscription](onData, onError, onDone, cancelOnError) { |
807 dart.as(onData, dart.functionType(dart.void, [T])); | 807 dart.as(onData, dart.functionType(dart.void, [T])); |
808 dart.as(onDone, dart.functionType(dart.void, [])); | 808 dart.as(onDone, dart.functionType(dart.void, [])); |
809 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr
ror); | 809 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr
ror); |
810 } | 810 } |
811 get hashCode() { | 811 get hashCode() { |
812 return dart.notNull(dart.hashCode(this[_controller])) ^ 892482866; | 812 return dart.notNull(dart.hashCode(this[_controller])) ^ 892482866; |
813 } | 813 } |
814 ['=='](other) { | 814 ['=='](other) { |
815 if (core.identical(this, other)) | 815 if (dart.notNull(core.identical(this, other))) |
816 return true; | 816 return true; |
817 if (!dart.is(other, _ControllerStream$())) | 817 if (!dart.is(other, _ControllerStream$())) |
818 return false; | 818 return false; |
819 let otherStream = dart.as(other, _ControllerStream$()); | 819 let otherStream = dart.as(other, _ControllerStream$()); |
820 return core.identical(otherStream[_controller], this[_controller]); | 820 return core.identical(otherStream[_controller], this[_controller]); |
821 } | 821 } |
822 } | 822 } |
823 dart.setSignature(_ControllerStream, { | 823 dart.setSignature(_ControllerStream, { |
824 constructors: () => ({_ControllerStream: [_ControllerStream$(T), [_StreamC
ontrollerLifecycle$(T)]]}), | 824 constructors: () => ({_ControllerStream: [_ControllerStream$(T), [_StreamC
ontrollerLifecycle$(T)]]}), |
825 methods: () => ({ | 825 methods: () => ({ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 let _sendData = Symbol('_sendData'); | 882 let _sendData = Symbol('_sendData'); |
883 let _addPending = Symbol('_addPending'); | 883 let _addPending = Symbol('_addPending'); |
884 let _sendError = Symbol('_sendError'); | 884 let _sendError = Symbol('_sendError'); |
885 let _close = Symbol('_close'); | 885 let _close = Symbol('_close'); |
886 let _sendDone = Symbol('_sendDone'); | 886 let _sendDone = Symbol('_sendDone'); |
887 let _checkState = Symbol('_checkState'); | 887 let _checkState = Symbol('_checkState'); |
888 let _BufferingStreamSubscription$ = dart.generic(function(T) { | 888 let _BufferingStreamSubscription$ = dart.generic(function(T) { |
889 class _BufferingStreamSubscription extends core.Object { | 889 class _BufferingStreamSubscription extends core.Object { |
890 _BufferingStreamSubscription(onData, onError, onDone, cancelOnError) { | 890 _BufferingStreamSubscription(onData, onError, onDone, cancelOnError) { |
891 this[_zone] = Zone.current; | 891 this[_zone] = Zone.current; |
892 this[_state] = cancelOnError ? _BufferingStreamSubscription$()._STATE_CA
NCEL_ON_ERROR : 0; | 892 this[_state] = dart.notNull(cancelOnError) ? _BufferingStreamSubscriptio
n$()._STATE_CANCEL_ON_ERROR : 0; |
893 this[_onData] = null; | 893 this[_onData] = null; |
894 this[_onError] = null; | 894 this[_onError] = null; |
895 this[_onDone] = null; | 895 this[_onDone] = null; |
896 this[_cancelFuture] = null; | 896 this[_cancelFuture] = null; |
897 this[_pending] = null; | 897 this[_pending] = null; |
898 this.onData(onData); | 898 this.onData(onData); |
899 this.onError(onError); | 899 this.onError(onError); |
900 this.onDone(onDone); | 900 this.onDone(onDone); |
901 } | 901 } |
902 [_setPendingEvents](pendingEvents) { | 902 [_setPendingEvents](pendingEvents) { |
(...skipping 25 matching lines...) Expand all Loading... |
928 } | 928 } |
929 onDone(handleDone) { | 929 onDone(handleDone) { |
930 dart.as(handleDone, dart.functionType(dart.void, [])); | 930 dart.as(handleDone, dart.functionType(dart.void, [])); |
931 if (handleDone == null) | 931 if (handleDone == null) |
932 handleDone = _nullDoneHandler; | 932 handleDone = _nullDoneHandler; |
933 this[_onDone] = this[_zone].registerCallback(handleDone); | 933 this[_onDone] = this[_zone].registerCallback(handleDone); |
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 (dart.notNull(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(dart.bind(this, 'resume')); | 944 resumeSignal.whenComplete(dart.bind(this, 'resume')); |
945 if (!dart.notNull(wasPaused) && dart.notNull(this[_pending] != null)) | 945 if (!dart.notNull(wasPaused) && 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](dart.bind(this, _onPause)); | 948 this[_guardCallback](dart.bind(this, _onPause)); |
949 } | 949 } |
950 resume() { | 950 resume() { |
951 if (this[_isCanceled]) | 951 if (dart.notNull(this[_isCanceled])) |
952 return; | 952 return; |
953 if (this[_isPaused]) { | 953 if (dart.notNull(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](dart.bind(this, _onResume)); | 962 this[_guardCallback](dart.bind(this, _onResume)); |
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 (dart.notNull(this[_isCanceled])) |
970 return this[_cancelFuture]; | 970 return this[_cancelFuture]; |
971 this[_cancel](); | 971 this[_cancel](); |
972 return this[_cancelFuture]; | 972 return this[_cancelFuture]; |
973 } | 973 } |
974 asFuture(futureValue) { | 974 asFuture(futureValue) { |
975 if (futureValue === void 0) | 975 if (futureValue === void 0) |
976 futureValue = null; | 976 futureValue = null; |
977 let result = new (_Future$(T))(); | 977 let result = new (_Future$(T))(); |
978 this[_onDone] = dart.fn(() => { | 978 this[_onDone] = dart.fn(() => { |
979 result[_complete](futureValue); | 979 result[_complete](futureValue); |
(...skipping 22 matching lines...) Expand all Loading... |
1002 get [_hasPending]() { | 1002 get [_hasPending]() { |
1003 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr
iption$()._STATE_HAS_PENDING)) != 0; | 1003 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr
iption$()._STATE_HAS_PENDING)) != 0; |
1004 } | 1004 } |
1005 get [_isPaused]() { | 1005 get [_isPaused]() { |
1006 return dart.notNull(this[_state]) >= dart.notNull(_BufferingStreamSubscr
iption$()._STATE_PAUSE_COUNT); | 1006 return dart.notNull(this[_state]) >= dart.notNull(_BufferingStreamSubscr
iption$()._STATE_PAUSE_COUNT); |
1007 } | 1007 } |
1008 get [_canFire]() { | 1008 get [_canFire]() { |
1009 return dart.notNull(this[_state]) < dart.notNull(_BufferingStreamSubscri
ption$()._STATE_IN_CALLBACK); | 1009 return dart.notNull(this[_state]) < dart.notNull(_BufferingStreamSubscri
ption$()._STATE_IN_CALLBACK); |
1010 } | 1010 } |
1011 get [_mayResumeInput]() { | 1011 get [_mayResumeInput]() { |
1012 return !dart.notNull(this[_isPaused]) && (dart.notNull(this[_pending] ==
null) || dart.notNull(this[_pending].isEmpty)); | 1012 return !dart.notNull(this[_isPaused]) && (this[_pending] == null || dart
.notNull(this[_pending].isEmpty)); |
1013 } | 1013 } |
1014 get [_cancelOnError]() { | 1014 get [_cancelOnError]() { |
1015 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr
iption$()._STATE_CANCEL_ON_ERROR)) != 0; | 1015 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr
iption$()._STATE_CANCEL_ON_ERROR)) != 0; |
1016 } | 1016 } |
1017 get isPaused() { | 1017 get isPaused() { |
1018 return this[_isPaused]; | 1018 return this[_isPaused]; |
1019 } | 1019 } |
1020 [_cancel]() { | 1020 [_cancel]() { |
1021 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea
mSubscription$()._STATE_CANCELED); | 1021 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea
mSubscription$()._STATE_CANCELED); |
1022 if (this[_hasPending]) { | 1022 if (dart.notNull(this[_hasPending])) { |
1023 this[_pending].cancelSchedule(); | 1023 this[_pending].cancelSchedule(); |
1024 } | 1024 } |
1025 if (!dart.notNull(this[_inCallback])) | 1025 if (!dart.notNull(this[_inCallback])) |
1026 this[_pending] = null; | 1026 this[_pending] = null; |
1027 this[_cancelFuture] = this[_onCancel](); | 1027 this[_cancelFuture] = this[_onCancel](); |
1028 } | 1028 } |
1029 [_incrementPauseCount]() { | 1029 [_incrementPauseCount]() { |
1030 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea
mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription
$()._STATE_INPUT_PAUSED); | 1030 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea
mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription
$()._STATE_INPUT_PAUSED); |
1031 } | 1031 } |
1032 [_decrementPauseCount]() { | 1032 [_decrementPauseCount]() { |
1033 dart.assert(this[_isPaused]); | 1033 dart.assert(this[_isPaused]); |
1034 this[_state] = dart.notNull(this[_state]) - dart.notNull(_BufferingStrea
mSubscription$()._STATE_PAUSE_COUNT); | 1034 this[_state] = dart.notNull(this[_state]) - dart.notNull(_BufferingStrea
mSubscription$()._STATE_PAUSE_COUNT); |
1035 } | 1035 } |
1036 [_add](data) { | 1036 [_add](data) { |
1037 dart.as(data, T); | 1037 dart.as(data, T); |
1038 dart.assert(!dart.notNull(this[_isClosed])); | 1038 dart.assert(!dart.notNull(this[_isClosed])); |
1039 if (this[_isCanceled]) | 1039 if (dart.notNull(this[_isCanceled])) |
1040 return; | 1040 return; |
1041 if (this[_canFire]) { | 1041 if (dart.notNull(this[_canFire])) { |
1042 this[_sendData](data); | 1042 this[_sendData](data); |
1043 } else { | 1043 } else { |
1044 this[_addPending](new _DelayedData(data)); | 1044 this[_addPending](new _DelayedData(data)); |
1045 } | 1045 } |
1046 } | 1046 } |
1047 [_addError](error, stackTrace) { | 1047 [_addError](error, stackTrace) { |
1048 if (this[_isCanceled]) | 1048 if (dart.notNull(this[_isCanceled])) |
1049 return; | 1049 return; |
1050 if (this[_canFire]) { | 1050 if (dart.notNull(this[_canFire])) { |
1051 this[_sendError](error, stackTrace); | 1051 this[_sendError](error, stackTrace); |
1052 } else { | 1052 } else { |
1053 this[_addPending](new _DelayedError(error, stackTrace)); | 1053 this[_addPending](new _DelayedError(error, stackTrace)); |
1054 } | 1054 } |
1055 } | 1055 } |
1056 [_close]() { | 1056 [_close]() { |
1057 dart.assert(!dart.notNull(this[_isClosed])); | 1057 dart.assert(!dart.notNull(this[_isClosed])); |
1058 if (this[_isCanceled]) | 1058 if (dart.notNull(this[_isCanceled])) |
1059 return; | 1059 return; |
1060 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea
mSubscription$()._STATE_CLOSED); | 1060 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea
mSubscription$()._STATE_CLOSED); |
1061 if (this[_canFire]) { | 1061 if (dart.notNull(this[_canFire])) { |
1062 this[_sendDone](); | 1062 this[_sendDone](); |
1063 } else { | 1063 } else { |
1064 this[_addPending](dart.const(new _DelayedDone())); | 1064 this[_addPending](dart.const(new _DelayedDone())); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 [_onPause]() { | 1067 [_onPause]() { |
1068 dart.assert(this[_isInputPaused]); | 1068 dart.assert(this[_isInputPaused]); |
1069 } | 1069 } |
1070 [_onResume]() { | 1070 [_onResume]() { |
1071 dart.assert(!dart.notNull(this[_isInputPaused])); | 1071 dart.assert(!dart.notNull(this[_isInputPaused])); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 return; | 1107 return; |
1108 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr
eamSubscription$()._STATE_IN_CALLBACK); | 1108 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr
eamSubscription$()._STATE_IN_CALLBACK); |
1109 if (dart.is(this[_onError], ZoneBinaryCallback)) { | 1109 if (dart.is(this[_onError], ZoneBinaryCallback)) { |
1110 this[_zone].runBinaryGuarded(dart.as(this[_onError], __CastType22),
error, stackTrace); | 1110 this[_zone].runBinaryGuarded(dart.as(this[_onError], __CastType22),
error, stackTrace); |
1111 } else { | 1111 } else { |
1112 this[_zone].runUnaryGuarded(dart.as(this[_onError], __CastType25), e
rror); | 1112 this[_zone].runUnaryGuarded(dart.as(this[_onError], __CastType25), e
rror); |
1113 } | 1113 } |
1114 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt
reamSubscription$()._STATE_IN_CALLBACK); | 1114 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt
reamSubscription$()._STATE_IN_CALLBACK); |
1115 }; | 1115 }; |
1116 dart.fn(sendError, dart.void, []); | 1116 dart.fn(sendError, dart.void, []); |
1117 if (this[_cancelOnError]) { | 1117 if (dart.notNull(this[_cancelOnError])) { |
1118 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr
eamSubscription$()._STATE_WAIT_FOR_CANCEL); | 1118 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr
eamSubscription$()._STATE_WAIT_FOR_CANCEL); |
1119 this[_cancel](); | 1119 this[_cancel](); |
1120 if (dart.is(this[_cancelFuture], Future)) { | 1120 if (dart.is(this[_cancelFuture], Future)) { |
1121 this[_cancelFuture].whenComplete(sendError); | 1121 this[_cancelFuture].whenComplete(sendError); |
1122 } else { | 1122 } else { |
1123 sendError(); | 1123 sendError(); |
1124 } | 1124 } |
1125 } else { | 1125 } else { |
1126 sendError(); | 1126 sendError(); |
1127 this[_checkState](wasInputPaused); | 1127 this[_checkState](wasInputPaused); |
(...skipping 29 matching lines...) Expand all Loading... |
1157 } | 1157 } |
1158 [_checkState](wasInputPaused) { | 1158 [_checkState](wasInputPaused) { |
1159 dart.assert(!dart.notNull(this[_inCallback])); | 1159 dart.assert(!dart.notNull(this[_inCallback])); |
1160 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp
ty)) { | 1160 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp
ty)) { |
1161 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt
reamSubscription$()._STATE_HAS_PENDING); | 1161 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt
reamSubscription$()._STATE_HAS_PENDING); |
1162 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume
Input])) { | 1162 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume
Input])) { |
1163 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Buffering
StreamSubscription$()._STATE_INPUT_PAUSED); | 1163 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Buffering
StreamSubscription$()._STATE_INPUT_PAUSED); |
1164 } | 1164 } |
1165 } | 1165 } |
1166 while (true) { | 1166 while (true) { |
1167 if (this[_isCanceled]) { | 1167 if (dart.notNull(this[_isCanceled])) { |
1168 this[_pending] = null; | 1168 this[_pending] = null; |
1169 return; | 1169 return; |
1170 } | 1170 } |
1171 let isInputPaused = this[_isInputPaused]; | 1171 let isInputPaused = this[_isInputPaused]; |
1172 if (wasInputPaused == isInputPaused) | 1172 if (wasInputPaused == isInputPaused) |
1173 break; | 1173 break; |
1174 this[_state] = dart.notNull(this[_state]) ^ dart.notNull(_BufferingStr
eamSubscription$()._STATE_IN_CALLBACK); | 1174 this[_state] = dart.notNull(this[_state]) ^ dart.notNull(_BufferingStr
eamSubscription$()._STATE_IN_CALLBACK); |
1175 if (isInputPaused) { | 1175 if (dart.notNull(isInputPaused)) { |
1176 this[_onPause](); | 1176 this[_onPause](); |
1177 } else { | 1177 } else { |
1178 this[_onResume](); | 1178 this[_onResume](); |
1179 } | 1179 } |
1180 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt
reamSubscription$()._STATE_IN_CALLBACK); | 1180 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt
reamSubscription$()._STATE_IN_CALLBACK); |
1181 wasInputPaused = isInputPaused; | 1181 wasInputPaused = isInputPaused; |
1182 } | 1182 } |
1183 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) { | 1183 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) { |
1184 this[_pending].schedule(this); | 1184 this[_pending].schedule(this); |
1185 } | 1185 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti
on))); | 1372 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti
on))); |
1373 let previous = subscription[_previous]; | 1373 let previous = subscription[_previous]; |
1374 let next = subscription[_next]; | 1374 let next = subscription[_next]; |
1375 previous[_next] = next; | 1375 previous[_next] = next; |
1376 next[_previous] = previous; | 1376 next[_previous] = previous; |
1377 subscription[_next] = subscription[_previous] = subscription; | 1377 subscription[_next] = subscription[_previous] = subscription; |
1378 } | 1378 } |
1379 [_subscribe](onData, onError, onDone, cancelOnError) { | 1379 [_subscribe](onData, onError, onDone, cancelOnError) { |
1380 dart.as(onData, dart.functionType(dart.void, [T])); | 1380 dart.as(onData, dart.functionType(dart.void, [T])); |
1381 dart.as(onDone, dart.functionType(dart.void, [])); | 1381 dart.as(onDone, dart.functionType(dart.void, [])); |
1382 if (this.isClosed) { | 1382 if (dart.notNull(this.isClosed)) { |
1383 if (onDone == null) | 1383 if (onDone == null) |
1384 onDone = _nullDoneHandler; | 1384 onDone = _nullDoneHandler; |
1385 return new (_DoneStreamSubscription$(T))(onDone); | 1385 return new (_DoneStreamSubscription$(T))(onDone); |
1386 } | 1386 } |
1387 let subscription = new (_BroadcastSubscription$(T))(this, onData, onErro
r, onDone, cancelOnError); | 1387 let subscription = new (_BroadcastSubscription$(T))(this, onData, onErro
r, onDone, cancelOnError); |
1388 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T))); | 1388 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T))); |
1389 if (core.identical(this[_next], this[_previous])) { | 1389 if (dart.notNull(core.identical(this[_next], this[_previous]))) { |
1390 _runGuarded(this[_onListen]); | 1390 _runGuarded(this[_onListen]); |
1391 } | 1391 } |
1392 return dart.as(subscription, StreamSubscription$(T)); | 1392 return dart.as(subscription, StreamSubscription$(T)); |
1393 } | 1393 } |
1394 [_recordCancel](subscription) { | 1394 [_recordCancel](subscription) { |
1395 dart.as(subscription, StreamSubscription$(T)); | 1395 dart.as(subscription, StreamSubscription$(T)); |
1396 if (core.identical(subscription[_next], subscription)) | 1396 if (dart.notNull(core.identical(subscription[_next], subscription))) |
1397 return null; | 1397 return null; |
1398 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti
on))); | 1398 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti
on))); |
1399 if (subscription[_isFiring]) { | 1399 if (dart.notNull(dart.as(subscription[_isFiring], core.bool))) { |
1400 dart.dcall(subscription[_setRemoveAfterFiring]); | 1400 dart.dcall(subscription[_setRemoveAfterFiring]); |
1401 } else { | 1401 } else { |
1402 dart.assert(!dart.notNull(core.identical(subscription[_next], subscrip
tion))); | 1402 dart.assert(!dart.notNull(core.identical(subscription[_next], subscrip
tion))); |
1403 this[_removeListener](dart.as(subscription, _BroadcastSubscription$(T)
)); | 1403 this[_removeListener](dart.as(subscription, _BroadcastSubscription$(T)
)); |
1404 if (!dart.notNull(this[_isFiring]) && dart.notNull(this[_isEmpty])) { | 1404 if (!dart.notNull(this[_isFiring]) && dart.notNull(this[_isEmpty])) { |
1405 this[_callOnCancel](); | 1405 this[_callOnCancel](); |
1406 } | 1406 } |
1407 } | 1407 } |
1408 return null; | 1408 return null; |
1409 } | 1409 } |
1410 [_recordPause](subscription) { | 1410 [_recordPause](subscription) { |
1411 dart.as(subscription, StreamSubscription$(T)); | 1411 dart.as(subscription, StreamSubscription$(T)); |
1412 } | 1412 } |
1413 [_recordResume](subscription) { | 1413 [_recordResume](subscription) { |
1414 dart.as(subscription, StreamSubscription$(T)); | 1414 dart.as(subscription, StreamSubscription$(T)); |
1415 } | 1415 } |
1416 [_addEventError]() { | 1416 [_addEventError]() { |
1417 if (this.isClosed) { | 1417 if (dart.notNull(this.isClosed)) { |
1418 return new core.StateError("Cannot add new events after calling close"
); | 1418 return new core.StateError("Cannot add new events after calling close"
); |
1419 } | 1419 } |
1420 dart.assert(this[_isAddingStream]); | 1420 dart.assert(this[_isAddingStream]); |
1421 return new core.StateError("Cannot add new events while doing an addStre
am"); | 1421 return new core.StateError("Cannot add new events while doing an addStre
am"); |
1422 } | 1422 } |
1423 add(data) { | 1423 add(data) { |
1424 dart.as(data, T); | 1424 dart.as(data, T); |
1425 if (!dart.notNull(this[_mayAddEvent])) | 1425 if (!dart.notNull(this[_mayAddEvent])) |
1426 throw this[_addEventError](); | 1426 throw this[_addEventError](); |
1427 this[_sendData](data); | 1427 this[_sendData](data); |
1428 } | 1428 } |
1429 addError(error, stackTrace) { | 1429 addError(error, stackTrace) { |
1430 if (stackTrace === void 0) | 1430 if (stackTrace === void 0) |
1431 stackTrace = null; | 1431 stackTrace = null; |
1432 error = _nonNullError(error); | 1432 error = _nonNullError(error); |
1433 if (!dart.notNull(this[_mayAddEvent])) | 1433 if (!dart.notNull(this[_mayAddEvent])) |
1434 throw this[_addEventError](); | 1434 throw this[_addEventError](); |
1435 let replacement = Zone.current.errorCallback(error, stackTrace); | 1435 let replacement = Zone.current.errorCallback(error, stackTrace); |
1436 if (replacement != null) { | 1436 if (replacement != null) { |
1437 error = _nonNullError(replacement.error); | 1437 error = _nonNullError(replacement.error); |
1438 stackTrace = replacement.stackTrace; | 1438 stackTrace = replacement.stackTrace; |
1439 } | 1439 } |
1440 this[_sendError](error, stackTrace); | 1440 this[_sendError](error, stackTrace); |
1441 } | 1441 } |
1442 close() { | 1442 close() { |
1443 if (this.isClosed) { | 1443 if (dart.notNull(this.isClosed)) { |
1444 dart.assert(this[_doneFuture] != null); | 1444 dart.assert(this[_doneFuture] != null); |
1445 return this[_doneFuture]; | 1445 return this[_doneFuture]; |
1446 } | 1446 } |
1447 if (!dart.notNull(this[_mayAddEvent])) | 1447 if (!dart.notNull(this[_mayAddEvent])) |
1448 throw this[_addEventError](); | 1448 throw this[_addEventError](); |
1449 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea
mController$()._STATE_CLOSED); | 1449 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea
mController$()._STATE_CLOSED); |
1450 let doneFuture = this[_ensureDoneFuture](); | 1450 let doneFuture = this[_ensureDoneFuture](); |
1451 this[_sendDone](); | 1451 this[_sendDone](); |
1452 return doneFuture; | 1452 return doneFuture; |
1453 } | 1453 } |
(...skipping 18 matching lines...) Expand all Loading... |
1472 } | 1472 } |
1473 [_close]() { | 1473 [_close]() { |
1474 dart.assert(this[_isAddingStream]); | 1474 dart.assert(this[_isAddingStream]); |
1475 let addState = this[_addStreamState]; | 1475 let addState = this[_addStreamState]; |
1476 this[_addStreamState] = null; | 1476 this[_addStreamState] = null; |
1477 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre
amController$()._STATE_ADDSTREAM); | 1477 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre
amController$()._STATE_ADDSTREAM); |
1478 addState.complete(); | 1478 addState.complete(); |
1479 } | 1479 } |
1480 [_forEachListener](action) { | 1480 [_forEachListener](action) { |
1481 dart.as(action, dart.functionType(dart.void, [_BufferingStreamSubscripti
on$(T)])); | 1481 dart.as(action, dart.functionType(dart.void, [_BufferingStreamSubscripti
on$(T)])); |
1482 if (this[_isFiring]) { | 1482 if (dart.notNull(this[_isFiring])) { |
1483 throw new core.StateError("Cannot fire new event. Controller is alread
y firing an event"); | 1483 throw new core.StateError("Cannot fire new event. Controller is alread
y firing an event"); |
1484 } | 1484 } |
1485 if (this[_isEmpty]) | 1485 if (dart.notNull(this[_isEmpty])) |
1486 return; | 1486 return; |
1487 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr
oller$()._STATE_EVENT_ID); | 1487 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr
oller$()._STATE_EVENT_ID); |
1488 this[_state] = dart.notNull(this[_state]) ^ (dart.notNull(_BroadcastStre
amController$()._STATE_EVENT_ID) | dart.notNull(_BroadcastStreamController$()._S
TATE_FIRING)); | 1488 this[_state] = dart.notNull(this[_state]) ^ (dart.notNull(_BroadcastStre
amController$()._STATE_EVENT_ID) | dart.notNull(_BroadcastStreamController$()._S
TATE_FIRING)); |
1489 let link = this[_next]; | 1489 let link = this[_next]; |
1490 while (!dart.notNull(core.identical(link, this))) { | 1490 while (!dart.notNull(core.identical(link, this))) { |
1491 let subscription = dart.as(link, _BroadcastSubscription$(T)); | 1491 let subscription = dart.as(link, _BroadcastSubscription$(T)); |
1492 if (subscription[_expectsEvent](id)) { | 1492 if (dart.notNull(subscription[_expectsEvent](id))) { |
1493 subscription[_eventState] = dart.notNull(subscription[_eventState])
| dart.notNull(_BroadcastSubscription._STATE_FIRING); | 1493 subscription[_eventState] = dart.notNull(subscription[_eventState])
| dart.notNull(_BroadcastSubscription._STATE_FIRING); |
1494 action(subscription); | 1494 action(subscription); |
1495 subscription[_toggleEventId](); | 1495 subscription[_toggleEventId](); |
1496 link = subscription[_next]; | 1496 link = subscription[_next]; |
1497 if (subscription[_removeAfterFiring]) { | 1497 if (dart.notNull(subscription[_removeAfterFiring])) { |
1498 this[_removeListener](subscription); | 1498 this[_removeListener](subscription); |
1499 } | 1499 } |
1500 subscription[_eventState] = dart.notNull(subscription[_eventState])
& ~dart.notNull(_BroadcastSubscription._STATE_FIRING); | 1500 subscription[_eventState] = dart.notNull(subscription[_eventState])
& ~dart.notNull(_BroadcastSubscription._STATE_FIRING); |
1501 } else { | 1501 } else { |
1502 link = subscription[_next]; | 1502 link = subscription[_next]; |
1503 } | 1503 } |
1504 } | 1504 } |
1505 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre
amController$()._STATE_FIRING); | 1505 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre
amController$()._STATE_FIRING); |
1506 if (this[_isEmpty]) { | 1506 if (dart.notNull(this[_isEmpty])) { |
1507 this[_callOnCancel](); | 1507 this[_callOnCancel](); |
1508 } | 1508 } |
1509 } | 1509 } |
1510 [_callOnCancel]() { | 1510 [_callOnCancel]() { |
1511 dart.assert(this[_isEmpty]); | 1511 dart.assert(this[_isEmpty]); |
1512 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo
mplete])) { | 1512 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo
mplete])) { |
1513 this[_doneFuture][_asyncComplete](null); | 1513 this[_doneFuture][_asyncComplete](null); |
1514 } | 1514 } |
1515 _runGuarded(this[_onCancel]); | 1515 _runGuarded(this[_onCancel]); |
1516 } | 1516 } |
(...skipping 29 matching lines...) Expand all Loading... |
1546 _BroadcastStreamController._STATE_FIRING = 2; | 1546 _BroadcastStreamController._STATE_FIRING = 2; |
1547 _BroadcastStreamController._STATE_CLOSED = 4; | 1547 _BroadcastStreamController._STATE_CLOSED = 4; |
1548 _BroadcastStreamController._STATE_ADDSTREAM = 8; | 1548 _BroadcastStreamController._STATE_ADDSTREAM = 8; |
1549 let _SyncBroadcastStreamController$ = dart.generic(function(T) { | 1549 let _SyncBroadcastStreamController$ = dart.generic(function(T) { |
1550 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T)
{ | 1550 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T)
{ |
1551 _SyncBroadcastStreamController(onListen, onCancel) { | 1551 _SyncBroadcastStreamController(onListen, onCancel) { |
1552 super._BroadcastStreamController(onListen, onCancel); | 1552 super._BroadcastStreamController(onListen, onCancel); |
1553 } | 1553 } |
1554 [_sendData](data) { | 1554 [_sendData](data) { |
1555 dart.as(data, T); | 1555 dart.as(data, T); |
1556 if (this[_isEmpty]) | 1556 if (dart.notNull(this[_isEmpty])) |
1557 return; | 1557 return; |
1558 if (this[_hasOneListener]) { | 1558 if (dart.notNull(this[_hasOneListener])) { |
1559 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr
eamController._STATE_FIRING); | 1559 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr
eamController._STATE_FIRING); |
1560 let subscription = dart.as(this[_next], _BroadcastSubscription); | 1560 let subscription = dart.as(this[_next], _BroadcastSubscription); |
1561 subscription[_add](data); | 1561 subscription[_add](data); |
1562 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastSt
reamController._STATE_FIRING); | 1562 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastSt
reamController._STATE_FIRING); |
1563 if (this[_isEmpty]) { | 1563 if (dart.notNull(this[_isEmpty])) { |
1564 this[_callOnCancel](); | 1564 this[_callOnCancel](); |
1565 } | 1565 } |
1566 return; | 1566 return; |
1567 } | 1567 } |
1568 this[_forEachListener](dart.fn(subscription => { | 1568 this[_forEachListener](dart.fn(subscription => { |
1569 dart.as(subscription, _BufferingStreamSubscription$(T)); | 1569 dart.as(subscription, _BufferingStreamSubscription$(T)); |
1570 subscription[_add](data); | 1570 subscription[_add](data); |
1571 }, core.Object, [_BufferingStreamSubscription$(T)])); | 1571 }, core.Object, [_BufferingStreamSubscription$(T)])); |
1572 } | 1572 } |
1573 [_sendError](error, stackTrace) { | 1573 [_sendError](error, stackTrace) { |
1574 if (this[_isEmpty]) | 1574 if (dart.notNull(this[_isEmpty])) |
1575 return; | 1575 return; |
1576 this[_forEachListener](dart.fn(subscription => { | 1576 this[_forEachListener](dart.fn(subscription => { |
1577 dart.as(subscription, _BufferingStreamSubscription$(T)); | 1577 dart.as(subscription, _BufferingStreamSubscription$(T)); |
1578 subscription[_addError](error, stackTrace); | 1578 subscription[_addError](error, stackTrace); |
1579 }, core.Object, [_BufferingStreamSubscription$(T)])); | 1579 }, core.Object, [_BufferingStreamSubscription$(T)])); |
1580 } | 1580 } |
1581 [_sendDone]() { | 1581 [_sendDone]() { |
1582 if (!dart.notNull(this[_isEmpty])) { | 1582 if (!dart.notNull(this[_isEmpty])) { |
1583 this[_forEachListener](dart.as(dart.fn(subscription => { | 1583 this[_forEachListener](dart.as(dart.fn(subscription => { |
1584 dart.as(subscription, _BroadcastSubscription$(T)); | 1584 dart.as(subscription, _BroadcastSubscription$(T)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 }); | 1645 }); |
1646 let _AsyncBroadcastStreamController = _AsyncBroadcastStreamController$(); | 1646 let _AsyncBroadcastStreamController = _AsyncBroadcastStreamController$(); |
1647 let _addPendingEvent = Symbol('_addPendingEvent'); | 1647 let _addPendingEvent = Symbol('_addPendingEvent'); |
1648 let _AsBroadcastStreamController$ = dart.generic(function(T) { | 1648 let _AsBroadcastStreamController$ = dart.generic(function(T) { |
1649 class _AsBroadcastStreamController extends _SyncBroadcastStreamController$(T
) { | 1649 class _AsBroadcastStreamController extends _SyncBroadcastStreamController$(T
) { |
1650 _AsBroadcastStreamController(onListen, onCancel) { | 1650 _AsBroadcastStreamController(onListen, onCancel) { |
1651 this[_pending] = null; | 1651 this[_pending] = null; |
1652 super._SyncBroadcastStreamController(onListen, onCancel); | 1652 super._SyncBroadcastStreamController(onListen, onCancel); |
1653 } | 1653 } |
1654 get [_hasPending]() { | 1654 get [_hasPending]() { |
1655 return dart.notNull(this[_pending] != null) && !dart.notNull(this[_pendi
ng].isEmpty); | 1655 return this[_pending] != null && !dart.notNull(this[_pending].isEmpty); |
1656 } | 1656 } |
1657 [_addPendingEvent](event) { | 1657 [_addPendingEvent](event) { |
1658 if (this[_pending] == null) { | 1658 if (this[_pending] == null) { |
1659 this[_pending] = new _StreamImplEvents(); | 1659 this[_pending] = new _StreamImplEvents(); |
1660 } | 1660 } |
1661 this[_pending].add(event); | 1661 this[_pending].add(event); |
1662 } | 1662 } |
1663 add(data) { | 1663 add(data) { |
1664 dart.as(data, T); | 1664 dart.as(data, T); |
1665 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { | 1665 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { |
1666 this[_addPendingEvent](new (_DelayedData$(T))(data)); | 1666 this[_addPendingEvent](new (_DelayedData$(T))(data)); |
1667 return; | 1667 return; |
1668 } | 1668 } |
1669 super.add(data); | 1669 super.add(data); |
1670 while (this[_hasPending]) { | 1670 while (dart.notNull(this[_hasPending])) { |
1671 this[_pending].handleNext(this); | 1671 this[_pending].handleNext(this); |
1672 } | 1672 } |
1673 } | 1673 } |
1674 addError(error, stackTrace) { | 1674 addError(error, stackTrace) { |
1675 if (stackTrace === void 0) | 1675 if (stackTrace === void 0) |
1676 stackTrace = null; | 1676 stackTrace = null; |
1677 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { | 1677 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { |
1678 this[_addPendingEvent](new _DelayedError(error, stackTrace)); | 1678 this[_addPendingEvent](new _DelayedError(error, stackTrace)); |
1679 return; | 1679 return; |
1680 } | 1680 } |
1681 if (!dart.notNull(this[_mayAddEvent])) | 1681 if (!dart.notNull(this[_mayAddEvent])) |
1682 throw this[_addEventError](); | 1682 throw this[_addEventError](); |
1683 this[_sendError](error, stackTrace); | 1683 this[_sendError](error, stackTrace); |
1684 while (this[_hasPending]) { | 1684 while (dart.notNull(this[_hasPending])) { |
1685 this[_pending].handleNext(this); | 1685 this[_pending].handleNext(this); |
1686 } | 1686 } |
1687 } | 1687 } |
1688 close() { | 1688 close() { |
1689 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { | 1689 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { |
1690 this[_addPendingEvent](dart.const(new _DelayedDone())); | 1690 this[_addPendingEvent](dart.const(new _DelayedDone())); |
1691 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr
eamController._STATE_CLOSED); | 1691 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr
eamController._STATE_CLOSED); |
1692 return super.done; | 1692 return super.done; |
1693 } | 1693 } |
1694 let result = super.close(); | 1694 let result = super.close(); |
1695 dart.assert(!dart.notNull(this[_hasPending])); | 1695 dart.assert(!dart.notNull(this[_hasPending])); |
1696 return result; | 1696 return result; |
1697 } | 1697 } |
1698 [_callOnCancel]() { | 1698 [_callOnCancel]() { |
1699 if (this[_hasPending]) { | 1699 if (dart.notNull(this[_hasPending])) { |
1700 this[_pending].clear(); | 1700 this[_pending].clear(); |
1701 this[_pending] = null; | 1701 this[_pending] = null; |
1702 } | 1702 } |
1703 super[_callOnCancel](); | 1703 super[_callOnCancel](); |
1704 } | 1704 } |
1705 } | 1705 } |
1706 _AsBroadcastStreamController[dart.implements] = () => [_EventDispatch$(T)]; | 1706 _AsBroadcastStreamController[dart.implements] = () => [_EventDispatch$(T)]; |
1707 dart.setSignature(_AsBroadcastStreamController, { | 1707 dart.setSignature(_AsBroadcastStreamController, { |
1708 constructors: () => ({_AsBroadcastStreamController: [_AsBroadcastStreamCon
troller$(T), [dart.functionType(dart.void, []), dart.functionType(dart.void, [])
]]}), | 1708 constructors: () => ({_AsBroadcastStreamController: [_AsBroadcastStreamCon
troller$(T), [dart.functionType(dart.void, []), dart.functionType(dart.void, [])
]]}), |
1709 methods: () => ({ | 1709 methods: () => ({ |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 let pos = remaining; | 1912 let pos = remaining; |
1913 remaining = dart.notNull(pos) + 1; | 1913 remaining = dart.notNull(pos) + 1; |
1914 future.then(dart.fn(value => { | 1914 future.then(dart.fn(value => { |
1915 remaining = dart.notNull(remaining) - 1; | 1915 remaining = dart.notNull(remaining) - 1; |
1916 if (values != null) { | 1916 if (values != null) { |
1917 values[dartx.set](pos, value); | 1917 values[dartx.set](pos, value); |
1918 if (remaining == 0) { | 1918 if (remaining == 0) { |
1919 result[_completeWithValue](values); | 1919 result[_completeWithValue](values); |
1920 } | 1920 } |
1921 } else { | 1921 } else { |
1922 if (dart.notNull(cleanUp != null) && dart.notNull(value != null))
{ | 1922 if (cleanUp != null && value != null) { |
1923 Future$().sync(dart.fn(() => { | 1923 Future$().sync(dart.fn(() => { |
1924 dart.dcall(cleanUp, value); | 1924 dart.dcall(cleanUp, value); |
1925 })); | 1925 })); |
1926 } | 1926 } |
1927 if (remaining == 0 && !dart.notNull(eagerError)) { | 1927 if (remaining == 0 && !dart.notNull(eagerError)) { |
1928 result[_completeError](error, stackTrace); | 1928 result[_completeError](error, stackTrace); |
1929 } | 1929 } |
1930 } | 1930 } |
1931 }, core.Object, [core.Object]), {onError: handleError}); | 1931 }, core.Object, [core.Object]), {onError: handleError}); |
1932 } | 1932 } |
(...skipping 10 matching lines...) Expand all Loading... |
1943 if (!dart.notNull(iterator.moveNext())) | 1943 if (!dart.notNull(iterator.moveNext())) |
1944 return false; | 1944 return false; |
1945 return Future$().sync(dart.fn(() => dart.dcall(f, iterator.current))).
then(dart.fn(_ => true, core.bool, [core.Object])); | 1945 return Future$().sync(dart.fn(() => dart.dcall(f, iterator.current))).
then(dart.fn(_ => true, core.bool, [core.Object])); |
1946 })); | 1946 })); |
1947 } | 1947 } |
1948 static doWhile(f) { | 1948 static doWhile(f) { |
1949 dart.as(f, dart.functionType(core.Object, [])); | 1949 dart.as(f, dart.functionType(core.Object, [])); |
1950 let doneSignal = new _Future(); | 1950 let doneSignal = new _Future(); |
1951 let nextIteration = null; | 1951 let nextIteration = null; |
1952 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => { | 1952 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => { |
1953 if (keepGoing) { | 1953 if (dart.notNull(keepGoing)) { |
1954 Future$().sync(f).then(dart.as(nextIteration, __CastType4), {onError
: dart.bind(doneSignal, _completeError)}); | 1954 Future$().sync(f).then(dart.as(nextIteration, __CastType4), {onError
: dart.bind(doneSignal, _completeError)}); |
1955 } else { | 1955 } else { |
1956 doneSignal[_complete](null); | 1956 doneSignal[_complete](null); |
1957 } | 1957 } |
1958 }, core.Object, [core.bool]), {runGuarded: true}); | 1958 }, core.Object, [core.bool]), {runGuarded: true}); |
1959 dart.dcall(nextIteration, true); | 1959 dart.dcall(nextIteration, true); |
1960 return doneSignal; | 1960 return doneSignal; |
1961 } | 1961 } |
1962 } | 1962 } |
1963 dart.setSignature(Future, { | 1963 dart.setSignature(Future, { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 get [_isComplete]() { | 2251 get [_isComplete]() { |
2252 return dart.notNull(this[_state]) >= dart.notNull(_Future$()._VALUE); | 2252 return dart.notNull(this[_state]) >= dart.notNull(_Future$()._VALUE); |
2253 } | 2253 } |
2254 get [_hasValue]() { | 2254 get [_hasValue]() { |
2255 return this[_state] == _Future$()._VALUE; | 2255 return this[_state] == _Future$()._VALUE; |
2256 } | 2256 } |
2257 get [_hasError]() { | 2257 get [_hasError]() { |
2258 return this[_state] == _Future$()._ERROR; | 2258 return this[_state] == _Future$()._ERROR; |
2259 } | 2259 } |
2260 set [_isChained](value) { | 2260 set [_isChained](value) { |
2261 if (value) { | 2261 if (dart.notNull(value)) { |
2262 dart.assert(!dart.notNull(this[_isComplete])); | 2262 dart.assert(!dart.notNull(this[_isComplete])); |
2263 this[_state] = _Future$()._CHAINED; | 2263 this[_state] = _Future$()._CHAINED; |
2264 } else { | 2264 } else { |
2265 dart.assert(this[_isChained]); | 2265 dart.assert(this[_isChained]); |
2266 this[_state] = _Future$()._INCOMPLETE; | 2266 this[_state] = _Future$()._INCOMPLETE; |
2267 } | 2267 } |
2268 } | 2268 } |
2269 then(f, opts) { | 2269 then(f, opts) { |
2270 dart.as(f, dart.functionType(core.Object, [T])); | 2270 dart.as(f, dart.functionType(core.Object, [T])); |
2271 let onError = opts && 'onError' in opts ? opts.onError : null; | 2271 let onError = opts && 'onError' in opts ? opts.onError : null; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 [_setErrorObject](error) { | 2325 [_setErrorObject](error) { |
2326 dart.assert(!dart.notNull(this[_isComplete])); | 2326 dart.assert(!dart.notNull(this[_isComplete])); |
2327 this[_state] = _Future$()._ERROR; | 2327 this[_state] = _Future$()._ERROR; |
2328 this[_resultOrListeners] = error; | 2328 this[_resultOrListeners] = error; |
2329 } | 2329 } |
2330 [_setError](error, stackTrace) { | 2330 [_setError](error, stackTrace) { |
2331 this[_setErrorObject](new AsyncError(error, stackTrace)); | 2331 this[_setErrorObject](new AsyncError(error, stackTrace)); |
2332 } | 2332 } |
2333 [_addListener](listener) { | 2333 [_addListener](listener) { |
2334 dart.assert(listener[_nextListener] == null); | 2334 dart.assert(listener[_nextListener] == null); |
2335 if (this[_isComplete]) { | 2335 if (dart.notNull(this[_isComplete])) { |
2336 this[_zone].scheduleMicrotask(dart.fn(() => { | 2336 this[_zone].scheduleMicrotask(dart.fn(() => { |
2337 _Future$()._propagateToListeners(this, listener); | 2337 _Future$()._propagateToListeners(this, listener); |
2338 })); | 2338 })); |
2339 } else { | 2339 } else { |
2340 listener[_nextListener] = dart.as(this[_resultOrListeners], _FutureLis
tener); | 2340 listener[_nextListener] = dart.as(this[_resultOrListeners], _FutureLis
tener); |
2341 this[_resultOrListeners] = listener; | 2341 this[_resultOrListeners] = listener; |
2342 } | 2342 } |
2343 } | 2343 } |
2344 [_removeListeners]() { | 2344 [_removeListeners]() { |
2345 dart.assert(!dart.notNull(this[_isComplete])); | 2345 dart.assert(!dart.notNull(this[_isComplete])); |
(...skipping 20 matching lines...) Expand all Loading... |
2366 stackTrace = null; | 2366 stackTrace = null; |
2367 dart.assert(target[_isChained]); | 2367 dart.assert(target[_isChained]); |
2368 target[_completeError](error, dart.as(stackTrace, core.StackTrace)); | 2368 target[_completeError](error, dart.as(stackTrace, core.StackTrace)); |
2369 }, core.Object, [core.Object], [core.Object])}); | 2369 }, core.Object, [core.Object], [core.Object])}); |
2370 } | 2370 } |
2371 static _chainCoreFuture(source, target) { | 2371 static _chainCoreFuture(source, target) { |
2372 dart.assert(!dart.notNull(target[_isComplete])); | 2372 dart.assert(!dart.notNull(target[_isComplete])); |
2373 dart.assert(dart.is(source, _Future$())); | 2373 dart.assert(dart.is(source, _Future$())); |
2374 target[_isChained] = true; | 2374 target[_isChained] = true; |
2375 let listener = new _FutureListener.chain(target); | 2375 let listener = new _FutureListener.chain(target); |
2376 if (source[_isComplete]) { | 2376 if (dart.notNull(source[_isComplete])) { |
2377 _Future$()._propagateToListeners(source, listener); | 2377 _Future$()._propagateToListeners(source, listener); |
2378 } else { | 2378 } else { |
2379 source[_addListener](listener); | 2379 source[_addListener](listener); |
2380 } | 2380 } |
2381 } | 2381 } |
2382 [_complete](value) { | 2382 [_complete](value) { |
2383 dart.assert(!dart.notNull(this[_isComplete])); | 2383 dart.assert(!dart.notNull(this[_isComplete])); |
2384 if (dart.is(value, Future)) { | 2384 if (dart.is(value, Future)) { |
2385 if (dart.is(value, _Future$())) { | 2385 if (dart.is(value, _Future$())) { |
2386 _Future$()._chainCoreFuture(dart.as(value, _Future$()), this); | 2386 _Future$()._chainCoreFuture(dart.as(value, _Future$()), this); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 this[_markPendingCompletion](); | 2440 this[_markPendingCompletion](); |
2441 this[_zone].scheduleMicrotask(dart.fn(() => { | 2441 this[_zone].scheduleMicrotask(dart.fn(() => { |
2442 this[_completeError](error, stackTrace); | 2442 this[_completeError](error, stackTrace); |
2443 })); | 2443 })); |
2444 } | 2444 } |
2445 static _propagateToListeners(source, listeners) { | 2445 static _propagateToListeners(source, listeners) { |
2446 while (true) { | 2446 while (true) { |
2447 dart.assert(source[_isComplete]); | 2447 dart.assert(source[_isComplete]); |
2448 let hasError = source[_hasError]; | 2448 let hasError = source[_hasError]; |
2449 if (listeners == null) { | 2449 if (listeners == null) { |
2450 if (hasError) { | 2450 if (dart.notNull(hasError)) { |
2451 let asyncError = source[_error]; | 2451 let asyncError = source[_error]; |
2452 source[_zone].handleUncaughtError(asyncError.error, asyncError.sta
ckTrace); | 2452 source[_zone].handleUncaughtError(asyncError.error, asyncError.sta
ckTrace); |
2453 } | 2453 } |
2454 return; | 2454 return; |
2455 } | 2455 } |
2456 while (listeners[_nextListener] != null) { | 2456 while (listeners[_nextListener] != null) { |
2457 let listener = listeners; | 2457 let listener = listeners; |
2458 listeners = listener[_nextListener]; | 2458 listeners = listener[_nextListener]; |
2459 listener[_nextListener] = null; | 2459 listener[_nextListener] = null; |
2460 _Future$()._propagateToListeners(source, listener); | 2460 _Future$()._propagateToListeners(source, listener); |
2461 } | 2461 } |
2462 let listener = listeners; | 2462 let listener = listeners; |
2463 let listenerHasValue = true; | 2463 let listenerHasValue = true; |
2464 let sourceValue = hasError ? null : source[_value]; | 2464 let sourceValue = dart.notNull(hasError) ? null : source[_value]; |
2465 let listenerValueOrError = sourceValue; | 2465 let listenerValueOrError = sourceValue; |
2466 let isPropagationAborted = false; | 2466 let isPropagationAborted = false; |
2467 if (dart.notNull(hasError) || dart.notNull(listener.handlesValue) || d
art.notNull(listener.handlesComplete)) { | 2467 if (dart.notNull(hasError) || dart.notNull(listener.handlesValue) || d
art.notNull(listener.handlesComplete)) { |
2468 let zone = listener[_zone]; | 2468 let zone = listener[_zone]; |
2469 if (dart.notNull(hasError) && !dart.notNull(source[_zone].inSameErro
rZone(zone))) { | 2469 if (dart.notNull(hasError) && !dart.notNull(source[_zone].inSameErro
rZone(zone))) { |
2470 let asyncError = source[_error]; | 2470 let asyncError = source[_error]; |
2471 source[_zone].handleUncaughtError(asyncError.error, asyncError.sta
ckTrace); | 2471 source[_zone].handleUncaughtError(asyncError.error, asyncError.sta
ckTrace); |
2472 return; | 2472 return; |
2473 } | 2473 } |
2474 let oldZone = null; | 2474 let oldZone = null; |
2475 if (!dart.notNull(core.identical(Zone.current, zone))) { | 2475 if (!dart.notNull(core.identical(Zone.current, zone))) { |
2476 oldZone = Zone._enter(zone); | 2476 oldZone = Zone._enter(zone); |
2477 } | 2477 } |
2478 let handleValueCallback = () => { | 2478 let handleValueCallback = () => { |
2479 try { | 2479 try { |
2480 listenerValueOrError = zone.runUnary(listener[_onValue], sourceV
alue); | 2480 listenerValueOrError = zone.runUnary(listener[_onValue], sourceV
alue); |
2481 return true; | 2481 return true; |
2482 } catch (e) { | 2482 } catch (e) { |
2483 let s = dart.stackTrace(e); | 2483 let s = dart.stackTrace(e); |
2484 listenerValueOrError = new AsyncError(e, s); | 2484 listenerValueOrError = new AsyncError(e, s); |
2485 return false; | 2485 return false; |
2486 } | 2486 } |
2487 | 2487 |
2488 }; | 2488 }; |
2489 dart.fn(handleValueCallback, core.bool, []); | 2489 dart.fn(handleValueCallback, core.bool, []); |
2490 let handleError = () => { | 2490 let handleError = () => { |
2491 let asyncError = source[_error]; | 2491 let asyncError = source[_error]; |
2492 let matchesTest = true; | 2492 let matchesTest = true; |
2493 if (listener.hasErrorTest) { | 2493 if (dart.notNull(listener.hasErrorTest)) { |
2494 let test = listener[_errorTest]; | 2494 let test = listener[_errorTest]; |
2495 try { | 2495 try { |
2496 matchesTest = dart.as(zone.runUnary(test, asyncError.error), c
ore.bool); | 2496 matchesTest = dart.as(zone.runUnary(test, asyncError.error), c
ore.bool); |
2497 } catch (e) { | 2497 } catch (e) { |
2498 let s = dart.stackTrace(e); | 2498 let s = dart.stackTrace(e); |
2499 listenerValueOrError = core.identical(asyncError.error, e) ? a
syncError : new AsyncError(e, s); | 2499 listenerValueOrError = dart.notNull(core.identical(asyncError.
error, e)) ? asyncError : new AsyncError(e, s); |
2500 listenerHasValue = false; | 2500 listenerHasValue = false; |
2501 return; | 2501 return; |
2502 } | 2502 } |
2503 | 2503 |
2504 } | 2504 } |
2505 let errorCallback = listener[_onError]; | 2505 let errorCallback = listener[_onError]; |
2506 if (dart.notNull(matchesTest) && dart.notNull(errorCallback != nul
l)) { | 2506 if (dart.notNull(matchesTest) && errorCallback != null) { |
2507 try { | 2507 try { |
2508 if (dart.is(errorCallback, ZoneBinaryCallback)) { | 2508 if (dart.is(errorCallback, ZoneBinaryCallback)) { |
2509 listenerValueOrError = zone.runBinary(errorCallback, asyncEr
ror.error, asyncError.stackTrace); | 2509 listenerValueOrError = zone.runBinary(errorCallback, asyncEr
ror.error, asyncError.stackTrace); |
2510 } else { | 2510 } else { |
2511 listenerValueOrError = zone.runUnary(dart.as(errorCallback,
__CastType10), asyncError.error); | 2511 listenerValueOrError = zone.runUnary(dart.as(errorCallback,
__CastType10), asyncError.error); |
2512 } | 2512 } |
2513 } catch (e) { | 2513 } catch (e) { |
2514 let s = dart.stackTrace(e); | 2514 let s = dart.stackTrace(e); |
2515 listenerValueOrError = core.identical(asyncError.error, e) ? a
syncError : new AsyncError(e, s); | 2515 listenerValueOrError = dart.notNull(core.identical(asyncError.
error, e)) ? asyncError : new AsyncError(e, s); |
2516 listenerHasValue = false; | 2516 listenerHasValue = false; |
2517 return; | 2517 return; |
2518 } | 2518 } |
2519 | 2519 |
2520 listenerHasValue = true; | 2520 listenerHasValue = true; |
2521 } else { | 2521 } else { |
2522 listenerValueOrError = asyncError; | 2522 listenerValueOrError = asyncError; |
2523 listenerHasValue = false; | 2523 listenerHasValue = false; |
2524 } | 2524 } |
2525 }; | 2525 }; |
(...skipping 25 matching lines...) Expand all Loading... |
2551 if (!dart.is(completeResult, _Future$())) { | 2551 if (!dart.is(completeResult, _Future$())) { |
2552 completeResult = new (_Future$())(); | 2552 completeResult = new (_Future$())(); |
2553 dart.dsend(completeResult, _setError, error, stackTrace); | 2553 dart.dsend(completeResult, _setError, error, stackTrace); |
2554 } | 2554 } |
2555 _Future$()._propagateToListeners(dart.as(completeResult, _Fu
ture$()), new _FutureListener.chain(result)); | 2555 _Future$()._propagateToListeners(dart.as(completeResult, _Fu
ture$()), new _FutureListener.chain(result)); |
2556 }, core.Object, [core.Object], [core.Object])}); | 2556 }, core.Object, [core.Object], [core.Object])}); |
2557 } | 2557 } |
2558 }; | 2558 }; |
2559 dart.fn(handleWhenCompleteCallback, dart.void, []); | 2559 dart.fn(handleWhenCompleteCallback, dart.void, []); |
2560 if (!dart.notNull(hasError)) { | 2560 if (!dart.notNull(hasError)) { |
2561 if (listener.handlesValue) { | 2561 if (dart.notNull(listener.handlesValue)) { |
2562 listenerHasValue = handleValueCallback(); | 2562 listenerHasValue = handleValueCallback(); |
2563 } | 2563 } |
2564 } else { | 2564 } else { |
2565 handleError(); | 2565 handleError(); |
2566 } | 2566 } |
2567 if (listener.handlesComplete) { | 2567 if (dart.notNull(listener.handlesComplete)) { |
2568 handleWhenCompleteCallback(); | 2568 handleWhenCompleteCallback(); |
2569 } | 2569 } |
2570 if (oldZone != null) | 2570 if (oldZone != null) |
2571 Zone._leave(oldZone); | 2571 Zone._leave(oldZone); |
2572 if (isPropagationAborted) | 2572 if (dart.notNull(isPropagationAborted)) |
2573 return; | 2573 return; |
2574 if (dart.notNull(listenerHasValue) && !dart.notNull(core.identical(s
ourceValue, listenerValueOrError)) && dart.is(listenerValueOrError, Future)) { | 2574 if (dart.notNull(listenerHasValue) && !dart.notNull(core.identical(s
ourceValue, listenerValueOrError)) && dart.is(listenerValueOrError, Future)) { |
2575 let chainSource = dart.as(listenerValueOrError, Future); | 2575 let chainSource = dart.as(listenerValueOrError, Future); |
2576 let result = listener.result; | 2576 let result = listener.result; |
2577 if (dart.is(chainSource, _Future$())) { | 2577 if (dart.is(chainSource, _Future$())) { |
2578 if (chainSource[_isComplete]) { | 2578 if (dart.notNull(chainSource[_isComplete])) { |
2579 result[_isChained] = true; | 2579 result[_isChained] = true; |
2580 source = chainSource; | 2580 source = chainSource; |
2581 listeners = new _FutureListener.chain(result); | 2581 listeners = new _FutureListener.chain(result); |
2582 continue; | 2582 continue; |
2583 } else { | 2583 } else { |
2584 _Future$()._chainCoreFuture(chainSource, result); | 2584 _Future$()._chainCoreFuture(chainSource, result); |
2585 } | 2585 } |
2586 } else { | 2586 } else { |
2587 _Future$()._chainForeignFuture(chainSource, result); | 2587 _Future$()._chainForeignFuture(chainSource, result); |
2588 } | 2588 } |
2589 return; | 2589 return; |
2590 } | 2590 } |
2591 } | 2591 } |
2592 let result = listener.result; | 2592 let result = listener.result; |
2593 listeners = result[_removeListeners](); | 2593 listeners = result[_removeListeners](); |
2594 if (listenerHasValue) { | 2594 if (dart.notNull(listenerHasValue)) { |
2595 result[_setValue](listenerValueOrError); | 2595 result[_setValue](listenerValueOrError); |
2596 } else { | 2596 } else { |
2597 let asyncError = dart.as(listenerValueOrError, AsyncError); | 2597 let asyncError = dart.as(listenerValueOrError, AsyncError); |
2598 result[_setErrorObject](asyncError); | 2598 result[_setErrorObject](asyncError); |
2599 } | 2599 } |
2600 source = result; | 2600 source = result; |
2601 } | 2601 } |
2602 } | 2602 } |
2603 timeout(timeLimit, opts) { | 2603 timeout(timeLimit, opts) { |
2604 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; | 2604 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; |
2605 dart.as(onTimeout, dart.functionType(core.Object, [])); | 2605 dart.as(onTimeout, dart.functionType(core.Object, [])); |
2606 if (this[_isComplete]) | 2606 if (dart.notNull(this[_isComplete])) |
2607 return new (_Future$()).immediate(this); | 2607 return new (_Future$()).immediate(this); |
2608 let result = new (_Future$())(); | 2608 let result = new (_Future$())(); |
2609 let timer = null; | 2609 let timer = null; |
2610 if (onTimeout == null) { | 2610 if (onTimeout == null) { |
2611 timer = Timer.new(timeLimit, dart.fn(() => { | 2611 timer = Timer.new(timeLimit, dart.fn(() => { |
2612 result[_completeError](new TimeoutException("Future not completed",
timeLimit)); | 2612 result[_completeError](new TimeoutException("Future not completed",
timeLimit)); |
2613 })); | 2613 })); |
2614 } else { | 2614 } else { |
2615 let zone = Zone.current; | 2615 let zone = Zone.current; |
2616 onTimeout = zone.registerCallback(onTimeout); | 2616 onTimeout = zone.registerCallback(onTimeout); |
2617 timer = Timer.new(timeLimit, dart.fn(() => { | 2617 timer = Timer.new(timeLimit, dart.fn(() => { |
2618 try { | 2618 try { |
2619 result[_complete](zone.run(onTimeout)); | 2619 result[_complete](zone.run(onTimeout)); |
2620 } catch (e) { | 2620 } catch (e) { |
2621 let s = dart.stackTrace(e); | 2621 let s = dart.stackTrace(e); |
2622 result[_completeError](e, s); | 2622 result[_completeError](e, s); |
2623 } | 2623 } |
2624 | 2624 |
2625 })); | 2625 })); |
2626 } | 2626 } |
2627 this.then(dart.fn(v => { | 2627 this.then(dart.fn(v => { |
2628 dart.as(v, T); | 2628 dart.as(v, T); |
2629 if (timer.isActive) { | 2629 if (dart.notNull(timer.isActive)) { |
2630 timer.cancel(); | 2630 timer.cancel(); |
2631 result[_completeWithValue](v); | 2631 result[_completeWithValue](v); |
2632 } | 2632 } |
2633 }, core.Object, [T]), {onError: dart.fn((e, s) => { | 2633 }, core.Object, [T]), {onError: dart.fn((e, s) => { |
2634 if (timer.isActive) { | 2634 if (dart.notNull(timer.isActive)) { |
2635 timer.cancel(); | 2635 timer.cancel(); |
2636 result[_completeError](e, dart.as(s, core.StackTrace)); | 2636 result[_completeError](e, dart.as(s, core.StackTrace)); |
2637 } | 2637 } |
2638 })}); | 2638 })}); |
2639 return result; | 2639 return result; |
2640 } | 2640 } |
2641 } | 2641 } |
2642 _Future[dart.implements] = () => [Future$(T)]; | 2642 _Future[dart.implements] = () => [Future$(T)]; |
2643 dart.defineNamedConstructor(_Future, 'immediate'); | 2643 dart.defineNamedConstructor(_Future, 'immediate'); |
2644 dart.defineNamedConstructor(_Future, 'immediateError'); | 2644 dart.defineNamedConstructor(_Future, 'immediateError'); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2750 entry.next = exports._lastPriorityCallback.next; | 2750 entry.next = exports._lastPriorityCallback.next; |
2751 exports._lastPriorityCallback.next = entry; | 2751 exports._lastPriorityCallback.next = entry; |
2752 exports._lastPriorityCallback = entry; | 2752 exports._lastPriorityCallback = entry; |
2753 if (entry.next == null) { | 2753 if (entry.next == null) { |
2754 exports._lastCallback = entry; | 2754 exports._lastCallback = entry; |
2755 } | 2755 } |
2756 } | 2756 } |
2757 } | 2757 } |
2758 dart.fn(_schedulePriorityAsyncCallback, dart.void, [core.Object]); | 2758 dart.fn(_schedulePriorityAsyncCallback, dart.void, [core.Object]); |
2759 function scheduleMicrotask(callback) { | 2759 function scheduleMicrotask(callback) { |
2760 if (core.identical(_ROOT_ZONE, Zone.current)) { | 2760 if (dart.notNull(core.identical(_ROOT_ZONE, Zone.current))) { |
2761 _rootScheduleMicrotask(null, null, _ROOT_ZONE, callback); | 2761 _rootScheduleMicrotask(null, null, _ROOT_ZONE, callback); |
2762 return; | 2762 return; |
2763 } | 2763 } |
2764 Zone.current.scheduleMicrotask(Zone.current.bindCallback(callback, {runGuard
ed: true})); | 2764 Zone.current.scheduleMicrotask(Zone.current.bindCallback(callback, {runGuard
ed: true})); |
2765 } | 2765 } |
2766 dart.fn(scheduleMicrotask, dart.void, [dart.functionType(dart.void, [])]); | 2766 dart.fn(scheduleMicrotask, dart.void, [dart.functionType(dart.void, [])]); |
2767 class _AsyncRun extends core.Object { | 2767 class _AsyncRun extends core.Object { |
2768 static _scheduleImmediate(callback) { | 2768 static _scheduleImmediate(callback) { |
2769 dart.dcall(_AsyncRun.scheduleImmediateClosure, callback); | 2769 dart.dcall(_AsyncRun.scheduleImmediateClosure, callback); |
2770 } | 2770 } |
2771 static _initializeScheduleImmediate() { | 2771 static _initializeScheduleImmediate() { |
2772 if (self.scheduleImmediate != null) { | 2772 if (self.scheduleImmediate != null) { |
2773 return _AsyncRun._scheduleImmediateJsOverride; | 2773 return _AsyncRun._scheduleImmediateJsOverride; |
2774 } | 2774 } |
2775 if (dart.notNull(self.MutationObserver != null) && dart.notNull(self.docum
ent != null)) { | 2775 if (self.MutationObserver != null && self.document != null) { |
2776 let div = self.document.createElement("div"); | 2776 let div = self.document.createElement("div"); |
2777 let span = self.document.createElement("span"); | 2777 let span = self.document.createElement("span"); |
2778 let storedCallback = null; | 2778 let storedCallback = null; |
2779 let internalCallback = _ => { | 2779 let internalCallback = _ => { |
2780 _isolate_helper.leaveJsAsync(); | 2780 _isolate_helper.leaveJsAsync(); |
2781 let f = storedCallback; | 2781 let f = storedCallback; |
2782 storedCallback = null; | 2782 storedCallback = null; |
2783 dart.dcall(f); | 2783 dart.dcall(f); |
2784 }; | 2784 }; |
2785 dart.fn(internalCallback); | 2785 dart.fn(internalCallback); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(dart.v
oid, [])); | 2959 let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(dart.v
oid, [])); |
2960 let __CastType18 = dart.typedef('__CastType18', () => dart.functionType(dart.v
oid, [EventSink])); | 2960 let __CastType18 = dart.typedef('__CastType18', () => dart.functionType(dart.v
oid, [EventSink])); |
2961 let StreamController$ = dart.generic(function(T) { | 2961 let StreamController$ = dart.generic(function(T) { |
2962 class StreamController extends core.Object { | 2962 class StreamController extends core.Object { |
2963 static new(opts) { | 2963 static new(opts) { |
2964 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 2964 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
2965 let onPause = opts && 'onPause' in opts ? opts.onPause : null; | 2965 let onPause = opts && 'onPause' in opts ? opts.onPause : null; |
2966 let onResume = opts && 'onResume' in opts ? opts.onResume : null; | 2966 let onResume = opts && 'onResume' in opts ? opts.onResume : null; |
2967 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 2967 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
2968 let sync = opts && 'sync' in opts ? opts.sync : false; | 2968 let sync = opts && 'sync' in opts ? opts.sync : false; |
2969 if (dart.notNull(onListen == null) && dart.notNull(onPause == null) && d
art.notNull(onResume == null) && dart.notNull(onCancel == null)) { | 2969 if (onListen == null && onPause == null && onResume == null && onCancel
== null) { |
2970 return dart.as(sync ? new _NoCallbackSyncStreamController() : new _NoC
allbackAsyncStreamController(), StreamController$(T)); | 2970 return dart.as(dart.notNull(sync) ? new _NoCallbackSyncStreamControlle
r() : new _NoCallbackAsyncStreamController(), StreamController$(T)); |
2971 } | 2971 } |
2972 return sync ? new (_SyncStreamController$(T))(onListen, onPause, onResum
e, onCancel) : new (_AsyncStreamController$(T))(onListen, onPause, onResume, onC
ancel); | 2972 return dart.notNull(sync) ? new (_SyncStreamController$(T))(onListen, on
Pause, onResume, onCancel) : new (_AsyncStreamController$(T))(onListen, onPause,
onResume, onCancel); |
2973 } | 2973 } |
2974 static broadcast(opts) { | 2974 static broadcast(opts) { |
2975 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 2975 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
2976 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 2976 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
2977 let sync = opts && 'sync' in opts ? opts.sync : false; | 2977 let sync = opts && 'sync' in opts ? opts.sync : false; |
2978 return sync ? new (_SyncBroadcastStreamController$(T))(onListen, onCance
l) : new (_AsyncBroadcastStreamController$(T))(onListen, onCancel); | 2978 return dart.notNull(sync) ? new (_SyncBroadcastStreamController$(T))(onL
isten, onCancel) : new (_AsyncBroadcastStreamController$(T))(onListen, onCancel)
; |
2979 } | 2979 } |
2980 } | 2980 } |
2981 StreamController[dart.implements] = () => [StreamSink$(T)]; | 2981 StreamController[dart.implements] = () => [StreamSink$(T)]; |
2982 dart.setSignature(StreamController, { | 2982 dart.setSignature(StreamController, { |
2983 constructors: () => ({ | 2983 constructors: () => ({ |
2984 new: [StreamController$(T), [], {onListen: dart.functionType(dart.void,
[]), onPause: dart.functionType(dart.void, []), onResume: dart.functionType(dart
.void, []), onCancel: dart.functionType(core.Object, []), sync: core.bool}], | 2984 new: [StreamController$(T), [], {onListen: dart.functionType(dart.void,
[]), onPause: dart.functionType(dart.void, []), onResume: dart.functionType(dart
.void, []), onCancel: dart.functionType(core.Object, []), sync: core.bool}], |
2985 broadcast: [StreamController$(T), [], {onListen: dart.functionType(dart.
void, []), onCancel: dart.functionType(dart.void, []), sync: core.bool}] | 2985 broadcast: [StreamController$(T), [], {onListen: dart.functionType(dart.
void, []), onCancel: dart.functionType(dart.void, []), sync: core.bool}] |
2986 }) | 2986 }) |
2987 }); | 2987 }); |
2988 return StreamController; | 2988 return StreamController; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 get hasListener() { | 3036 get hasListener() { |
3037 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_SUBSCRIBED)) != 0; | 3037 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_SUBSCRIBED)) != 0; |
3038 } | 3038 } |
3039 get [_isInitialState]() { | 3039 get [_isInitialState]() { |
3040 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_SUBSCRIPTION_MASK)) == _StreamController$()._STATE_INITIAL; | 3040 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_SUBSCRIPTION_MASK)) == _StreamController$()._STATE_INITIAL; |
3041 } | 3041 } |
3042 get isClosed() { | 3042 get isClosed() { |
3043 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_CLOSED)) != 0; | 3043 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_CLOSED)) != 0; |
3044 } | 3044 } |
3045 get isPaused() { | 3045 get isPaused() { |
3046 return this.hasListener ? this[_subscription][_isInputPaused] : !dart.no
tNull(this[_isCanceled]); | 3046 return dart.notNull(this.hasListener) ? this[_subscription][_isInputPaus
ed] : !dart.notNull(this[_isCanceled]); |
3047 } | 3047 } |
3048 get [_isAddingStream]() { | 3048 get [_isAddingStream]() { |
3049 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_ADDSTREAM)) != 0; | 3049 return (dart.notNull(this[_state]) & dart.notNull(_StreamController$()._
STATE_ADDSTREAM)) != 0; |
3050 } | 3050 } |
3051 get [_mayAddEvent]() { | 3051 get [_mayAddEvent]() { |
3052 return dart.notNull(this[_state]) < dart.notNull(_StreamController$()._S
TATE_CLOSED); | 3052 return dart.notNull(this[_state]) < dart.notNull(_StreamController$()._S
TATE_CLOSED); |
3053 } | 3053 } |
3054 get [_pendingEvents]() { | 3054 get [_pendingEvents]() { |
3055 dart.assert(this[_isInitialState]); | 3055 dart.assert(this[_isInitialState]); |
3056 if (!dart.notNull(this[_isAddingStream])) { | 3056 if (!dart.notNull(this[_isAddingStream])) { |
3057 return dart.as(this[_varData], _PendingEvents); | 3057 return dart.as(this[_varData], _PendingEvents); |
3058 } | 3058 } |
3059 let state = dart.as(this[_varData], _StreamControllerAddStreamState); | 3059 let state = dart.as(this[_varData], _StreamControllerAddStreamState); |
3060 return dart.as(state.varData, _PendingEvents); | 3060 return dart.as(state.varData, _PendingEvents); |
3061 } | 3061 } |
3062 [_ensurePendingEvents]() { | 3062 [_ensurePendingEvents]() { |
3063 dart.assert(this[_isInitialState]); | 3063 dart.assert(this[_isInitialState]); |
3064 if (!dart.notNull(this[_isAddingStream])) { | 3064 if (!dart.notNull(this[_isAddingStream])) { |
3065 if (this[_varData] == null) | 3065 if (this[_varData] == null) |
3066 this[_varData] = new _StreamImplEvents(); | 3066 this[_varData] = new _StreamImplEvents(); |
3067 return dart.as(this[_varData], _StreamImplEvents); | 3067 return dart.as(this[_varData], _StreamImplEvents); |
3068 } | 3068 } |
3069 let state = dart.as(this[_varData], _StreamControllerAddStreamState); | 3069 let state = dart.as(this[_varData], _StreamControllerAddStreamState); |
3070 if (state.varData == null) | 3070 if (state.varData == null) |
3071 state.varData = new _StreamImplEvents(); | 3071 state.varData = new _StreamImplEvents(); |
3072 return dart.as(state.varData, _StreamImplEvents); | 3072 return dart.as(state.varData, _StreamImplEvents); |
3073 } | 3073 } |
3074 get [_subscription]() { | 3074 get [_subscription]() { |
3075 dart.assert(this.hasListener); | 3075 dart.assert(this.hasListener); |
3076 if (this[_isAddingStream]) { | 3076 if (dart.notNull(this[_isAddingStream])) { |
3077 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); | 3077 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); |
3078 return dart.as(addState.varData, _ControllerSubscription); | 3078 return dart.as(addState.varData, _ControllerSubscription); |
3079 } | 3079 } |
3080 return dart.as(this[_varData], _ControllerSubscription); | 3080 return dart.as(this[_varData], _ControllerSubscription); |
3081 } | 3081 } |
3082 [_badEventState]() { | 3082 [_badEventState]() { |
3083 if (this.isClosed) { | 3083 if (dart.notNull(this.isClosed)) { |
3084 return new core.StateError("Cannot add event after closing"); | 3084 return new core.StateError("Cannot add event after closing"); |
3085 } | 3085 } |
3086 dart.assert(this[_isAddingStream]); | 3086 dart.assert(this[_isAddingStream]); |
3087 return new core.StateError("Cannot add event while adding a stream"); | 3087 return new core.StateError("Cannot add event while adding a stream"); |
3088 } | 3088 } |
3089 addStream(source, opts) { | 3089 addStream(source, opts) { |
3090 dart.as(source, Stream$(T)); | 3090 dart.as(source, Stream$(T)); |
3091 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: true; | 3091 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: true; |
3092 if (!dart.notNull(this[_mayAddEvent])) | 3092 if (!dart.notNull(this[_mayAddEvent])) |
3093 throw this[_badEventState](); | 3093 throw this[_badEventState](); |
3094 if (this[_isCanceled]) | 3094 if (dart.notNull(this[_isCanceled])) |
3095 return new _Future.immediate(null); | 3095 return new _Future.immediate(null); |
3096 let addState = new _StreamControllerAddStreamState(this, this[_varData],
source, cancelOnError); | 3096 let addState = new _StreamControllerAddStreamState(this, this[_varData],
source, cancelOnError); |
3097 this[_varData] = addState; | 3097 this[_varData] = addState; |
3098 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll
er$()._STATE_ADDSTREAM); | 3098 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll
er$()._STATE_ADDSTREAM); |
3099 return addState.addStreamFuture; | 3099 return addState.addStreamFuture; |
3100 } | 3100 } |
3101 get done() { | 3101 get done() { |
3102 return this[_ensureDoneFuture](); | 3102 return this[_ensureDoneFuture](); |
3103 } | 3103 } |
3104 [_ensureDoneFuture]() { | 3104 [_ensureDoneFuture]() { |
3105 if (this[_doneFuture] == null) { | 3105 if (this[_doneFuture] == null) { |
3106 this[_doneFuture] = this[_isCanceled] ? Future._nullFuture : new _Futu
re(); | 3106 this[_doneFuture] = dart.notNull(this[_isCanceled]) ? Future._nullFutu
re : new _Future(); |
3107 } | 3107 } |
3108 return this[_doneFuture]; | 3108 return this[_doneFuture]; |
3109 } | 3109 } |
3110 add(value) { | 3110 add(value) { |
3111 dart.as(value, T); | 3111 dart.as(value, T); |
3112 if (!dart.notNull(this[_mayAddEvent])) | 3112 if (!dart.notNull(this[_mayAddEvent])) |
3113 throw this[_badEventState](); | 3113 throw this[_badEventState](); |
3114 this[_add](value); | 3114 this[_add](value); |
3115 } | 3115 } |
3116 addError(error, stackTrace) { | 3116 addError(error, stackTrace) { |
3117 if (stackTrace === void 0) | 3117 if (stackTrace === void 0) |
3118 stackTrace = null; | 3118 stackTrace = null; |
3119 error = _nonNullError(error); | 3119 error = _nonNullError(error); |
3120 if (!dart.notNull(this[_mayAddEvent])) | 3120 if (!dart.notNull(this[_mayAddEvent])) |
3121 throw this[_badEventState](); | 3121 throw this[_badEventState](); |
3122 let replacement = Zone.current.errorCallback(error, stackTrace); | 3122 let replacement = Zone.current.errorCallback(error, stackTrace); |
3123 if (replacement != null) { | 3123 if (replacement != null) { |
3124 error = _nonNullError(replacement.error); | 3124 error = _nonNullError(replacement.error); |
3125 stackTrace = replacement.stackTrace; | 3125 stackTrace = replacement.stackTrace; |
3126 } | 3126 } |
3127 this[_addError](error, stackTrace); | 3127 this[_addError](error, stackTrace); |
3128 } | 3128 } |
3129 close() { | 3129 close() { |
3130 if (this.isClosed) { | 3130 if (dart.notNull(this.isClosed)) { |
3131 return this[_ensureDoneFuture](); | 3131 return this[_ensureDoneFuture](); |
3132 } | 3132 } |
3133 if (!dart.notNull(this[_mayAddEvent])) | 3133 if (!dart.notNull(this[_mayAddEvent])) |
3134 throw this[_badEventState](); | 3134 throw this[_badEventState](); |
3135 this[_closeUnchecked](); | 3135 this[_closeUnchecked](); |
3136 return this[_ensureDoneFuture](); | 3136 return this[_ensureDoneFuture](); |
3137 } | 3137 } |
3138 [_closeUnchecked]() { | 3138 [_closeUnchecked]() { |
3139 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll
er$()._STATE_CLOSED); | 3139 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll
er$()._STATE_CLOSED); |
3140 if (this.hasListener) { | 3140 if (dart.notNull(this.hasListener)) { |
3141 this[_sendDone](); | 3141 this[_sendDone](); |
3142 } else if (this[_isInitialState]) { | 3142 } else if (dart.notNull(this[_isInitialState])) { |
3143 this[_ensurePendingEvents]().add(dart.const(new _DelayedDone())); | 3143 this[_ensurePendingEvents]().add(dart.const(new _DelayedDone())); |
3144 } | 3144 } |
3145 } | 3145 } |
3146 [_add](value) { | 3146 [_add](value) { |
3147 dart.as(value, T); | 3147 dart.as(value, T); |
3148 if (this.hasListener) { | 3148 if (dart.notNull(this.hasListener)) { |
3149 this[_sendData](value); | 3149 this[_sendData](value); |
3150 } else if (this[_isInitialState]) { | 3150 } else if (dart.notNull(this[_isInitialState])) { |
3151 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value)); | 3151 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value)); |
3152 } | 3152 } |
3153 } | 3153 } |
3154 [_addError](error, stackTrace) { | 3154 [_addError](error, stackTrace) { |
3155 if (this.hasListener) { | 3155 if (dart.notNull(this.hasListener)) { |
3156 this[_sendError](error, stackTrace); | 3156 this[_sendError](error, stackTrace); |
3157 } else if (this[_isInitialState]) { | 3157 } else if (dart.notNull(this[_isInitialState])) { |
3158 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace))
; | 3158 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace))
; |
3159 } | 3159 } |
3160 } | 3160 } |
3161 [_close]() { | 3161 [_close]() { |
3162 dart.assert(this[_isAddingStream]); | 3162 dart.assert(this[_isAddingStream]); |
3163 let addState = dart.as(this[_varData], _StreamControllerAddStreamState); | 3163 let addState = dart.as(this[_varData], _StreamControllerAddStreamState); |
3164 this[_varData] = addState.varData; | 3164 this[_varData] = addState.varData; |
3165 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_StreamControl
ler$()._STATE_ADDSTREAM); | 3165 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_StreamControl
ler$()._STATE_ADDSTREAM); |
3166 addState.complete(); | 3166 addState.complete(); |
3167 } | 3167 } |
3168 [_subscribe](onData, onError, onDone, cancelOnError) { | 3168 [_subscribe](onData, onError, onDone, cancelOnError) { |
3169 dart.as(onData, dart.functionType(dart.void, [T])); | 3169 dart.as(onData, dart.functionType(dart.void, [T])); |
3170 dart.as(onDone, dart.functionType(dart.void, [])); | 3170 dart.as(onDone, dart.functionType(dart.void, [])); |
3171 if (!dart.notNull(this[_isInitialState])) { | 3171 if (!dart.notNull(this[_isInitialState])) { |
3172 throw new core.StateError("Stream has already been listened to."); | 3172 throw new core.StateError("Stream has already been listened to."); |
3173 } | 3173 } |
3174 let subscription = new _ControllerSubscription(this, onData, onError, on
Done, cancelOnError); | 3174 let subscription = new _ControllerSubscription(this, onData, onError, on
Done, cancelOnError); |
3175 let pendingEvents = this[_pendingEvents]; | 3175 let pendingEvents = this[_pendingEvents]; |
3176 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll
er$()._STATE_SUBSCRIBED); | 3176 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll
er$()._STATE_SUBSCRIBED); |
3177 if (this[_isAddingStream]) { | 3177 if (dart.notNull(this[_isAddingStream])) { |
3178 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); | 3178 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); |
3179 addState.varData = subscription; | 3179 addState.varData = subscription; |
3180 addState.resume(); | 3180 addState.resume(); |
3181 } else { | 3181 } else { |
3182 this[_varData] = subscription; | 3182 this[_varData] = subscription; |
3183 } | 3183 } |
3184 subscription[_setPendingEvents](pendingEvents); | 3184 subscription[_setPendingEvents](pendingEvents); |
3185 subscription[_guardCallback](dart.fn(() => { | 3185 subscription[_guardCallback](dart.fn(() => { |
3186 _runGuarded(this[_onListen]); | 3186 _runGuarded(this[_onListen]); |
3187 })); | 3187 })); |
3188 return dart.as(subscription, StreamSubscription$(T)); | 3188 return dart.as(subscription, StreamSubscription$(T)); |
3189 } | 3189 } |
3190 [_recordCancel](subscription) { | 3190 [_recordCancel](subscription) { |
3191 dart.as(subscription, StreamSubscription$(T)); | 3191 dart.as(subscription, StreamSubscription$(T)); |
3192 let result = null; | 3192 let result = null; |
3193 if (this[_isAddingStream]) { | 3193 if (dart.notNull(this[_isAddingStream])) { |
3194 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); | 3194 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); |
3195 result = addState.cancel(); | 3195 result = addState.cancel(); |
3196 } | 3196 } |
3197 this[_varData] = null; | 3197 this[_varData] = null; |
3198 this[_state] = dart.notNull(this[_state]) & ~(dart.notNull(_StreamContro
ller$()._STATE_SUBSCRIBED) | dart.notNull(_StreamController$()._STATE_ADDSTREAM)
) | dart.notNull(_StreamController$()._STATE_CANCELED); | 3198 this[_state] = dart.notNull(this[_state]) & ~(dart.notNull(_StreamContro
ller$()._STATE_SUBSCRIBED) | dart.notNull(_StreamController$()._STATE_ADDSTREAM)
) | dart.notNull(_StreamController$()._STATE_CANCELED); |
3199 if (this[_onCancel] != null) { | 3199 if (this[_onCancel] != null) { |
3200 if (result == null) { | 3200 if (result == null) { |
3201 try { | 3201 try { |
3202 result = dart.as(this[_onCancel](), Future); | 3202 result = dart.as(this[_onCancel](), Future); |
3203 } catch (e) { | 3203 } catch (e) { |
3204 let s = dart.stackTrace(e); | 3204 let s = dart.stackTrace(e); |
3205 result = new _Future(); | 3205 result = new _Future(); |
3206 result[_asyncCompleteError](e, s); | 3206 result[_asyncCompleteError](e, s); |
3207 } | 3207 } |
3208 | 3208 |
3209 } else { | 3209 } else { |
3210 result = result.whenComplete(this[_onCancel]); | 3210 result = result.whenComplete(this[_onCancel]); |
3211 } | 3211 } |
3212 } | 3212 } |
3213 let complete = () => { | 3213 let complete = () => { |
3214 if (dart.notNull(this[_doneFuture] != null) && dart.notNull(this[_done
Future][_mayComplete])) { | 3214 if (this[_doneFuture] != null && dart.notNull(this[_doneFuture][_mayCo
mplete])) { |
3215 this[_doneFuture][_asyncComplete](null); | 3215 this[_doneFuture][_asyncComplete](null); |
3216 } | 3216 } |
3217 }; | 3217 }; |
3218 dart.fn(complete, dart.void, []); | 3218 dart.fn(complete, dart.void, []); |
3219 if (result != null) { | 3219 if (result != null) { |
3220 result = result.whenComplete(complete); | 3220 result = result.whenComplete(complete); |
3221 } else { | 3221 } else { |
3222 complete(); | 3222 complete(); |
3223 } | 3223 } |
3224 return result; | 3224 return result; |
3225 } | 3225 } |
3226 [_recordPause](subscription) { | 3226 [_recordPause](subscription) { |
3227 dart.as(subscription, StreamSubscription$(T)); | 3227 dart.as(subscription, StreamSubscription$(T)); |
3228 if (this[_isAddingStream]) { | 3228 if (dart.notNull(this[_isAddingStream])) { |
3229 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); | 3229 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); |
3230 addState.pause(); | 3230 addState.pause(); |
3231 } | 3231 } |
3232 _runGuarded(this[_onPause]); | 3232 _runGuarded(this[_onPause]); |
3233 } | 3233 } |
3234 [_recordResume](subscription) { | 3234 [_recordResume](subscription) { |
3235 dart.as(subscription, StreamSubscription$(T)); | 3235 dart.as(subscription, StreamSubscription$(T)); |
3236 if (this[_isAddingStream]) { | 3236 if (dart.notNull(this[_isAddingStream])) { |
3237 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); | 3237 let addState = dart.as(this[_varData], _StreamControllerAddStreamState
); |
3238 addState.resume(); | 3238 addState.resume(); |
3239 } | 3239 } |
3240 _runGuarded(this[_onResume]); | 3240 _runGuarded(this[_onResume]); |
3241 } | 3241 } |
3242 } | 3242 } |
3243 _StreamController[dart.implements] = () => [StreamController$(T), _StreamCon
trollerLifecycle$(T), _EventSink$(T), _EventDispatch$(T)]; | 3243 _StreamController[dart.implements] = () => [StreamController$(T), _StreamCon
trollerLifecycle$(T), _EventSink$(T), _EventDispatch$(T)]; |
3244 dart.setSignature(_StreamController, { | 3244 dart.setSignature(_StreamController, { |
3245 constructors: () => ({_StreamController: [_StreamController$(T), []]}), | 3245 constructors: () => ({_StreamController: [_StreamController$(T), []]}), |
3246 methods: () => ({ | 3246 methods: () => ({ |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3419 addStream: [Future, [Stream$(T)], {cancelOnError: core.bool}] | 3419 addStream: [Future, [Stream$(T)], {cancelOnError: core.bool}] |
3420 }) | 3420 }) |
3421 }); | 3421 }); |
3422 return _StreamSinkWrapper; | 3422 return _StreamSinkWrapper; |
3423 }); | 3423 }); |
3424 let _StreamSinkWrapper = _StreamSinkWrapper$(); | 3424 let _StreamSinkWrapper = _StreamSinkWrapper$(); |
3425 let _AddStreamState$ = dart.generic(function(T) { | 3425 let _AddStreamState$ = dart.generic(function(T) { |
3426 class _AddStreamState extends core.Object { | 3426 class _AddStreamState extends core.Object { |
3427 _AddStreamState(controller, source, cancelOnError) { | 3427 _AddStreamState(controller, source, cancelOnError) { |
3428 this.addStreamFuture = new _Future(); | 3428 this.addStreamFuture = new _Future(); |
3429 this.addSubscription = source.listen(dart.bind(controller, _add), {onErr
or: cancelOnError ? dart.as(_AddStreamState$().makeErrorHandler(controller), cor
e.Function) : dart.bind(controller, _addError), onDone: dart.bind(controller, _c
lose), cancelOnError: cancelOnError}); | 3429 this.addSubscription = source.listen(dart.bind(controller, _add), {onErr
or: dart.notNull(cancelOnError) ? dart.as(_AddStreamState$().makeErrorHandler(co
ntroller), core.Function) : dart.bind(controller, _addError), onDone: dart.bind(
controller, _close), cancelOnError: cancelOnError}); |
3430 } | 3430 } |
3431 static makeErrorHandler(controller) { | 3431 static makeErrorHandler(controller) { |
3432 return dart.fn((e, s) => { | 3432 return dart.fn((e, s) => { |
3433 controller[_addError](e, s); | 3433 controller[_addError](e, s); |
3434 controller[_close](); | 3434 controller[_close](); |
3435 }, core.Object, [core.Object, core.StackTrace]); | 3435 }, core.Object, [core.Object, core.StackTrace]); |
3436 } | 3436 } |
3437 pause() { | 3437 pause() { |
3438 this.addSubscription.pause(); | 3438 this.addSubscription.pause(); |
3439 } | 3439 } |
(...skipping 26 matching lines...) Expand all Loading... |
3466 names: ['makeErrorHandler'] | 3466 names: ['makeErrorHandler'] |
3467 }); | 3467 }); |
3468 return _AddStreamState; | 3468 return _AddStreamState; |
3469 }); | 3469 }); |
3470 let _AddStreamState = _AddStreamState$(); | 3470 let _AddStreamState = _AddStreamState$(); |
3471 let _StreamControllerAddStreamState$ = dart.generic(function(T) { | 3471 let _StreamControllerAddStreamState$ = dart.generic(function(T) { |
3472 class _StreamControllerAddStreamState extends _AddStreamState$(T) { | 3472 class _StreamControllerAddStreamState extends _AddStreamState$(T) { |
3473 _StreamControllerAddStreamState(controller, varData, source, cancelOnError
) { | 3473 _StreamControllerAddStreamState(controller, varData, source, cancelOnError
) { |
3474 this.varData = varData; | 3474 this.varData = varData; |
3475 super._AddStreamState(dart.as(controller, _EventSink$(T)), source, cance
lOnError); | 3475 super._AddStreamState(dart.as(controller, _EventSink$(T)), source, cance
lOnError); |
3476 if (controller.isPaused) { | 3476 if (dart.notNull(controller.isPaused)) { |
3477 this.addSubscription.pause(); | 3477 this.addSubscription.pause(); |
3478 } | 3478 } |
3479 } | 3479 } |
3480 } | 3480 } |
3481 dart.setSignature(_StreamControllerAddStreamState, { | 3481 dart.setSignature(_StreamControllerAddStreamState, { |
3482 constructors: () => ({_StreamControllerAddStreamState: [_StreamControllerA
ddStreamState$(T), [_StreamController, core.Object, Stream, core.bool]]}) | 3482 constructors: () => ({_StreamControllerAddStreamState: [_StreamControllerA
ddStreamState$(T), [_StreamController, core.Object, Stream, core.bool]]}) |
3483 }); | 3483 }); |
3484 return _StreamControllerAddStreamState; | 3484 return _StreamControllerAddStreamState; |
3485 }); | 3485 }); |
3486 let _StreamControllerAddStreamState = _StreamControllerAddStreamState$(); | 3486 let _StreamControllerAddStreamState = _StreamControllerAddStreamState$(); |
(...skipping 20 matching lines...) Expand all Loading... |
3507 let _isUsed = Symbol('_isUsed'); | 3507 let _isUsed = Symbol('_isUsed'); |
3508 let _GeneratedStreamImpl$ = dart.generic(function(T) { | 3508 let _GeneratedStreamImpl$ = dart.generic(function(T) { |
3509 class _GeneratedStreamImpl extends _StreamImpl$(T) { | 3509 class _GeneratedStreamImpl extends _StreamImpl$(T) { |
3510 _GeneratedStreamImpl(pending) { | 3510 _GeneratedStreamImpl(pending) { |
3511 this[_pending] = pending; | 3511 this[_pending] = pending; |
3512 this[_isUsed] = false; | 3512 this[_isUsed] = false; |
3513 } | 3513 } |
3514 [_createSubscription](onData, onError, onDone, cancelOnError) { | 3514 [_createSubscription](onData, onError, onDone, cancelOnError) { |
3515 dart.as(onData, dart.functionType(dart.void, [T])); | 3515 dart.as(onData, dart.functionType(dart.void, [T])); |
3516 dart.as(onDone, dart.functionType(dart.void, [])); | 3516 dart.as(onDone, dart.functionType(dart.void, [])); |
3517 if (this[_isUsed]) | 3517 if (dart.notNull(this[_isUsed])) |
3518 throw new core.StateError("Stream has already been listened to."); | 3518 throw new core.StateError("Stream has already been listened to."); |
3519 this[_isUsed] = true; | 3519 this[_isUsed] = true; |
3520 return dart.as((() => { | 3520 return dart.as((() => { |
3521 let _ = new _BufferingStreamSubscription(onData, onError, onDone, canc
elOnError); | 3521 let _ = new _BufferingStreamSubscription(onData, onError, onDone, canc
elOnError); |
3522 _[_setPendingEvents](this[_pending]()); | 3522 _[_setPendingEvents](this[_pending]()); |
3523 return _; | 3523 return _; |
3524 })(), StreamSubscription$(T)); | 3524 })(), StreamSubscription$(T)); |
3525 } | 3525 } |
3526 } | 3526 } |
3527 dart.setSignature(_GeneratedStreamImpl, { | 3527 dart.setSignature(_GeneratedStreamImpl, { |
3528 constructors: () => ({_GeneratedStreamImpl: [_GeneratedStreamImpl$(T), [_E
ventGenerator]]}), | 3528 constructors: () => ({_GeneratedStreamImpl: [_GeneratedStreamImpl$(T), [_E
ventGenerator]]}), |
3529 methods: () => ({[_createSubscription]: [StreamSubscription$(T), [dart.fun
ctionType(dart.void, [T]), core.Function, dart.functionType(dart.void, []), core
.bool]]}) | 3529 methods: () => ({[_createSubscription]: [StreamSubscription$(T), [dart.fun
ctionType(dart.void, [T]), core.Function, dart.functionType(dart.void, []), core
.bool]]}) |
3530 }); | 3530 }); |
3531 return _GeneratedStreamImpl; | 3531 return _GeneratedStreamImpl; |
3532 }); | 3532 }); |
3533 let _GeneratedStreamImpl = _GeneratedStreamImpl$(); | 3533 let _GeneratedStreamImpl = _GeneratedStreamImpl$(); |
3534 let _eventScheduled = Symbol('_eventScheduled'); | 3534 let _eventScheduled = Symbol('_eventScheduled'); |
3535 class _PendingEvents extends core.Object { | 3535 class _PendingEvents extends core.Object { |
3536 _PendingEvents() { | 3536 _PendingEvents() { |
3537 this[_state] = _PendingEvents._STATE_UNSCHEDULED; | 3537 this[_state] = _PendingEvents._STATE_UNSCHEDULED; |
3538 } | 3538 } |
3539 get isScheduled() { | 3539 get isScheduled() { |
3540 return this[_state] == _PendingEvents._STATE_SCHEDULED; | 3540 return this[_state] == _PendingEvents._STATE_SCHEDULED; |
3541 } | 3541 } |
3542 get [_eventScheduled]() { | 3542 get [_eventScheduled]() { |
3543 return dart.notNull(this[_state]) >= dart.notNull(_PendingEvents._STATE_SC
HEDULED); | 3543 return dart.notNull(this[_state]) >= dart.notNull(_PendingEvents._STATE_SC
HEDULED); |
3544 } | 3544 } |
3545 schedule(dispatch) { | 3545 schedule(dispatch) { |
3546 if (this.isScheduled) | 3546 if (dart.notNull(this.isScheduled)) |
3547 return; | 3547 return; |
3548 dart.assert(!dart.notNull(this.isEmpty)); | 3548 dart.assert(!dart.notNull(this.isEmpty)); |
3549 if (this[_eventScheduled]) { | 3549 if (dart.notNull(this[_eventScheduled])) { |
3550 dart.assert(this[_state] == _PendingEvents._STATE_CANCELED); | 3550 dart.assert(this[_state] == _PendingEvents._STATE_CANCELED); |
3551 this[_state] = _PendingEvents._STATE_SCHEDULED; | 3551 this[_state] = _PendingEvents._STATE_SCHEDULED; |
3552 return; | 3552 return; |
3553 } | 3553 } |
3554 scheduleMicrotask(dart.fn(() => { | 3554 scheduleMicrotask(dart.fn(() => { |
3555 let oldState = this[_state]; | 3555 let oldState = this[_state]; |
3556 this[_state] = _PendingEvents._STATE_UNSCHEDULED; | 3556 this[_state] = _PendingEvents._STATE_UNSCHEDULED; |
3557 if (oldState == _PendingEvents._STATE_CANCELED) | 3557 if (oldState == _PendingEvents._STATE_CANCELED) |
3558 return; | 3558 return; |
3559 this.handleNext(dispatch); | 3559 this.handleNext(dispatch); |
3560 })); | 3560 })); |
3561 this[_state] = _PendingEvents._STATE_SCHEDULED; | 3561 this[_state] = _PendingEvents._STATE_SCHEDULED; |
3562 } | 3562 } |
3563 cancelSchedule() { | 3563 cancelSchedule() { |
3564 if (this.isScheduled) | 3564 if (dart.notNull(this.isScheduled)) |
3565 this[_state] = _PendingEvents._STATE_CANCELED; | 3565 this[_state] = _PendingEvents._STATE_CANCELED; |
3566 } | 3566 } |
3567 } | 3567 } |
3568 dart.setSignature(_PendingEvents, { | 3568 dart.setSignature(_PendingEvents, { |
3569 methods: () => ({ | 3569 methods: () => ({ |
3570 schedule: [dart.void, [_EventDispatch]], | 3570 schedule: [dart.void, [_EventDispatch]], |
3571 cancelSchedule: [dart.void, []] | 3571 cancelSchedule: [dart.void, []] |
3572 }) | 3572 }) |
3573 }); | 3573 }); |
3574 let _iterator = Symbol('_iterator'); | 3574 let _iterator = Symbol('_iterator'); |
(...skipping 21 matching lines...) Expand all Loading... |
3596 } | 3596 } |
3597 | 3597 |
3598 if (!dart.notNull(isDone)) { | 3598 if (!dart.notNull(isDone)) { |
3599 dispatch[_sendData](this[_iterator].current); | 3599 dispatch[_sendData](this[_iterator].current); |
3600 } else { | 3600 } else { |
3601 this[_iterator] = null; | 3601 this[_iterator] = null; |
3602 dispatch[_sendDone](); | 3602 dispatch[_sendDone](); |
3603 } | 3603 } |
3604 } | 3604 } |
3605 clear() { | 3605 clear() { |
3606 if (this.isScheduled) | 3606 if (dart.notNull(this.isScheduled)) |
3607 this.cancelSchedule(); | 3607 this.cancelSchedule(); |
3608 this[_iterator] = null; | 3608 this[_iterator] = null; |
3609 } | 3609 } |
3610 } | 3610 } |
3611 dart.setSignature(_IterablePendingEvents, { | 3611 dart.setSignature(_IterablePendingEvents, { |
3612 constructors: () => ({_IterablePendingEvents: [_IterablePendingEvents$(T),
[core.Iterable$(T)]]}), | 3612 constructors: () => ({_IterablePendingEvents: [_IterablePendingEvents$(T),
[core.Iterable$(T)]]}), |
3613 methods: () => ({ | 3613 methods: () => ({ |
3614 handleNext: [dart.void, [_EventDispatch]], | 3614 handleNext: [dart.void, [_EventDispatch]], |
3615 clear: [dart.void, []] | 3615 clear: [dart.void, []] |
3616 }) | 3616 }) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3717 handleNext(dispatch) { | 3717 handleNext(dispatch) { |
3718 dart.assert(!dart.notNull(this.isScheduled)); | 3718 dart.assert(!dart.notNull(this.isScheduled)); |
3719 let event = this.firstPendingEvent; | 3719 let event = this.firstPendingEvent; |
3720 this.firstPendingEvent = event.next; | 3720 this.firstPendingEvent = event.next; |
3721 if (this.firstPendingEvent == null) { | 3721 if (this.firstPendingEvent == null) { |
3722 this.lastPendingEvent = null; | 3722 this.lastPendingEvent = null; |
3723 } | 3723 } |
3724 event.perform(dispatch); | 3724 event.perform(dispatch); |
3725 } | 3725 } |
3726 clear() { | 3726 clear() { |
3727 if (this.isScheduled) | 3727 if (dart.notNull(this.isScheduled)) |
3728 this.cancelSchedule(); | 3728 this.cancelSchedule(); |
3729 this.firstPendingEvent = this.lastPendingEvent = null; | 3729 this.firstPendingEvent = this.lastPendingEvent = null; |
3730 } | 3730 } |
3731 } | 3731 } |
3732 dart.setSignature(_StreamImplEvents, { | 3732 dart.setSignature(_StreamImplEvents, { |
3733 methods: () => ({ | 3733 methods: () => ({ |
3734 add: [dart.void, [_DelayedEvent]], | 3734 add: [dart.void, [_DelayedEvent]], |
3735 handleNext: [dart.void, [_EventDispatch]], | 3735 handleNext: [dart.void, [_EventDispatch]], |
3736 clear: [dart.void, []] | 3736 clear: [dart.void, []] |
3737 }) | 3737 }) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3777 get [_isSent]() { | 3777 get [_isSent]() { |
3778 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio
n$()._DONE_SENT)) != 0; | 3778 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio
n$()._DONE_SENT)) != 0; |
3779 } | 3779 } |
3780 get [_isScheduled]() { | 3780 get [_isScheduled]() { |
3781 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio
n$()._SCHEDULED)) != 0; | 3781 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio
n$()._SCHEDULED)) != 0; |
3782 } | 3782 } |
3783 get isPaused() { | 3783 get isPaused() { |
3784 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio
n$()._PAUSED); | 3784 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio
n$()._PAUSED); |
3785 } | 3785 } |
3786 [_schedule]() { | 3786 [_schedule]() { |
3787 if (this[_isScheduled]) | 3787 if (dart.notNull(this[_isScheduled])) |
3788 return; | 3788 return; |
3789 this[_zone].scheduleMicrotask(dart.bind(this, _sendDone)); | 3789 this[_zone].scheduleMicrotask(dart.bind(this, _sendDone)); |
3790 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs
cription$()._SCHEDULED); | 3790 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs
cription$()._SCHEDULED); |
3791 } | 3791 } |
3792 onData(handleData) { | 3792 onData(handleData) { |
3793 dart.as(handleData, dart.functionType(dart.void, [T])); | 3793 dart.as(handleData, dart.functionType(dart.void, [T])); |
3794 } | 3794 } |
3795 onError(handleError) {} | 3795 onError(handleError) {} |
3796 onDone(handleDone) { | 3796 onDone(handleDone) { |
3797 dart.as(handleDone, dart.functionType(dart.void, [])); | 3797 dart.as(handleDone, dart.functionType(dart.void, [])); |
3798 this[_onDone] = handleDone; | 3798 this[_onDone] = handleDone; |
3799 } | 3799 } |
3800 pause(resumeSignal) { | 3800 pause(resumeSignal) { |
3801 if (resumeSignal === void 0) | 3801 if (resumeSignal === void 0) |
3802 resumeSignal = null; | 3802 resumeSignal = null; |
3803 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs
cription$()._PAUSED); | 3803 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs
cription$()._PAUSED); |
3804 if (resumeSignal != null) | 3804 if (resumeSignal != null) |
3805 resumeSignal.whenComplete(dart.bind(this, 'resume')); | 3805 resumeSignal.whenComplete(dart.bind(this, 'resume')); |
3806 } | 3806 } |
3807 resume() { | 3807 resume() { |
3808 if (this.isPaused) { | 3808 if (dart.notNull(this.isPaused)) { |
3809 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu
bscription$()._PAUSED); | 3809 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu
bscription$()._PAUSED); |
3810 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { | 3810 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { |
3811 this[_schedule](); | 3811 this[_schedule](); |
3812 } | 3812 } |
3813 } | 3813 } |
3814 } | 3814 } |
3815 cancel() { | 3815 cancel() { |
3816 return null; | 3816 return null; |
3817 } | 3817 } |
3818 asFuture(futureValue) { | 3818 asFuture(futureValue) { |
3819 if (futureValue === void 0) | 3819 if (futureValue === void 0) |
3820 futureValue = null; | 3820 futureValue = null; |
3821 let result = new _Future(); | 3821 let result = new _Future(); |
3822 this[_onDone] = dart.fn(() => { | 3822 this[_onDone] = dart.fn(() => { |
3823 result[_completeWithValue](null); | 3823 result[_completeWithValue](null); |
3824 }); | 3824 }); |
3825 return result; | 3825 return result; |
3826 } | 3826 } |
3827 [_sendDone]() { | 3827 [_sendDone]() { |
3828 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_DoneStreamSub
scription$()._SCHEDULED); | 3828 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_DoneStreamSub
scription$()._SCHEDULED); |
3829 if (this.isPaused) | 3829 if (dart.notNull(this.isPaused)) |
3830 return; | 3830 return; |
3831 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs
cription$()._DONE_SENT); | 3831 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs
cription$()._DONE_SENT); |
3832 if (this[_onDone] != null) | 3832 if (this[_onDone] != null) |
3833 this[_zone].runGuarded(this[_onDone]); | 3833 this[_zone].runGuarded(this[_onDone]); |
3834 } | 3834 } |
3835 } | 3835 } |
3836 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)]; | 3836 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)]; |
3837 dart.setSignature(_DoneStreamSubscription, { | 3837 dart.setSignature(_DoneStreamSubscription, { |
3838 constructors: () => ({_DoneStreamSubscription: [_DoneStreamSubscription$(T
), [_DoneHandler]]}), | 3838 constructors: () => ({_DoneStreamSubscription: [_DoneStreamSubscription$(T
), [_DoneHandler]]}), |
3839 methods: () => ({ | 3839 methods: () => ({ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3875 } | 3875 } |
3876 get isBroadcast() { | 3876 get isBroadcast() { |
3877 return true; | 3877 return true; |
3878 } | 3878 } |
3879 listen(onData, opts) { | 3879 listen(onData, opts) { |
3880 dart.as(onData, dart.functionType(dart.void, [T])); | 3880 dart.as(onData, dart.functionType(dart.void, [T])); |
3881 let onError = opts && 'onError' in opts ? opts.onError : null; | 3881 let onError = opts && 'onError' in opts ? opts.onError : null; |
3882 let onDone = opts && 'onDone' in opts ? opts.onDone : null; | 3882 let onDone = opts && 'onDone' in opts ? opts.onDone : null; |
3883 dart.as(onDone, dart.functionType(dart.void, [])); | 3883 dart.as(onDone, dart.functionType(dart.void, [])); |
3884 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; | 3884 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; |
3885 if (dart.notNull(this[_controller] == null) || dart.notNull(this[_contro
ller].isClosed)) { | 3885 if (this[_controller] == null || dart.notNull(this[_controller].isClosed
)) { |
3886 return new (_DoneStreamSubscription$(T))(onDone); | 3886 return new (_DoneStreamSubscription$(T))(onDone); |
3887 } | 3887 } |
3888 if (this[_subscription] == null) { | 3888 if (this[_subscription] == null) { |
3889 this[_subscription] = this[_source].listen(dart.bind(this[_controller]
, 'add'), {onError: dart.bind(this[_controller], 'addError'), onDone: dart.bind(
this[_controller], 'close')}); | 3889 this[_subscription] = this[_source].listen(dart.bind(this[_controller]
, 'add'), {onError: dart.bind(this[_controller], 'addError'), onDone: dart.bind(
this[_controller], 'close')}); |
3890 } | 3890 } |
3891 cancelOnError = core.identical(true, cancelOnError); | 3891 cancelOnError = core.identical(true, cancelOnError); |
3892 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr
ror); | 3892 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr
ror); |
3893 } | 3893 } |
3894 [_onCancel]() { | 3894 [_onCancel]() { |
3895 let shutdown = dart.notNull(this[_controller] == null) || dart.notNull(t
his[_controller].isClosed); | 3895 let shutdown = this[_controller] == null || dart.notNull(this[_controlle
r].isClosed); |
3896 if (this[_onCancelHandler] != null) { | 3896 if (this[_onCancelHandler] != null) { |
3897 this[_zone].runUnary(this[_onCancelHandler], new _BroadcastSubscriptio
nWrapper(this)); | 3897 this[_zone].runUnary(this[_onCancelHandler], new _BroadcastSubscriptio
nWrapper(this)); |
3898 } | 3898 } |
3899 if (shutdown) { | 3899 if (dart.notNull(shutdown)) { |
3900 if (this[_subscription] != null) { | 3900 if (this[_subscription] != null) { |
3901 this[_subscription].cancel(); | 3901 this[_subscription].cancel(); |
3902 this[_subscription] = null; | 3902 this[_subscription] = null; |
3903 } | 3903 } |
3904 } | 3904 } |
3905 } | 3905 } |
3906 [_onListen]() { | 3906 [_onListen]() { |
3907 if (this[_onListenHandler] != null) { | 3907 if (this[_onListenHandler] != null) { |
3908 this[_zone].runUnary(this[_onListenHandler], new _BroadcastSubscriptio
nWrapper(this)); | 3908 this[_zone].runUnary(this[_onListenHandler], new _BroadcastSubscriptio
nWrapper(this)); |
3909 } | 3909 } |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) { | 4242 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) { |
4243 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T)
{ | 4243 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T)
{ |
4244 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr
or) { | 4244 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr
or) { |
4245 this[_stream] = stream; | 4245 this[_stream] = stream; |
4246 this[_subscription] = null; | 4246 this[_subscription] = null; |
4247 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); | 4247 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); |
4248 this[_subscription] = this[_stream][_source].listen(dart.bind(this, _han
dleData), {onError: dart.bind(this, _handleError), onDone: dart.bind(this, _hand
leDone)}); | 4248 this[_subscription] = this[_stream][_source].listen(dart.bind(this, _han
dleData), {onError: dart.bind(this, _handleError), onDone: dart.bind(this, _hand
leDone)}); |
4249 } | 4249 } |
4250 [_add](data) { | 4250 [_add](data) { |
4251 dart.as(data, T); | 4251 dart.as(data, T); |
4252 if (this[_isClosed]) | 4252 if (dart.notNull(this[_isClosed])) |
4253 return; | 4253 return; |
4254 super[_add](data); | 4254 super[_add](data); |
4255 } | 4255 } |
4256 [_addError](error, stackTrace) { | 4256 [_addError](error, stackTrace) { |
4257 if (this[_isClosed]) | 4257 if (dart.notNull(this[_isClosed])) |
4258 return; | 4258 return; |
4259 super[_addError](error, stackTrace); | 4259 super[_addError](error, stackTrace); |
4260 } | 4260 } |
4261 [_onPause]() { | 4261 [_onPause]() { |
4262 if (this[_subscription] == null) | 4262 if (this[_subscription] == null) |
4263 return; | 4263 return; |
4264 this[_subscription].pause(); | 4264 this[_subscription].pause(); |
4265 } | 4265 } |
4266 [_onResume]() { | 4266 [_onResume]() { |
4267 if (this[_subscription] == null) | 4267 if (this[_subscription] == null) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 dart.as(sink, _EventSink$(T)); | 4325 dart.as(sink, _EventSink$(T)); |
4326 let satisfies = null; | 4326 let satisfies = null; |
4327 try { | 4327 try { |
4328 satisfies = this[_test](inputEvent); | 4328 satisfies = this[_test](inputEvent); |
4329 } catch (e) { | 4329 } catch (e) { |
4330 let s = dart.stackTrace(e); | 4330 let s = dart.stackTrace(e); |
4331 _addErrorWithReplacement(sink, e, s); | 4331 _addErrorWithReplacement(sink, e, s); |
4332 return; | 4332 return; |
4333 } | 4333 } |
4334 | 4334 |
4335 if (satisfies) { | 4335 if (dart.notNull(satisfies)) { |
4336 sink[_add](inputEvent); | 4336 sink[_add](inputEvent); |
4337 } | 4337 } |
4338 } | 4338 } |
4339 } | 4339 } |
4340 dart.setSignature(_WhereStream, { | 4340 dart.setSignature(_WhereStream, { |
4341 constructors: () => ({_WhereStream: [_WhereStream$(T), [Stream$(T), dart.f
unctionType(core.bool, [T])]]}), | 4341 constructors: () => ({_WhereStream: [_WhereStream$(T), [Stream$(T), dart.f
unctionType(core.bool, [T])]]}), |
4342 methods: () => ({[_handleData]: [dart.void, [T, _EventSink$(T)]]}) | 4342 methods: () => ({[_handleData]: [dart.void, [T, _EventSink$(T)]]}) |
4343 }); | 4343 }); |
4344 return _WhereStream; | 4344 return _WhereStream; |
4345 }); | 4345 }); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4420 if (this[_test] != null) { | 4420 if (this[_test] != null) { |
4421 try { | 4421 try { |
4422 matches = dart.dcall(this[_test], error); | 4422 matches = dart.dcall(this[_test], error); |
4423 } catch (e) { | 4423 } catch (e) { |
4424 let s = dart.stackTrace(e); | 4424 let s = dart.stackTrace(e); |
4425 _addErrorWithReplacement(sink, e, s); | 4425 _addErrorWithReplacement(sink, e, s); |
4426 return; | 4426 return; |
4427 } | 4427 } |
4428 | 4428 |
4429 } | 4429 } |
4430 if (matches) { | 4430 if (dart.notNull(matches)) { |
4431 try { | 4431 try { |
4432 _invokeErrorHandler(this[_transform], error, stackTrace); | 4432 _invokeErrorHandler(this[_transform], error, stackTrace); |
4433 } catch (e) { | 4433 } catch (e) { |
4434 let s = dart.stackTrace(e); | 4434 let s = dart.stackTrace(e); |
4435 if (core.identical(e, error)) { | 4435 if (dart.notNull(core.identical(e, error))) { |
4436 sink[_addError](error, stackTrace); | 4436 sink[_addError](error, stackTrace); |
4437 } else { | 4437 } else { |
4438 _addErrorWithReplacement(sink, e, s); | 4438 _addErrorWithReplacement(sink, e, s); |
4439 } | 4439 } |
4440 return; | 4440 return; |
4441 } | 4441 } |
4442 | 4442 |
4443 } else { | 4443 } else { |
4444 sink[_addError](error, stackTrace); | 4444 sink[_addError](error, stackTrace); |
4445 } | 4445 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4492 let satisfies = null; | 4492 let satisfies = null; |
4493 try { | 4493 try { |
4494 satisfies = this[_test](inputEvent); | 4494 satisfies = this[_test](inputEvent); |
4495 } catch (e) { | 4495 } catch (e) { |
4496 let s = dart.stackTrace(e); | 4496 let s = dart.stackTrace(e); |
4497 _addErrorWithReplacement(sink, e, s); | 4497 _addErrorWithReplacement(sink, e, s); |
4498 sink[_close](); | 4498 sink[_close](); |
4499 return; | 4499 return; |
4500 } | 4500 } |
4501 | 4501 |
4502 if (satisfies) { | 4502 if (dart.notNull(satisfies)) { |
4503 sink[_add](inputEvent); | 4503 sink[_add](inputEvent); |
4504 } else { | 4504 } else { |
4505 sink[_close](); | 4505 sink[_close](); |
4506 } | 4506 } |
4507 } | 4507 } |
4508 } | 4508 } |
4509 dart.setSignature(_TakeWhileStream, { | 4509 dart.setSignature(_TakeWhileStream, { |
4510 constructors: () => ({_TakeWhileStream: [_TakeWhileStream$(T), [Stream$(T)
, dart.functionType(core.bool, [T])]]}), | 4510 constructors: () => ({_TakeWhileStream: [_TakeWhileStream$(T), [Stream$(T)
, dart.functionType(core.bool, [T])]]}), |
4511 methods: () => ({[_handleData]: [dart.void, [T, _EventSink$(T)]]}) | 4511 methods: () => ({[_handleData]: [dart.void, [T, _EventSink$(T)]]}) |
4512 }); | 4512 }); |
(...skipping 29 matching lines...) Expand all Loading... |
4542 let _SkipWhileStream$ = dart.generic(function(T) { | 4542 let _SkipWhileStream$ = dart.generic(function(T) { |
4543 class _SkipWhileStream extends _ForwardingStream$(T, T) { | 4543 class _SkipWhileStream extends _ForwardingStream$(T, T) { |
4544 _SkipWhileStream(source, test) { | 4544 _SkipWhileStream(source, test) { |
4545 this[_test] = test; | 4545 this[_test] = test; |
4546 this[_hasFailed] = false; | 4546 this[_hasFailed] = false; |
4547 super._ForwardingStream(source); | 4547 super._ForwardingStream(source); |
4548 } | 4548 } |
4549 [_handleData](inputEvent, sink) { | 4549 [_handleData](inputEvent, sink) { |
4550 dart.as(inputEvent, T); | 4550 dart.as(inputEvent, T); |
4551 dart.as(sink, _EventSink$(T)); | 4551 dart.as(sink, _EventSink$(T)); |
4552 if (this[_hasFailed]) { | 4552 if (dart.notNull(this[_hasFailed])) { |
4553 sink[_add](inputEvent); | 4553 sink[_add](inputEvent); |
4554 return; | 4554 return; |
4555 } | 4555 } |
4556 let satisfies = null; | 4556 let satisfies = null; |
4557 try { | 4557 try { |
4558 satisfies = this[_test](inputEvent); | 4558 satisfies = this[_test](inputEvent); |
4559 } catch (e) { | 4559 } catch (e) { |
4560 let s = dart.stackTrace(e); | 4560 let s = dart.stackTrace(e); |
4561 _addErrorWithReplacement(sink, e, s); | 4561 _addErrorWithReplacement(sink, e, s); |
4562 this[_hasFailed] = true; | 4562 this[_hasFailed] = true; |
(...skipping 22 matching lines...) Expand all Loading... |
4585 let _DistinctStream$ = dart.generic(function(T) { | 4585 let _DistinctStream$ = dart.generic(function(T) { |
4586 class _DistinctStream extends _ForwardingStream$(T, T) { | 4586 class _DistinctStream extends _ForwardingStream$(T, T) { |
4587 _DistinctStream(source, equals) { | 4587 _DistinctStream(source, equals) { |
4588 this[_previous] = _DistinctStream$()._SENTINEL; | 4588 this[_previous] = _DistinctStream$()._SENTINEL; |
4589 this[_equals] = equals; | 4589 this[_equals] = equals; |
4590 super._ForwardingStream(source); | 4590 super._ForwardingStream(source); |
4591 } | 4591 } |
4592 [_handleData](inputEvent, sink) { | 4592 [_handleData](inputEvent, sink) { |
4593 dart.as(inputEvent, T); | 4593 dart.as(inputEvent, T); |
4594 dart.as(sink, _EventSink$(T)); | 4594 dart.as(sink, _EventSink$(T)); |
4595 if (core.identical(this[_previous], _DistinctStream$()._SENTINEL)) { | 4595 if (dart.notNull(core.identical(this[_previous], _DistinctStream$()._SEN
TINEL))) { |
4596 this[_previous] = inputEvent; | 4596 this[_previous] = inputEvent; |
4597 return sink[_add](inputEvent); | 4597 return sink[_add](inputEvent); |
4598 } else { | 4598 } else { |
4599 let isEqual = null; | 4599 let isEqual = null; |
4600 try { | 4600 try { |
4601 if (this[_equals] == null) { | 4601 if (this[_equals] == null) { |
4602 isEqual = dart.equals(this[_previous], inputEvent); | 4602 isEqual = dart.equals(this[_previous], inputEvent); |
4603 } else { | 4603 } else { |
4604 isEqual = this[_equals](dart.as(this[_previous], T), inputEvent); | 4604 isEqual = this[_equals](dart.as(this[_previous], T), inputEvent); |
4605 } | 4605 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4669 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); | 4669 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); |
4670 let eventSink = new (_EventSinkWrapper$(T))(this); | 4670 let eventSink = new (_EventSinkWrapper$(T))(this); |
4671 this[_transformerSink] = mapper(eventSink); | 4671 this[_transformerSink] = mapper(eventSink); |
4672 this[_subscription] = source.listen(dart.bind(this, _handleData), {onErr
or: dart.bind(this, _handleError), onDone: dart.bind(this, _handleDone)}); | 4672 this[_subscription] = source.listen(dart.bind(this, _handleData), {onErr
or: dart.bind(this, _handleError), onDone: dart.bind(this, _handleDone)}); |
4673 } | 4673 } |
4674 get [_isSubscribed]() { | 4674 get [_isSubscribed]() { |
4675 return this[_subscription] != null; | 4675 return this[_subscription] != null; |
4676 } | 4676 } |
4677 [_add](data) { | 4677 [_add](data) { |
4678 dart.as(data, T); | 4678 dart.as(data, T); |
4679 if (this[_isClosed]) { | 4679 if (dart.notNull(this[_isClosed])) { |
4680 throw new core.StateError("Stream is already closed"); | 4680 throw new core.StateError("Stream is already closed"); |
4681 } | 4681 } |
4682 super[_add](data); | 4682 super[_add](data); |
4683 } | 4683 } |
4684 [_addError](error, stackTrace) { | 4684 [_addError](error, stackTrace) { |
4685 if (this[_isClosed]) { | 4685 if (dart.notNull(this[_isClosed])) { |
4686 throw new core.StateError("Stream is already closed"); | 4686 throw new core.StateError("Stream is already closed"); |
4687 } | 4687 } |
4688 super[_addError](error, stackTrace); | 4688 super[_addError](error, stackTrace); |
4689 } | 4689 } |
4690 [_close]() { | 4690 [_close]() { |
4691 if (this[_isClosed]) { | 4691 if (dart.notNull(this[_isClosed])) { |
4692 throw new core.StateError("Stream is already closed"); | 4692 throw new core.StateError("Stream is already closed"); |
4693 } | 4693 } |
4694 super[_close](); | 4694 super[_close](); |
4695 } | 4695 } |
4696 [_onPause]() { | 4696 [_onPause]() { |
4697 if (this[_isSubscribed]) | 4697 if (dart.notNull(this[_isSubscribed])) |
4698 this[_subscription].pause(); | 4698 this[_subscription].pause(); |
4699 } | 4699 } |
4700 [_onResume]() { | 4700 [_onResume]() { |
4701 if (this[_isSubscribed]) | 4701 if (dart.notNull(this[_isSubscribed])) |
4702 this[_subscription].resume(); | 4702 this[_subscription].resume(); |
4703 } | 4703 } |
4704 [_onCancel]() { | 4704 [_onCancel]() { |
4705 if (this[_isSubscribed]) { | 4705 if (dart.notNull(this[_isSubscribed])) { |
4706 let subscription = this[_subscription]; | 4706 let subscription = this[_subscription]; |
4707 this[_subscription] = null; | 4707 this[_subscription] = null; |
4708 subscription.cancel(); | 4708 subscription.cancel(); |
4709 } | 4709 } |
4710 return null; | 4710 return null; |
4711 } | 4711 } |
4712 [_handleData](data) { | 4712 [_handleData](data) { |
4713 dart.as(data, S); | 4713 dart.as(data, S); |
4714 try { | 4714 try { |
4715 this[_transformerSink].add(data); | 4715 this[_transformerSink].add(data); |
4716 } catch (e) { | 4716 } catch (e) { |
4717 let s = dart.stackTrace(e); | 4717 let s = dart.stackTrace(e); |
4718 this[_addError](e, s); | 4718 this[_addError](e, s); |
4719 } | 4719 } |
4720 | 4720 |
4721 } | 4721 } |
4722 [_handleError](error, stackTrace) { | 4722 [_handleError](error, stackTrace) { |
4723 if (stackTrace === void 0) | 4723 if (stackTrace === void 0) |
4724 stackTrace = null; | 4724 stackTrace = null; |
4725 try { | 4725 try { |
4726 this[_transformerSink].addError(error, dart.as(stackTrace, core.StackT
race)); | 4726 this[_transformerSink].addError(error, dart.as(stackTrace, core.StackT
race)); |
4727 } catch (e) { | 4727 } catch (e) { |
4728 let s = dart.stackTrace(e); | 4728 let s = dart.stackTrace(e); |
4729 if (core.identical(e, error)) { | 4729 if (dart.notNull(core.identical(e, error))) { |
4730 this[_addError](error, dart.as(stackTrace, core.StackTrace)); | 4730 this[_addError](error, dart.as(stackTrace, core.StackTrace)); |
4731 } else { | 4731 } else { |
4732 this[_addError](e, s); | 4732 this[_addError](e, s); |
4733 } | 4733 } |
4734 } | 4734 } |
4735 | 4735 |
4736 } | 4736 } |
4737 [_handleDone]() { | 4737 [_handleDone]() { |
4738 try { | 4738 try { |
4739 this[_subscription] = null; | 4739 this[_subscription] = null; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5198 get [_delegate]() { | 5198 get [_delegate]() { |
5199 if (_RootZone._rootDelegate != null) | 5199 if (_RootZone._rootDelegate != null) |
5200 return _RootZone._rootDelegate; | 5200 return _RootZone._rootDelegate; |
5201 return _RootZone._rootDelegate = new _ZoneDelegate(this); | 5201 return _RootZone._rootDelegate = new _ZoneDelegate(this); |
5202 } | 5202 } |
5203 get errorZone() { | 5203 get errorZone() { |
5204 return this; | 5204 return this; |
5205 } | 5205 } |
5206 runGuarded(f) { | 5206 runGuarded(f) { |
5207 try { | 5207 try { |
5208 if (core.identical(_ROOT_ZONE, Zone._current)) { | 5208 if (dart.notNull(core.identical(_ROOT_ZONE, Zone._current))) { |
5209 return f(); | 5209 return f(); |
5210 } | 5210 } |
5211 return _rootRun(null, null, this, f); | 5211 return _rootRun(null, null, this, f); |
5212 } catch (e) { | 5212 } catch (e) { |
5213 let s = dart.stackTrace(e); | 5213 let s = dart.stackTrace(e); |
5214 return this.handleUncaughtError(e, s); | 5214 return this.handleUncaughtError(e, s); |
5215 } | 5215 } |
5216 | 5216 |
5217 } | 5217 } |
5218 runUnaryGuarded(f, arg) { | 5218 runUnaryGuarded(f, arg) { |
5219 try { | 5219 try { |
5220 if (core.identical(_ROOT_ZONE, Zone._current)) { | 5220 if (dart.notNull(core.identical(_ROOT_ZONE, Zone._current))) { |
5221 return dart.dcall(f, arg); | 5221 return dart.dcall(f, arg); |
5222 } | 5222 } |
5223 return _rootRunUnary(null, null, this, f, arg); | 5223 return _rootRunUnary(null, null, this, f, arg); |
5224 } catch (e) { | 5224 } catch (e) { |
5225 let s = dart.stackTrace(e); | 5225 let s = dart.stackTrace(e); |
5226 return this.handleUncaughtError(e, s); | 5226 return this.handleUncaughtError(e, s); |
5227 } | 5227 } |
5228 | 5228 |
5229 } | 5229 } |
5230 runBinaryGuarded(f, arg1, arg2) { | 5230 runBinaryGuarded(f, arg1, arg2) { |
5231 try { | 5231 try { |
5232 if (core.identical(_ROOT_ZONE, Zone._current)) { | 5232 if (dart.notNull(core.identical(_ROOT_ZONE, Zone._current))) { |
5233 return dart.dcall(f, arg1, arg2); | 5233 return dart.dcall(f, arg1, arg2); |
5234 } | 5234 } |
5235 return _rootRunBinary(null, null, this, f, arg1, arg2); | 5235 return _rootRunBinary(null, null, this, f, arg1, arg2); |
5236 } catch (e) { | 5236 } catch (e) { |
5237 let s = dart.stackTrace(e); | 5237 let s = dart.stackTrace(e); |
5238 return this.handleUncaughtError(e, s); | 5238 return this.handleUncaughtError(e, s); |
5239 } | 5239 } |
5240 | 5240 |
5241 } | 5241 } |
5242 bindCallback(f, opts) { | 5242 bindCallback(f, opts) { |
5243 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; | 5243 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; |
5244 if (runGuarded) { | 5244 if (dart.notNull(runGuarded)) { |
5245 return dart.fn(() => this.runGuarded(f)); | 5245 return dart.fn(() => this.runGuarded(f)); |
5246 } else { | 5246 } else { |
5247 return dart.fn(() => this.run(f)); | 5247 return dart.fn(() => this.run(f)); |
5248 } | 5248 } |
5249 } | 5249 } |
5250 bindUnaryCallback(f, opts) { | 5250 bindUnaryCallback(f, opts) { |
5251 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; | 5251 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; |
5252 if (runGuarded) { | 5252 if (dart.notNull(runGuarded)) { |
5253 return dart.fn(arg => this.runUnaryGuarded(f, arg)); | 5253 return dart.fn(arg => this.runUnaryGuarded(f, arg)); |
5254 } else { | 5254 } else { |
5255 return dart.fn(arg => this.runUnary(f, arg)); | 5255 return dart.fn(arg => this.runUnary(f, arg)); |
5256 } | 5256 } |
5257 } | 5257 } |
5258 bindBinaryCallback(f, opts) { | 5258 bindBinaryCallback(f, opts) { |
5259 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; | 5259 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; |
5260 if (runGuarded) { | 5260 if (dart.notNull(runGuarded)) { |
5261 return dart.fn((arg1, arg2) => this.runBinaryGuarded(f, arg1, arg2)); | 5261 return dart.fn((arg1, arg2) => this.runBinaryGuarded(f, arg1, arg2)); |
5262 } else { | 5262 } else { |
5263 return dart.fn((arg1, arg2) => this.runBinary(f, arg1, arg2)); | 5263 return dart.fn((arg1, arg2) => this.runBinary(f, arg1, arg2)); |
5264 } | 5264 } |
5265 } | 5265 } |
5266 get(key) { | 5266 get(key) { |
5267 return null; | 5267 return null; |
5268 } | 5268 } |
5269 handleUncaughtError(error, stackTrace) { | 5269 handleUncaughtError(error, stackTrace) { |
5270 return _rootHandleUncaughtError(null, null, this, error, stackTrace); | 5270 return _rootHandleUncaughtError(null, null, this, error, stackTrace); |
5271 } | 5271 } |
5272 fork(opts) { | 5272 fork(opts) { |
5273 let specification = opts && 'specification' in opts ? opts.specification :
null; | 5273 let specification = opts && 'specification' in opts ? opts.specification :
null; |
5274 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; | 5274 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; |
5275 return _rootFork(null, null, this, specification, zoneValues); | 5275 return _rootFork(null, null, this, specification, zoneValues); |
5276 } | 5276 } |
5277 run(f) { | 5277 run(f) { |
5278 if (core.identical(Zone._current, _ROOT_ZONE)) | 5278 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) |
5279 return f(); | 5279 return f(); |
5280 return _rootRun(null, null, this, f); | 5280 return _rootRun(null, null, this, f); |
5281 } | 5281 } |
5282 runUnary(f, arg) { | 5282 runUnary(f, arg) { |
5283 if (core.identical(Zone._current, _ROOT_ZONE)) | 5283 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) |
5284 return dart.dcall(f, arg); | 5284 return dart.dcall(f, arg); |
5285 return _rootRunUnary(null, null, this, f, arg); | 5285 return _rootRunUnary(null, null, this, f, arg); |
5286 } | 5286 } |
5287 runBinary(f, arg1, arg2) { | 5287 runBinary(f, arg1, arg2) { |
5288 if (core.identical(Zone._current, _ROOT_ZONE)) | 5288 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) |
5289 return dart.dcall(f, arg1, arg2); | 5289 return dart.dcall(f, arg1, arg2); |
5290 return _rootRunBinary(null, null, this, f, arg1, arg2); | 5290 return _rootRunBinary(null, null, this, f, arg1, arg2); |
5291 } | 5291 } |
5292 registerCallback(f) { | 5292 registerCallback(f) { |
5293 return f; | 5293 return f; |
5294 } | 5294 } |
5295 registerUnaryCallback(f) { | 5295 registerUnaryCallback(f) { |
5296 return f; | 5296 return f; |
5297 } | 5297 } |
5298 registerBinaryCallback(f) { | 5298 registerBinaryCallback(f) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5384 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega
te(implZone), zone, f), ZoneUnaryCallback); | 5384 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega
te(implZone), zone, f), ZoneUnaryCallback); |
5385 } | 5385 } |
5386 registerBinaryCallback(zone, f) { | 5386 registerBinaryCallback(zone, f) { |
5387 let implementation = this[_delegationTarget][_registerBinaryCallback]; | 5387 let implementation = this[_delegationTarget][_registerBinaryCallback]; |
5388 let implZone = implementation.zone; | 5388 let implZone = implementation.zone; |
5389 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega
te(implZone), zone, f), ZoneBinaryCallback); | 5389 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega
te(implZone), zone, f), ZoneBinaryCallback); |
5390 } | 5390 } |
5391 errorCallback(zone, error, stackTrace) { | 5391 errorCallback(zone, error, stackTrace) { |
5392 let implementation = this[_delegationTarget][_errorCallback]; | 5392 let implementation = this[_delegationTarget][_errorCallback]; |
5393 let implZone = implementation.zone; | 5393 let implZone = implementation.zone; |
5394 if (core.identical(implZone, _ROOT_ZONE)) | 5394 if (dart.notNull(core.identical(implZone, _ROOT_ZONE))) |
5395 return null; | 5395 return null; |
5396 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega
te(implZone), zone, error, stackTrace), AsyncError); | 5396 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega
te(implZone), zone, error, stackTrace), AsyncError); |
5397 } | 5397 } |
5398 scheduleMicrotask(zone, f) { | 5398 scheduleMicrotask(zone, f) { |
5399 let implementation = this[_delegationTarget][_scheduleMicrotask]; | 5399 let implementation = this[_delegationTarget][_scheduleMicrotask]; |
5400 let implZone = implementation.zone; | 5400 let implZone = implementation.zone; |
5401 dart.dcall(implementation.function, implZone, _parentDelegate(implZone), z
one, f); | 5401 dart.dcall(implementation.function, implZone, _parentDelegate(implZone), z
one, f); |
5402 } | 5402 } |
5403 createTimer(zone, duration, f) { | 5403 createTimer(zone, duration, f) { |
5404 let implementation = this[_delegationTarget][_createTimer]; | 5404 let implementation = this[_delegationTarget][_createTimer]; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5506 return this.runBinary(f, arg1, arg2); | 5506 return this.runBinary(f, arg1, arg2); |
5507 } catch (e) { | 5507 } catch (e) { |
5508 let s = dart.stackTrace(e); | 5508 let s = dart.stackTrace(e); |
5509 return this.handleUncaughtError(e, s); | 5509 return this.handleUncaughtError(e, s); |
5510 } | 5510 } |
5511 | 5511 |
5512 } | 5512 } |
5513 bindCallback(f, opts) { | 5513 bindCallback(f, opts) { |
5514 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; | 5514 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; |
5515 let registered = this.registerCallback(f); | 5515 let registered = this.registerCallback(f); |
5516 if (runGuarded) { | 5516 if (dart.notNull(runGuarded)) { |
5517 return dart.fn(() => this.runGuarded(registered)); | 5517 return dart.fn(() => this.runGuarded(registered)); |
5518 } else { | 5518 } else { |
5519 return dart.fn(() => this.run(registered)); | 5519 return dart.fn(() => this.run(registered)); |
5520 } | 5520 } |
5521 } | 5521 } |
5522 bindUnaryCallback(f, opts) { | 5522 bindUnaryCallback(f, opts) { |
5523 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; | 5523 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; |
5524 let registered = this.registerUnaryCallback(f); | 5524 let registered = this.registerUnaryCallback(f); |
5525 if (runGuarded) { | 5525 if (dart.notNull(runGuarded)) { |
5526 return dart.fn(arg => this.runUnaryGuarded(registered, arg)); | 5526 return dart.fn(arg => this.runUnaryGuarded(registered, arg)); |
5527 } else { | 5527 } else { |
5528 return dart.fn(arg => this.runUnary(registered, arg)); | 5528 return dart.fn(arg => this.runUnary(registered, arg)); |
5529 } | 5529 } |
5530 } | 5530 } |
5531 bindBinaryCallback(f, opts) { | 5531 bindBinaryCallback(f, opts) { |
5532 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; | 5532 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; |
5533 let registered = this.registerBinaryCallback(f); | 5533 let registered = this.registerBinaryCallback(f); |
5534 if (runGuarded) { | 5534 if (dart.notNull(runGuarded)) { |
5535 return dart.fn((arg1, arg2) => this.runBinaryGuarded(registered, arg1, a
rg2)); | 5535 return dart.fn((arg1, arg2) => this.runBinaryGuarded(registered, arg1, a
rg2)); |
5536 } else { | 5536 } else { |
5537 return dart.fn((arg1, arg2) => this.runBinary(registered, arg1, arg2)); | 5537 return dart.fn((arg1, arg2) => this.runBinary(registered, arg1, arg2)); |
5538 } | 5538 } |
5539 } | 5539 } |
5540 get(key) { | 5540 get(key) { |
5541 let result = this[_map].get(key); | 5541 let result = this[_map].get(key); |
5542 if (dart.notNull(result != null) || dart.notNull(this[_map].containsKey(ke
y))) | 5542 if (result != null || dart.notNull(this[_map].containsKey(key))) |
5543 return result; | 5543 return result; |
5544 if (this.parent != null) { | 5544 if (this.parent != null) { |
5545 let value = this.parent.get(key); | 5545 let value = this.parent.get(key); |
5546 if (value != null) { | 5546 if (value != null) { |
5547 this[_map].set(key, value); | 5547 this[_map].set(key, value); |
5548 } | 5548 } |
5549 return value; | 5549 return value; |
5550 } | 5550 } |
5551 dart.assert(dart.equals(this, _ROOT_ZONE)); | 5551 dart.assert(dart.equals(this, _ROOT_ZONE)); |
5552 return null; | 5552 return null; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5598 registerBinaryCallback(f) { | 5598 registerBinaryCallback(f) { |
5599 let implementation = this[_registerBinaryCallback]; | 5599 let implementation = this[_registerBinaryCallback]; |
5600 dart.assert(implementation != null); | 5600 dart.assert(implementation != null); |
5601 let parentDelegate = _parentDelegate(implementation.zone); | 5601 let parentDelegate = _parentDelegate(implementation.zone); |
5602 return dart.as(dart.dcall(implementation.function, implementation.zone, pa
rentDelegate, this, f), ZoneBinaryCallback); | 5602 return dart.as(dart.dcall(implementation.function, implementation.zone, pa
rentDelegate, this, f), ZoneBinaryCallback); |
5603 } | 5603 } |
5604 errorCallback(error, stackTrace) { | 5604 errorCallback(error, stackTrace) { |
5605 let implementation = this[_errorCallback]; | 5605 let implementation = this[_errorCallback]; |
5606 dart.assert(implementation != null); | 5606 dart.assert(implementation != null); |
5607 let implementationZone = implementation.zone; | 5607 let implementationZone = implementation.zone; |
5608 if (core.identical(implementationZone, _ROOT_ZONE)) | 5608 if (dart.notNull(core.identical(implementationZone, _ROOT_ZONE))) |
5609 return null; | 5609 return null; |
5610 let parentDelegate = _parentDelegate(dart.as(implementationZone, _Zone)); | 5610 let parentDelegate = _parentDelegate(dart.as(implementationZone, _Zone)); |
5611 return dart.as(dart.dcall(implementation.function, implementationZone, par
entDelegate, this, error, stackTrace), AsyncError); | 5611 return dart.as(dart.dcall(implementation.function, implementationZone, par
entDelegate, this, error, stackTrace), AsyncError); |
5612 } | 5612 } |
5613 scheduleMicrotask(f) { | 5613 scheduleMicrotask(f) { |
5614 let implementation = this[_scheduleMicrotask]; | 5614 let implementation = this[_scheduleMicrotask]; |
5615 dart.assert(implementation != null); | 5615 dart.assert(implementation != null); |
5616 let parentDelegate = _parentDelegate(implementation.zone); | 5616 let parentDelegate = _parentDelegate(implementation.zone); |
5617 return dart.dcall(implementation.function, implementation.zone, parentDele
gate, this, f); | 5617 return dart.dcall(implementation.function, implementation.zone, parentDele
gate, this, f); |
5618 } | 5618 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5821 let errorHandler = null; | 5821 let errorHandler = null; |
5822 if (onError != null) { | 5822 if (onError != null) { |
5823 errorHandler = dart.fn((self, parent, zone, error, stackTrace) => { | 5823 errorHandler = dart.fn((self, parent, zone, error, stackTrace) => { |
5824 try { | 5824 try { |
5825 if (dart.is(onError, ZoneBinaryCallback)) { | 5825 if (dart.is(onError, ZoneBinaryCallback)) { |
5826 return self.parent.runBinary(onError, error, stackTrace); | 5826 return self.parent.runBinary(onError, error, stackTrace); |
5827 } | 5827 } |
5828 return self.parent.runUnary(dart.as(onError, __CastType38), error); | 5828 return self.parent.runUnary(dart.as(onError, __CastType38), error); |
5829 } catch (e) { | 5829 } catch (e) { |
5830 let s = dart.stackTrace(e); | 5830 let s = dart.stackTrace(e); |
5831 if (core.identical(e, error)) { | 5831 if (dart.notNull(core.identical(e, error))) { |
5832 return parent.handleUncaughtError(zone, error, stackTrace); | 5832 return parent.handleUncaughtError(zone, error, stackTrace); |
5833 } else { | 5833 } else { |
5834 return parent.handleUncaughtError(zone, e, s); | 5834 return parent.handleUncaughtError(zone, e, s); |
5835 } | 5835 } |
5836 } | 5836 } |
5837 | 5837 |
5838 }, core.Object, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace]); | 5838 }, core.Object, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace]); |
5839 } | 5839 } |
5840 if (zoneSpecification == null) { | 5840 if (zoneSpecification == null) { |
5841 zoneSpecification = ZoneSpecification.new({handleUncaughtError: errorHandl
er}); | 5841 zoneSpecification = ZoneSpecification.new({handleUncaughtError: errorHandl
er}); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5900 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; | 5900 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; |
5901 exports.CreateTimerHandler = CreateTimerHandler; | 5901 exports.CreateTimerHandler = CreateTimerHandler; |
5902 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; | 5902 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; |
5903 exports.PrintHandler = PrintHandler; | 5903 exports.PrintHandler = PrintHandler; |
5904 exports.ForkHandler = ForkHandler; | 5904 exports.ForkHandler = ForkHandler; |
5905 exports.ZoneSpecification = ZoneSpecification; | 5905 exports.ZoneSpecification = ZoneSpecification; |
5906 exports.ZoneDelegate = ZoneDelegate; | 5906 exports.ZoneDelegate = ZoneDelegate; |
5907 exports.Zone = Zone; | 5907 exports.Zone = Zone; |
5908 exports.runZoned = runZoned; | 5908 exports.runZoned = runZoned; |
5909 })(async, core, _internal, _isolate_helper, _js_helper, collection); | 5909 })(async, core, _internal, _isolate_helper, _js_helper, collection); |
OLD | NEW |