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

Side by Side Diff: lib/runtime/dart/async.js

Issue 1076883003: Initial support for runtime function types and type checking (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: uncomment code Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var async; 1 var async;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic
5 function _invokeErrorHandler(errorHandler, error, stackTrace) { 5 function _invokeErrorHandler(errorHandler, error, stackTrace) {
6 if (dart.is(errorHandler, ZoneBinaryCallback)) { 6 if (dart.is(errorHandler, ZoneBinaryCallback)) {
7 return dart.dinvokef(errorHandler, error, stackTrace); 7 return dart.dinvokef(errorHandler, error, stackTrace);
8 } else { 8 } else {
9 return dart.dinvokef(errorHandler, error); 9 return dart.dinvokef(errorHandler, error);
10 } 10 }
11 } 11 }
12 // Function _registerErrorHandler: (Function, Zone) → Function 12 // Function _registerErrorHandler: (Function, Zone) → Function
13 function _registerErrorHandler(errorHandler, zone) { 13 function _registerErrorHandler(errorHandler, zone) {
14 if (dart.is(errorHandler, ZoneBinaryCallback)) { 14 if (dart.is(errorHandler, ZoneBinaryCallback)) {
15 return zone.registerBinaryCallback(errorHandler); 15 return zone.registerBinaryCallback(errorHandler);
16 } else { 16 } else {
17 return zone.registerUnaryCallback(dart.as(errorHandler, dart.throw_("Unimp lemented type (dynamic) → dynamic"))); 17 return zone.registerUnaryCallback(dart.as(errorHandler, dart.functionType( dynamic, [dynamic])));
18 } 18 }
19 } 19 }
20 let _getBestStackTrace = Symbol('_getBestStackTrace'); 20 let _getBestStackTrace = Symbol('_getBestStackTrace');
21 class AsyncError extends core.Object { 21 class AsyncError extends core.Object {
22 AsyncError(error, stackTrace) { 22 AsyncError(error, stackTrace) {
23 this.error = error; 23 this.error = error;
24 this.stackTrace = stackTrace; 24 this.stackTrace = stackTrace;
25 } 25 }
26 toString() { 26 toString() {
27 return this.error.toString(); 27 return this.error.toString();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 let _sink = Symbol('_sink'); 60 let _sink = Symbol('_sink');
61 let Stream$ = dart.generic(function(T) { 61 let Stream$ = dart.generic(function(T) {
62 class Stream extends core.Object { 62 class Stream extends core.Object {
63 Stream() { 63 Stream() {
64 } 64 }
65 fromFuture(future) { 65 fromFuture(future) {
66 let controller = new (StreamController$(T))({sync: true}); 66 let controller = new (StreamController$(T))({sync: true});
67 future.then(dart.as((value) => { 67 future.then(dart.as((value) => {
68 controller[_add](dart.as(value, T)); 68 controller[_add](dart.as(value, T));
69 controller[_closeUnchecked](); 69 controller[_closeUnchecked]();
70 }, dart.throw_("Unimplemented type (T) → dynamic")), { 70 }, dart.functionType(dynamic, [T])), {
71 onError: (error, stackTrace) => { 71 onError: (error, stackTrace) => {
72 controller[_addError](error, dart.as(stackTrace, core.StackTrace)); 72 controller[_addError](error, dart.as(stackTrace, core.StackTrace));
73 controller[_closeUnchecked](); 73 controller[_closeUnchecked]();
74 } 74 }
75 }); 75 });
76 return controller.stream; 76 return controller.stream;
77 } 77 }
78 fromIterable(data) { 78 fromIterable(data) {
79 return new (_GeneratedStreamImpl$(T))(() => new (_IterablePendingEvents$ (T))(data)); 79 return new (_GeneratedStreamImpl$(T))(() => new (_IterablePendingEvents$ (T))(data));
80 } 80 }
81 periodic(period, computation) { 81 periodic(period, computation) {
82 if (computation === void 0) 82 if (computation === void 0)
83 computation = null; 83 computation = null;
84 if (computation == null) 84 if (computation == null)
85 computation = dart.as((i) => null, dart.throw_("Unimplemented type (in t) → T")); 85 computation = dart.as((i) => null, dart.functionType(T, [core.int]));
86 let timer = null; 86 let timer = null;
87 let computationCount = 0; 87 let computationCount = 0;
88 let controller = null; 88 let controller = null;
89 let watch = new core.Stopwatch(); 89 let watch = new core.Stopwatch();
90 // Function sendEvent: () → void 90 // Function sendEvent: () → void
91 function sendEvent() { 91 function sendEvent() {
92 watch.reset(); 92 watch.reset();
93 let data = computation(((x) => computationCount = dart.notNull(x) + 1, x)(computationCount)); 93 let data = computation(((x) => computationCount = dart.notNull(x) + 1, x)(computationCount));
94 controller.add(data); 94 controller.add(data);
95 } 95 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 eventTransformed(source, mapSink) { 132 eventTransformed(source, mapSink) {
133 return dart.as(new _BoundSinkStream(source, dart.as(mapSink, _SinkMapper )), Stream$(T)); 133 return dart.as(new _BoundSinkStream(source, dart.as(mapSink, _SinkMapper )), Stream$(T));
134 } 134 }
135 get isBroadcast() { 135 get isBroadcast() {
136 return false; 136 return false;
137 } 137 }
138 asBroadcastStream(opts) { 138 asBroadcastStream(opts) {
139 let onListen = opts && 'onListen' in opts ? opts.onListen : null; 139 let onListen = opts && 'onListen' in opts ? opts.onListen : null;
140 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; 140 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null;
141 return new (_AsBroadcastStream$(T))(this, dart.as(onListen, dart.throw_( "Unimplemented type (StreamSubscription<dynamic>) → void")), dart.as(onCancel, d art.throw_("Unimplemented type (StreamSubscription<dynamic>) → void"))); 141 return new (_AsBroadcastStream$(T))(this, dart.as(onListen, dart.functio nType(dart.void, [StreamSubscription])), dart.as(onCancel, dart.functionType(dar t.void, [StreamSubscription])));
142 } 142 }
143 where(test) { 143 where(test) {
144 return new (_WhereStream$(T))(this, test); 144 return new (_WhereStream$(T))(this, test);
145 } 145 }
146 map(convert) { 146 map(convert) {
147 return new (_MapStream$(T, dynamic))(this, convert); 147 return new (_MapStream$(T, dynamic))(this, convert);
148 } 148 }
149 asyncMap(convert) { 149 asyncMap(convert) {
150 let controller = null; 150 let controller = null;
151 let subscription = null; 151 let subscription = null;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 reduce(combine) { 262 reduce(combine) {
263 let result = new (_Future$(T))(); 263 let result = new (_Future$(T))();
264 let seenFirst = false; 264 let seenFirst = false;
265 let value = null; 265 let value = null;
266 let subscription = null; 266 let subscription = null;
267 subscription = this.listen((element) => { 267 subscription = this.listen((element) => {
268 if (seenFirst) { 268 if (seenFirst) {
269 _runUserCode(() => combine(value, element), (newValue) => { 269 _runUserCode(() => combine(value, element), (newValue) => {
270 value = newValue; 270 value = newValue;
271 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_ ("Unimplemented type (dynamic, StackTrace) → dynamic"))); 271 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.functi onType(dynamic, [dynamic, core.StackTrace])));
272 } else { 272 } else {
273 value = element; 273 value = element;
274 seenFirst = true; 274 seenFirst = true;
275 } 275 }
276 }, { 276 }, {
277 onError: result[_completeError], 277 onError: result[_completeError],
278 onDone: () => { 278 onDone: () => {
279 if (!dart.notNull(seenFirst)) { 279 if (!dart.notNull(seenFirst)) {
280 try { 280 try {
281 throw _internal.IterableElementError.noElement(); 281 throw _internal.IterableElementError.noElement();
(...skipping 10 matching lines...) Expand all
292 }); 292 });
293 return result; 293 return result;
294 } 294 }
295 fold(initialValue, combine) { 295 fold(initialValue, combine) {
296 let result = new _Future(); 296 let result = new _Future();
297 let value = initialValue; 297 let value = initialValue;
298 let subscription = null; 298 let subscription = null;
299 subscription = this.listen((element) => { 299 subscription = this.listen((element) => {
300 _runUserCode(() => dart.dinvokef(combine, value, element), (newValue) => { 300 _runUserCode(() => dart.dinvokef(combine, value, element), (newValue) => {
301 value = newValue; 301 value = newValue;
302 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 302 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.function Type(dynamic, [dynamic, core.StackTrace])));
303 }, { 303 }, {
304 onError: (e, st) => { 304 onError: (e, st) => {
305 result[_completeError](e, dart.as(st, core.StackTrace)); 305 result[_completeError](e, dart.as(st, core.StackTrace));
306 }, 306 },
307 onDone: () => { 307 onDone: () => {
308 result[_complete](value); 308 result[_complete](value);
309 }, 309 },
310 cancelOnError: true 310 cancelOnError: true
311 }); 311 });
312 return result; 312 return result;
(...skipping 29 matching lines...) Expand all
342 return result; 342 return result;
343 } 343 }
344 contains(needle) { 344 contains(needle) {
345 let future = new (_Future$(core.bool))(); 345 let future = new (_Future$(core.bool))();
346 let subscription = null; 346 let subscription = null;
347 subscription = this.listen((element) => { 347 subscription = this.listen((element) => {
348 _runUserCode(() => dart.equals(element, needle), (isMatch) => { 348 _runUserCode(() => dart.equals(element, needle), (isMatch) => {
349 if (isMatch) { 349 if (isMatch) {
350 _cancelAndValue(subscription, future, true); 350 _cancelAndValue(subscription, future, true);
351 } 351 }
352 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 352 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
353 }, { 353 }, {
354 onError: future[_completeError], 354 onError: future[_completeError],
355 onDone: () => { 355 onDone: () => {
356 future[_complete](false); 356 future[_complete](false);
357 }, 357 },
358 cancelOnError: true 358 cancelOnError: true
359 }); 359 });
360 return future; 360 return future;
361 } 361 }
362 forEach(action) { 362 forEach(action) {
363 let future = new _Future(); 363 let future = new _Future();
364 let subscription = null; 364 let subscription = null;
365 subscription = this.listen((element) => { 365 subscription = this.listen((element) => {
366 _runUserCode(() => action(element), (_) => { 366 _runUserCode(() => action(element), (_) => {
367 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 367 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
368 }, { 368 }, {
369 onError: future[_completeError], 369 onError: future[_completeError],
370 onDone: () => { 370 onDone: () => {
371 future[_complete](null); 371 future[_complete](null);
372 }, 372 },
373 cancelOnError: true 373 cancelOnError: true
374 }); 374 });
375 return future; 375 return future;
376 } 376 }
377 every(test) { 377 every(test) {
378 let future = new (_Future$(core.bool))(); 378 let future = new (_Future$(core.bool))();
379 let subscription = null; 379 let subscription = null;
380 subscription = this.listen((element) => { 380 subscription = this.listen((element) => {
381 _runUserCode(() => test(element), (isMatch) => { 381 _runUserCode(() => test(element), (isMatch) => {
382 if (!dart.notNull(isMatch)) { 382 if (!dart.notNull(isMatch)) {
383 _cancelAndValue(subscription, future, false); 383 _cancelAndValue(subscription, future, false);
384 } 384 }
385 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 385 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
386 }, { 386 }, {
387 onError: future[_completeError], 387 onError: future[_completeError],
388 onDone: () => { 388 onDone: () => {
389 future[_complete](true); 389 future[_complete](true);
390 }, 390 },
391 cancelOnError: true 391 cancelOnError: true
392 }); 392 });
393 return future; 393 return future;
394 } 394 }
395 any(test) { 395 any(test) {
396 let future = new (_Future$(core.bool))(); 396 let future = new (_Future$(core.bool))();
397 let subscription = null; 397 let subscription = null;
398 subscription = this.listen((element) => { 398 subscription = this.listen((element) => {
399 _runUserCode(() => test(element), (isMatch) => { 399 _runUserCode(() => test(element), (isMatch) => {
400 if (isMatch) { 400 if (isMatch) {
401 _cancelAndValue(subscription, future, true); 401 _cancelAndValue(subscription, future, true);
402 } 402 }
403 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 403 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
404 }, { 404 }, {
405 onError: future[_completeError], 405 onError: future[_completeError],
406 onDone: () => { 406 onDone: () => {
407 future[_complete](false); 407 future[_complete](false);
408 }, 408 },
409 cancelOnError: true 409 cancelOnError: true
410 }); 410 });
411 return future; 411 return future;
412 } 412 }
413 get length() { 413 get length() {
414 let future = new (_Future$(core.int))(); 414 let future = new (_Future$(core.int))();
415 let count = 0; 415 let count = 0;
416 this.listen(dart.as((_) => { 416 this.listen(dart.as((_) => {
417 count = dart.notNull(count) + 1; 417 count = dart.notNull(count) + 1;
418 }, dart.throw_("Unimplemented type (T) → void")), { 418 }, dart.functionType(dart.void, [T])), {
419 onError: future[_completeError], 419 onError: future[_completeError],
420 onDone: () => { 420 onDone: () => {
421 future[_complete](count); 421 future[_complete](count);
422 }, 422 },
423 cancelOnError: true 423 cancelOnError: true
424 }); 424 });
425 return future; 425 return future;
426 } 426 }
427 get isEmpty() { 427 get isEmpty() {
428 let future = new (_Future$(core.bool))(); 428 let future = new (_Future$(core.bool))();
429 let subscription = null; 429 let subscription = null;
430 subscription = this.listen(dart.as((_) => { 430 subscription = this.listen(dart.as((_) => {
431 _cancelAndValue(subscription, future, false); 431 _cancelAndValue(subscription, future, false);
432 }, dart.throw_("Unimplemented type (T) → void")), { 432 }, dart.functionType(dart.void, [T])), {
433 onError: future[_completeError], 433 onError: future[_completeError],
434 onDone: () => { 434 onDone: () => {
435 future[_complete](true); 435 future[_complete](true);
436 }, 436 },
437 cancelOnError: true 437 cancelOnError: true
438 }); 438 });
439 return future; 439 return future;
440 } 440 }
441 toList() { 441 toList() {
442 let result = new core.List$(T).from([]); 442 let result = new core.List$(T).from([]);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 574 }
575 firstWhere(test, opts) { 575 firstWhere(test, opts) {
576 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null; 576 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null;
577 let future = new _Future(); 577 let future = new _Future();
578 let subscription = null; 578 let subscription = null;
579 subscription = this.listen((value) => { 579 subscription = this.listen((value) => {
580 _runUserCode(() => test(value), (isMatch) => { 580 _runUserCode(() => test(value), (isMatch) => {
581 if (isMatch) { 581 if (isMatch) {
582 _cancelAndValue(subscription, future, value); 582 _cancelAndValue(subscription, future, value);
583 } 583 }
584 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 584 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
585 }, { 585 }, {
586 onError: future[_completeError], 586 onError: future[_completeError],
587 onDone: () => { 587 onDone: () => {
588 if (defaultValue != null) { 588 if (defaultValue != null) {
589 _runUserCode(defaultValue, future[_complete], future[_completeErro r]); 589 _runUserCode(defaultValue, future[_complete], future[_completeErro r]);
590 return; 590 return;
591 } 591 }
592 try { 592 try {
593 throw _internal.IterableElementError.noElement(); 593 throw _internal.IterableElementError.noElement();
594 } catch (e) { 594 } catch (e) {
(...skipping 11 matching lines...) Expand all
606 let future = new _Future(); 606 let future = new _Future();
607 let result = null; 607 let result = null;
608 let foundResult = false; 608 let foundResult = false;
609 let subscription = null; 609 let subscription = null;
610 subscription = this.listen((value) => { 610 subscription = this.listen((value) => {
611 _runUserCode(() => true == test(value), (isMatch) => { 611 _runUserCode(() => true == test(value), (isMatch) => {
612 if (isMatch) { 612 if (isMatch) {
613 foundResult = true; 613 foundResult = true;
614 result = value; 614 result = value;
615 } 615 }
616 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 616 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
617 }, { 617 }, {
618 onError: future[_completeError], 618 onError: future[_completeError],
619 onDone: () => { 619 onDone: () => {
620 if (foundResult) { 620 if (foundResult) {
621 future[_complete](result); 621 future[_complete](result);
622 return; 622 return;
623 } 623 }
624 if (defaultValue != null) { 624 if (defaultValue != null) {
625 _runUserCode(defaultValue, future[_complete], future[_completeErro r]); 625 _runUserCode(defaultValue, future[_complete], future[_completeErro r]);
626 return; 626 return;
(...skipping 24 matching lines...) Expand all
651 } catch (e) { 651 } catch (e) {
652 let s = dart.stackTrace(e); 652 let s = dart.stackTrace(e);
653 _cancelAndErrorWithReplacement(subscription, future, e, s); 653 _cancelAndErrorWithReplacement(subscription, future, e, s);
654 } 654 }
655 655
656 return; 656 return;
657 } 657 }
658 foundResult = true; 658 foundResult = true;
659 result = value; 659 result = value;
660 } 660 }
661 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 661 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.function Type(dynamic, [dynamic, core.StackTrace])));
662 }, { 662 }, {
663 onError: future[_completeError], 663 onError: future[_completeError],
664 onDone: () => { 664 onDone: () => {
665 if (foundResult) { 665 if (foundResult) {
666 future[_complete](result); 666 future[_complete](result);
667 return; 667 return;
668 } 668 }
669 try { 669 try {
670 throw _internal.IterableElementError.noElement(); 670 throw _internal.IterableElementError.noElement();
671 } catch (e) { 671 } catch (e) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; 703 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null;
704 let controller = null; 704 let controller = null;
705 let subscription = null; 705 let subscription = null;
706 let timer = null; 706 let timer = null;
707 let zone = null; 707 let zone = null;
708 let timeout = null; 708 let timeout = null;
709 // Function onData: (T) → void 709 // Function onData: (T) → void
710 function onData(event) { 710 function onData(event) {
711 timer.cancel(); 711 timer.cancel();
712 controller.add(event); 712 controller.add(event);
713 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.throw_("Unim plemented type () → void"))); 713 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType (dart.void, [])));
714 } 714 }
715 // Function onError: (dynamic, StackTrace) → void 715 // Function onError: (dynamic, StackTrace) → void
716 function onError(error, stackTrace) { 716 function onError(error, stackTrace) {
717 timer.cancel(); 717 timer.cancel();
718 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController))); 718 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController)));
719 let eventSink = controller; 719 let eventSink = controller;
720 dart.dinvoke(eventSink, '_addError', error, stackTrace); 720 dart.dinvoke(eventSink, '_addError', error, stackTrace);
721 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.throw_("Unim plemented type () → void"))); 721 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType (dart.void, [])));
722 } 722 }
723 // Function onDone: () → void 723 // Function onDone: () → void
724 function onDone() { 724 function onDone() {
725 timer.cancel(); 725 timer.cancel();
726 controller.close(); 726 controller.close();
727 } 727 }
728 // Function onListen: () → void 728 // Function onListen: () → void
729 function onListen() { 729 function onListen() {
730 zone = Zone.current; 730 zone = Zone.current;
731 if (onTimeout == null) { 731 if (onTimeout == null) {
732 timeout = () => { 732 timeout = () => {
733 controller.addError(new TimeoutException("No stream event", timeLi mit), null); 733 controller.addError(new TimeoutException("No stream event", timeLi mit), null);
734 }; 734 };
735 } else { 735 } else {
736 onTimeout = dart.as(zone.registerUnaryCallback(onTimeout), dart.thro w_("Unimplemented type (EventSink<dynamic>) → void")); 736 onTimeout = dart.as(zone.registerUnaryCallback(onTimeout), dart.func tionType(dart.void, [EventSink]));
737 let wrapper = new _ControllerEventSinkWrapper(null); 737 let wrapper = new _ControllerEventSinkWrapper(null);
738 timeout = () => { 738 timeout = () => {
739 wrapper[_sink] = controller; 739 wrapper[_sink] = controller;
740 zone.runUnaryGuarded(onTimeout, wrapper); 740 zone.runUnaryGuarded(onTimeout, wrapper);
741 wrapper[_sink] = null; 741 wrapper[_sink] = null;
742 }; 742 };
743 } 743 }
744 subscription = this.listen(onData, {onError: onError, onDone: onDone}) ; 744 subscription = this.listen(onData, {onError: onError, onDone: onDone}) ;
745 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.throw_("Unim plemented type () → void"))); 745 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType (dart.void, [])));
746 } 746 }
747 // Function onCancel: () → Future<dynamic> 747 // Function onCancel: () → Future<dynamic>
748 function onCancel() { 748 function onCancel() {
749 timer.cancel(); 749 timer.cancel();
750 let result = subscription.cancel(); 750 let result = subscription.cancel();
751 subscription = null; 751 subscription = null;
752 return result; 752 return result;
753 } 753 }
754 controller = this.isBroadcast ? new _SyncBroadcastStreamController(onLis ten, onCancel) : new _SyncStreamController(onListen, () => { 754 controller = this.isBroadcast ? new _SyncBroadcastStreamController(onLis ten, onCancel) : new _SyncStreamController(onListen, () => {
755 timer.cancel(); 755 timer.cancel();
756 subscription.pause(); 756 subscription.pause();
757 }, () => { 757 }, () => {
758 subscription.resume(); 758 subscription.resume();
759 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.throw_("Unim plemented type () → void"))); 759 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.functionType (dart.void, [])));
760 }, onCancel); 760 }, onCancel);
761 return controller.stream; 761 return controller.stream;
762 } 762 }
763 } 763 }
764 dart.defineNamedConstructor(Stream, 'fromFuture'); 764 dart.defineNamedConstructor(Stream, 'fromFuture');
765 dart.defineNamedConstructor(Stream, 'fromIterable'); 765 dart.defineNamedConstructor(Stream, 'fromIterable');
766 dart.defineNamedConstructor(Stream, 'periodic'); 766 dart.defineNamedConstructor(Stream, 'periodic');
767 dart.defineNamedConstructor(Stream, 'eventTransformed'); 767 dart.defineNamedConstructor(Stream, 'eventTransformed');
768 return Stream; 768 return Stream;
769 }); 769 });
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 908 }
909 } 909 }
910 [_extractPending]() { 910 [_extractPending]() {
911 dart.assert(this[_isCanceled]); 911 dart.assert(this[_isCanceled]);
912 let events = this[_pending]; 912 let events = this[_pending];
913 this[_pending] = null; 913 this[_pending] = null;
914 return events; 914 return events;
915 } 915 }
916 onData(handleData) { 916 onData(handleData) {
917 if (handleData == null) 917 if (handleData == null)
918 handleData = dart.as(_nullDataHandler, dart.throw_("Unimplemented type (T) → void")); 918 handleData = dart.as(_nullDataHandler, dart.functionType(dart.void, [T ]));
919 this[_onData] = dart.as(this[_zone].registerUnaryCallback(handleData), _ DataHandler); 919 this[_onData] = dart.as(this[_zone].registerUnaryCallback(handleData), _ DataHandler);
920 } 920 }
921 onError(handleError) { 921 onError(handleError) {
922 if (handleError == null) 922 if (handleError == null)
923 handleError = _nullErrorHandler; 923 handleError = _nullErrorHandler;
924 this[_onError] = _registerErrorHandler(handleError, this[_zone]); 924 this[_onError] = _registerErrorHandler(handleError, this[_zone]);
925 } 925 }
926 onDone(handleDone) { 926 onDone(handleDone) {
927 if (handleDone == null) 927 if (handleDone == null)
928 handleDone = _nullDoneHandler; 928 handleDone = _nullDoneHandler;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 dart.assert(!dart.notNull(this[_isCanceled])); 1095 dart.assert(!dart.notNull(this[_isCanceled]));
1096 dart.assert(!dart.notNull(this[_isPaused])); 1096 dart.assert(!dart.notNull(this[_isPaused]));
1097 dart.assert(!dart.notNull(this[_inCallback])); 1097 dart.assert(!dart.notNull(this[_inCallback]));
1098 let wasInputPaused = this[_isInputPaused]; 1098 let wasInputPaused = this[_isInputPaused];
1099 // Function sendError: () → void 1099 // Function sendError: () → void
1100 function sendError() { 1100 function sendError() {
1101 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel])) 1101 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel]))
1102 return; 1102 return;
1103 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1103 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK];
1104 if (dart.is(this[_onError], ZoneBinaryCallback)) { 1104 if (dart.is(this[_onError], ZoneBinaryCallback)) {
1105 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.throw_("Un implemented type (dynamic, dynamic) → dynamic")), error, stackTrace); 1105 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.functionTy pe(dynamic, [dynamic, dynamic])), error, stackTrace);
1106 } else { 1106 } else {
1107 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.throw_("Uni mplemented type (dynamic) → dynamic")), error); 1107 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.functionTyp e(dynamic, [dynamic])), error);
1108 } 1108 }
1109 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1109 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]);
1110 } 1110 }
1111 if (this[_cancelOnError]) { 1111 if (this[_cancelOnError]) {
1112 this[_state] = _BufferingStreamSubscription[_STATE_WAIT_FOR_CANCEL]; 1112 this[_state] = _BufferingStreamSubscription[_STATE_WAIT_FOR_CANCEL];
1113 this[_cancel](); 1113 this[_cancel]();
1114 if (dart.is(this[_cancelFuture], Future)) { 1114 if (dart.is(this[_cancelFuture], Future)) {
1115 this[_cancelFuture].whenComplete(sendError); 1115 this[_cancelFuture].whenComplete(sendError);
1116 } else { 1116 } else {
1117 sendError(); 1117 sendError();
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 if (this[_isEmpty]) 1493 if (this[_isEmpty])
1494 return; 1494 return;
1495 this[_forEachListener]((subscription) => { 1495 this[_forEachListener]((subscription) => {
1496 subscription[_addError](error, stackTrace); 1496 subscription[_addError](error, stackTrace);
1497 }); 1497 });
1498 } 1498 }
1499 [_sendDone]() { 1499 [_sendDone]() {
1500 if (!dart.notNull(this[_isEmpty])) { 1500 if (!dart.notNull(this[_isEmpty])) {
1501 this[_forEachListener](dart.as((subscription) => { 1501 this[_forEachListener](dart.as((subscription) => {
1502 subscription[_close](); 1502 subscription[_close]();
1503 }, dart.throw_("Unimplemented type (_BufferingStreamSubscription<T>) → void"))); 1503 }, dart.functionType(dart.void, [_BufferingStreamSubscription$(T)])));
1504 } else { 1504 } else {
1505 dart.assert(this[_doneFuture] != null); 1505 dart.assert(this[_doneFuture] != null);
1506 dart.assert(this[_doneFuture][_mayComplete]); 1506 dart.assert(this[_doneFuture][_mayComplete]);
1507 this[_doneFuture][_asyncComplete](null); 1507 this[_doneFuture][_asyncComplete](null);
1508 } 1508 }
1509 } 1509 }
1510 } 1510 }
1511 return _SyncBroadcastStreamController; 1511 return _SyncBroadcastStreamController;
1512 }); 1512 });
1513 let _SyncBroadcastStreamController = _SyncBroadcastStreamController$(); 1513 let _SyncBroadcastStreamController = _SyncBroadcastStreamController$();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 if (!dart.notNull(iterator.moveNext())) 1803 if (!dart.notNull(iterator.moveNext()))
1804 return false; 1804 return false;
1805 return new Future.sync(() => dart.dinvokef(f, iterator.current)).then( (_) => true); 1805 return new Future.sync(() => dart.dinvokef(f, iterator.current)).then( (_) => true);
1806 }); 1806 });
1807 } 1807 }
1808 static doWhile(f) { 1808 static doWhile(f) {
1809 let doneSignal = new _Future(); 1809 let doneSignal = new _Future();
1810 let nextIteration = null; 1810 let nextIteration = null;
1811 nextIteration = Zone.current.bindUnaryCallback((keepGoing) => { 1811 nextIteration = Zone.current.bindUnaryCallback((keepGoing) => {
1812 if (keepGoing) { 1812 if (keepGoing) {
1813 new Future.sync(f).then(dart.as(nextIteration, dart.throw_("Unimplem ented type (dynamic) → dynamic")), {onError: doneSignal[_completeError]}); 1813 new Future.sync(f).then(dart.as(nextIteration, dart.functionType(dyn amic, [dynamic])), {onError: doneSignal[_completeError]});
1814 } else { 1814 } else {
1815 doneSignal[_complete](null); 1815 doneSignal[_complete](null);
1816 } 1816 }
1817 }, {runGuarded: true}); 1817 }, {runGuarded: true});
1818 dart.dinvokef(nextIteration, true); 1818 dart.dinvokef(nextIteration, true);
1819 return doneSignal; 1819 return doneSignal;
1820 } 1820 }
1821 } 1821 }
1822 dart.defineNamedConstructor(Future, 'microtask'); 1822 dart.defineNamedConstructor(Future, 'microtask');
1823 dart.defineNamedConstructor(Future, 'sync'); 1823 dart.defineNamedConstructor(Future, 'sync');
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 error = _nonNullError(replacement.error); 1869 error = _nonNullError(replacement.error);
1870 stackTrace = replacement.stackTrace; 1870 stackTrace = replacement.stackTrace;
1871 } 1871 }
1872 result[_completeError](error, dart.as(stackTrace, core.StackTrace)); 1872 result[_completeError](error, dart.as(stackTrace, core.StackTrace));
1873 } 1873 }
1874 // Function _nonNullError: (Object) → Object 1874 // Function _nonNullError: (Object) → Object
1875 function _nonNullError(error) { 1875 function _nonNullError(error) {
1876 return error != null ? error : new core.NullThrownError(); 1876 return error != null ? error : new core.NullThrownError();
1877 } 1877 }
1878 let _FutureOnValue$ = dart.generic(function(T) { 1878 let _FutureOnValue$ = dart.generic(function(T) {
1879 class _FutureOnValue extends core.Function {} 1879 let _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType( dynamic, [T]));
1880 return _FutureOnValue; 1880 return _FutureOnValue;
1881 }); 1881 });
1882 let _FutureOnValue = _FutureOnValue$(); 1882 let _FutureOnValue = _FutureOnValue$();
1883 class _FutureErrorTest extends core.Function {} 1883 let _FutureErrorTest = dart.typedef('_FutureErrorTest', () => dart.functionTyp e(core.bool, [dynamic]));
1884 class _FutureAction extends core.Function {} 1884 let _FutureAction = dart.typedef('_FutureAction', () => dart.functionType(dyna mic, []));
1885 let _Completer$ = dart.generic(function(T) { 1885 let _Completer$ = dart.generic(function(T) {
1886 class _Completer extends core.Object { 1886 class _Completer extends core.Object {
1887 _Completer() { 1887 _Completer() {
1888 this.future = new (_Future$(T))(); 1888 this.future = new (_Future$(T))();
1889 } 1889 }
1890 completeError(error, stackTrace) { 1890 completeError(error, stackTrace) {
1891 if (stackTrace === void 0) 1891 if (stackTrace === void 0)
1892 stackTrace = null; 1892 stackTrace = null;
1893 error = _nonNullError(error); 1893 error = _nonNullError(error);
1894 if (!dart.notNull(this.future[_mayComplete])) 1894 if (!dart.notNull(this.future[_mayComplete]))
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 this[_state] = _Future[_CHAINED]; 2083 this[_state] = _Future[_CHAINED];
2084 } else { 2084 } else {
2085 dart.assert(this[_isChained]); 2085 dart.assert(this[_isChained]);
2086 this[_state] = _Future[_INCOMPLETE]; 2086 this[_state] = _Future[_INCOMPLETE];
2087 } 2087 }
2088 } 2088 }
2089 then(f, opts) { 2089 then(f, opts) {
2090 let onError = opts && 'onError' in opts ? opts.onError : null; 2090 let onError = opts && 'onError' in opts ? opts.onError : null;
2091 let result = new _Future(); 2091 let result = new _Future();
2092 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { 2092 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
2093 f = dart.as(result[_zone].registerUnaryCallback(f), dart.throw_("Unimp lemented type (T) → dynamic")); 2093 f = dart.as(result[_zone].registerUnaryCallback(f), dart.functionType( dynamic, [T]));
2094 if (onError != null) { 2094 if (onError != null) {
2095 onError = _registerErrorHandler(onError, result[_zone]); 2095 onError = _registerErrorHandler(onError, result[_zone]);
2096 } 2096 }
2097 } 2097 }
2098 this[_addListener](new _FutureListener.then(result, f, onError)); 2098 this[_addListener](new _FutureListener.then(result, f, onError));
2099 return result; 2099 return result;
2100 } 2100 }
2101 catchError(onError, opts) { 2101 catchError(onError, opts) {
2102 let test = opts && 'test' in opts ? opts.test : null; 2102 let test = opts && 'test' in opts ? opts.test : null;
2103 let result = new _Future(); 2103 let result = new _Future();
2104 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { 2104 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
2105 onError = _registerErrorHandler(onError, result[_zone]); 2105 onError = _registerErrorHandler(onError, result[_zone]);
2106 if (test != null) 2106 if (test != null)
2107 test = dart.as(result[_zone].registerUnaryCallback(test), dart.throw _("Unimplemented type (dynamic) → bool")); 2107 test = dart.as(result[_zone].registerUnaryCallback(test), dart.funct ionType(core.bool, [dynamic]));
2108 } 2108 }
2109 this[_addListener](new _FutureListener.catchError(result, onError, test) ); 2109 this[_addListener](new _FutureListener.catchError(result, onError, test) );
2110 return result; 2110 return result;
2111 } 2111 }
2112 whenComplete(action) { 2112 whenComplete(action) {
2113 let result = new (_Future$(T))(); 2113 let result = new (_Future$(T))();
2114 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { 2114 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
2115 action = result[_zone].registerCallback(action); 2115 action = result[_zone].registerCallback(action);
2116 } 2116 }
2117 this[_addListener](new _FutureListener.whenComplete(result, action)); 2117 this[_addListener](new _FutureListener.whenComplete(result, action));
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 return; 2320 return;
2321 } 2321 }
2322 2322
2323 } 2323 }
2324 let errorCallback = listener[_onError]; 2324 let errorCallback = listener[_onError];
2325 if (dart.notNull(matchesTest) && dart.notNull(errorCallback != nul l)) { 2325 if (dart.notNull(matchesTest) && dart.notNull(errorCallback != nul l)) {
2326 try { 2326 try {
2327 if (dart.is(errorCallback, ZoneBinaryCallback)) { 2327 if (dart.is(errorCallback, ZoneBinaryCallback)) {
2328 listenerValueOrError = zone.runBinary(errorCallback, asyncEr ror.error, asyncError.stackTrace); 2328 listenerValueOrError = zone.runBinary(errorCallback, asyncEr ror.error, asyncError.stackTrace);
2329 } else { 2329 } else {
2330 listenerValueOrError = zone.runUnary(dart.as(errorCallback, dart.throw_("Unimplemented type (dynamic) → dynamic")), asyncError.error); 2330 listenerValueOrError = zone.runUnary(dart.as(errorCallback, dart.functionType(dynamic, [dynamic])), asyncError.error);
2331 } 2331 }
2332 } catch (e) { 2332 } catch (e) {
2333 let s = dart.stackTrace(e); 2333 let s = dart.stackTrace(e);
2334 listenerValueOrError = core.identical(asyncError.error, e) ? a syncError : new AsyncError(e, s); 2334 listenerValueOrError = core.identical(asyncError.error, e) ? a syncError : new AsyncError(e, s);
2335 listenerHasValue = false; 2335 listenerHasValue = false;
2336 return; 2336 return;
2337 } 2337 }
2338 2338
2339 listenerHasValue = true; 2339 listenerHasValue = true;
2340 } else { 2340 } else {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 dart.defineNamedConstructor(_Future, 'immediate'); 2463 dart.defineNamedConstructor(_Future, 'immediate');
2464 dart.defineNamedConstructor(_Future, 'immediateError'); 2464 dart.defineNamedConstructor(_Future, 'immediateError');
2465 _Future._INCOMPLETE = 0; 2465 _Future._INCOMPLETE = 0;
2466 _Future._PENDING_COMPLETE = 1; 2466 _Future._PENDING_COMPLETE = 1;
2467 _Future._CHAINED = 2; 2467 _Future._CHAINED = 2;
2468 _Future._VALUE = 4; 2468 _Future._VALUE = 4;
2469 _Future._ERROR = 8; 2469 _Future._ERROR = 8;
2470 return _Future; 2470 return _Future;
2471 }); 2471 });
2472 let _Future = _Future$(); 2472 let _Future = _Future$();
2473 class _AsyncCallback extends core.Function {} 2473 let _AsyncCallback = dart.typedef('_AsyncCallback', () => dart.functionType(da rt.void, []));
2474 class _AsyncCallbackEntry extends core.Object { 2474 class _AsyncCallbackEntry extends core.Object {
2475 _AsyncCallbackEntry(callback) { 2475 _AsyncCallbackEntry(callback) {
2476 this.callback = callback; 2476 this.callback = callback;
2477 this.next = null; 2477 this.next = null;
2478 } 2478 }
2479 } 2479 }
2480 exports._nextCallback = null; 2480 exports._nextCallback = null;
2481 exports._lastCallback = null; 2481 exports._lastCallback = null;
2482 exports._lastPriorityCallback = null; 2482 exports._lastPriorityCallback = null;
2483 exports._isInCallbackLoop = false; 2483 exports._isInCallbackLoop = false;
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
3041 } 3041 }
3042 get [_onResume]() { 3042 get [_onResume]() {
3043 return null; 3043 return null;
3044 } 3044 }
3045 get [_onCancel]() { 3045 get [_onCancel]() {
3046 return null; 3046 return null;
3047 } 3047 }
3048 } 3048 }
3049 class _NoCallbackAsyncStreamController extends dart.mixin(_AsyncStreamControll erDispatch, _NoCallbacks) {} 3049 class _NoCallbackAsyncStreamController extends dart.mixin(_AsyncStreamControll erDispatch, _NoCallbacks) {}
3050 class _NoCallbackSyncStreamController extends dart.mixin(_SyncStreamController Dispatch, _NoCallbacks) {} 3050 class _NoCallbackSyncStreamController extends dart.mixin(_SyncStreamController Dispatch, _NoCallbacks) {}
3051 class _NotificationHandler extends core.Function {} 3051 let _NotificationHandler = dart.typedef('_NotificationHandler', () => dart.fun ctionType(dynamic, []));
3052 // Function _runGuarded: (() → dynamic) → Future<dynamic> 3052 // Function _runGuarded: (() → dynamic) → Future<dynamic>
3053 function _runGuarded(notificationHandler) { 3053 function _runGuarded(notificationHandler) {
3054 if (notificationHandler == null) 3054 if (notificationHandler == null)
3055 return null; 3055 return null;
3056 try { 3056 try {
3057 let result = notificationHandler(); 3057 let result = notificationHandler();
3058 if (dart.is(result, Future)) 3058 if (dart.is(result, Future))
3059 return dart.as(result, Future); 3059 return dart.as(result, Future);
3060 return null; 3060 return null;
3061 } catch (e) { 3061 } catch (e) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 let _EventSink$ = dart.generic(function(T) { 3144 let _EventSink$ = dart.generic(function(T) {
3145 class _EventSink extends core.Object {} 3145 class _EventSink extends core.Object {}
3146 return _EventSink; 3146 return _EventSink;
3147 }); 3147 });
3148 let _EventSink = _EventSink$(); 3148 let _EventSink = _EventSink$();
3149 let _EventDispatch$ = dart.generic(function(T) { 3149 let _EventDispatch$ = dart.generic(function(T) {
3150 class _EventDispatch extends core.Object {} 3150 class _EventDispatch extends core.Object {}
3151 return _EventDispatch; 3151 return _EventDispatch;
3152 }); 3152 });
3153 let _EventDispatch = _EventDispatch$(); 3153 let _EventDispatch = _EventDispatch$();
3154 class _EventGenerator extends core.Function {} 3154 let _EventGenerator = dart.typedef('_EventGenerator', () => dart.functionType( _PendingEvents, []));
3155 let _isUsed = Symbol('_isUsed'); 3155 let _isUsed = Symbol('_isUsed');
3156 let _GeneratedStreamImpl$ = dart.generic(function(T) { 3156 let _GeneratedStreamImpl$ = dart.generic(function(T) {
3157 class _GeneratedStreamImpl extends _StreamImpl$(T) { 3157 class _GeneratedStreamImpl extends _StreamImpl$(T) {
3158 _GeneratedStreamImpl(pending$) { 3158 _GeneratedStreamImpl(pending$) {
3159 this[_pending] = pending$; 3159 this[_pending] = pending$;
3160 this[_isUsed] = false; 3160 this[_isUsed] = false;
3161 super._StreamImpl(); 3161 super._StreamImpl();
3162 } 3162 }
3163 [_createSubscription](onData, onError, onDone, cancelOnError) { 3163 [_createSubscription](onData, onError, onDone, cancelOnError) {
3164 if (this[_isUsed]) 3164 if (this[_isUsed])
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 clear() { 3246 clear() {
3247 if (this.isScheduled) 3247 if (this.isScheduled)
3248 this.cancelSchedule(); 3248 this.cancelSchedule();
3249 this[_iterator] = null; 3249 this[_iterator] = null;
3250 } 3250 }
3251 } 3251 }
3252 return _IterablePendingEvents; 3252 return _IterablePendingEvents;
3253 }); 3253 });
3254 let _IterablePendingEvents = _IterablePendingEvents$(); 3254 let _IterablePendingEvents = _IterablePendingEvents$();
3255 let _DataHandler$ = dart.generic(function(T) { 3255 let _DataHandler$ = dart.generic(function(T) {
3256 class _DataHandler extends core.Function {} 3256 let _DataHandler = dart.typedef('_DataHandler', () => dart.functionType(dart .void, [T]));
3257 return _DataHandler; 3257 return _DataHandler;
3258 }); 3258 });
3259 let _DataHandler = _DataHandler$(); 3259 let _DataHandler = _DataHandler$();
3260 class _DoneHandler extends core.Function {} 3260 let _DoneHandler = dart.typedef('_DoneHandler', () => dart.functionType(dart.v oid, []));
3261 // Function _nullDataHandler: (dynamic) → void 3261 // Function _nullDataHandler: (dynamic) → void
3262 function _nullDataHandler(value) { 3262 function _nullDataHandler(value) {
3263 } 3263 }
3264 // Function _nullErrorHandler: (dynamic, [StackTrace]) → void 3264 // Function _nullErrorHandler: (dynamic, [StackTrace]) → void
3265 function _nullErrorHandler(error, stackTrace) { 3265 function _nullErrorHandler(error, stackTrace) {
3266 if (stackTrace === void 0) 3266 if (stackTrace === void 0)
3267 stackTrace = null; 3267 stackTrace = null;
3268 Zone.current.handleUncaughtError(error, stackTrace); 3268 Zone.current.handleUncaughtError(error, stackTrace);
3269 } 3269 }
3270 // Function _nullDoneHandler: () → void 3270 // Function _nullDoneHandler: () → void
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3356 this[_next] = this[_previous] = this; 3356 this[_next] = this[_previous] = this;
3357 } 3357 }
3358 [_insertBefore](newNext) { 3358 [_insertBefore](newNext) {
3359 let newPrevious = newNext[_previous]; 3359 let newPrevious = newNext[_previous];
3360 newPrevious[_next] = this; 3360 newPrevious[_next] = this;
3361 newNext[_previous] = this[_previous]; 3361 newNext[_previous] = this[_previous];
3362 this[_previous][_next] = newNext; 3362 this[_previous][_next] = newNext;
3363 this[_previous] = newPrevious; 3363 this[_previous] = newPrevious;
3364 } 3364 }
3365 } 3365 }
3366 class _broadcastCallback extends core.Function {} 3366 let _broadcastCallback = dart.typedef('_broadcastCallback', () => dart.functio nType(dart.void, [StreamSubscription]));
3367 let _schedule = Symbol('_schedule'); 3367 let _schedule = Symbol('_schedule');
3368 let _isSent = Symbol('_isSent'); 3368 let _isSent = Symbol('_isSent');
3369 let _DONE_SENT = Symbol('_DONE_SENT'); 3369 let _DONE_SENT = Symbol('_DONE_SENT');
3370 let _isScheduled = Symbol('_isScheduled'); 3370 let _isScheduled = Symbol('_isScheduled');
3371 let _SCHEDULED = Symbol('_SCHEDULED'); 3371 let _SCHEDULED = Symbol('_SCHEDULED');
3372 let _PAUSED = Symbol('_PAUSED'); 3372 let _PAUSED = Symbol('_PAUSED');
3373 let _DoneStreamSubscription$ = dart.generic(function(T) { 3373 let _DoneStreamSubscription$ = dart.generic(function(T) {
3374 class _DoneStreamSubscription extends core.Object { 3374 class _DoneStreamSubscription extends core.Object {
3375 _DoneStreamSubscription(onDone$) { 3375 _DoneStreamSubscription(onDone$) {
3376 this[_onDone] = onDone$; 3376 this[_onDone] = onDone$;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
3811 this[_stream][_handleError](error, stackTrace, this); 3811 this[_stream][_handleError](error, stackTrace, this);
3812 } 3812 }
3813 [_handleDone]() { 3813 [_handleDone]() {
3814 this[_stream][_handleDone](this); 3814 this[_stream][_handleDone](this);
3815 } 3815 }
3816 } 3816 }
3817 return _ForwardingStreamSubscription; 3817 return _ForwardingStreamSubscription;
3818 }); 3818 });
3819 let _ForwardingStreamSubscription = _ForwardingStreamSubscription$(); 3819 let _ForwardingStreamSubscription = _ForwardingStreamSubscription$();
3820 let _Predicate$ = dart.generic(function(T) { 3820 let _Predicate$ = dart.generic(function(T) {
3821 class _Predicate extends core.Function {} 3821 let _Predicate = dart.typedef('_Predicate', () => dart.functionType(core.boo l, [T]));
3822 return _Predicate; 3822 return _Predicate;
3823 }); 3823 });
3824 let _Predicate = _Predicate$(); 3824 let _Predicate = _Predicate$();
3825 // Function _addErrorWithReplacement: (_EventSink<dynamic>, dynamic, dynamic) → void 3825 // Function _addErrorWithReplacement: (_EventSink<dynamic>, dynamic, dynamic) → void
3826 function _addErrorWithReplacement(sink, error, stackTrace) { 3826 function _addErrorWithReplacement(sink, error, stackTrace) {
3827 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core .StackTrace)); 3827 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core .StackTrace));
3828 if (replacement != null) { 3828 if (replacement != null) {
3829 error = _nonNullError(replacement.error); 3829 error = _nonNullError(replacement.error);
3830 stackTrace = replacement.stackTrace; 3830 stackTrace = replacement.stackTrace;
3831 } 3831 }
(...skipping 18 matching lines...) Expand all
3850 3850
3851 if (satisfies) { 3851 if (satisfies) {
3852 sink[_add](inputEvent); 3852 sink[_add](inputEvent);
3853 } 3853 }
3854 } 3854 }
3855 } 3855 }
3856 return _WhereStream; 3856 return _WhereStream;
3857 }); 3857 });
3858 let _WhereStream = _WhereStream$(); 3858 let _WhereStream = _WhereStream$();
3859 let _Transformation$ = dart.generic(function(S, T) { 3859 let _Transformation$ = dart.generic(function(S, T) {
3860 class _Transformation extends core.Function {} 3860 let _Transformation = dart.typedef('_Transformation', () => dart.functionTyp e(T, [S]));
3861 return _Transformation; 3861 return _Transformation;
3862 }); 3862 });
3863 let _Transformation = _Transformation$(); 3863 let _Transformation = _Transformation$();
3864 let _transform = Symbol('_transform'); 3864 let _transform = Symbol('_transform');
3865 let _MapStream$ = dart.generic(function(S, T) { 3865 let _MapStream$ = dart.generic(function(S, T) {
3866 class _MapStream extends _ForwardingStream$(S, T) { 3866 class _MapStream extends _ForwardingStream$(S, T) {
3867 _MapStream(source, transform) { 3867 _MapStream(source, transform) {
3868 this[_transform] = transform; 3868 this[_transform] = transform;
3869 super._ForwardingStream(source); 3869 super._ForwardingStream(source);
3870 } 3870 }
(...skipping 28 matching lines...) Expand all
3899 } catch (e) { 3899 } catch (e) {
3900 let s = dart.stackTrace(e); 3900 let s = dart.stackTrace(e);
3901 _addErrorWithReplacement(sink, e, s); 3901 _addErrorWithReplacement(sink, e, s);
3902 } 3902 }
3903 3903
3904 } 3904 }
3905 } 3905 }
3906 return _ExpandStream; 3906 return _ExpandStream;
3907 }); 3907 });
3908 let _ExpandStream = _ExpandStream$(); 3908 let _ExpandStream = _ExpandStream$();
3909 class _ErrorTest extends core.Function {} 3909 let _ErrorTest = dart.typedef('_ErrorTest', () => dart.functionType(core.bool, [dynamic]));
3910 let _HandleErrorStream$ = dart.generic(function(T) { 3910 let _HandleErrorStream$ = dart.generic(function(T) {
3911 class _HandleErrorStream extends _ForwardingStream$(T, T) { 3911 class _HandleErrorStream extends _ForwardingStream$(T, T) {
3912 _HandleErrorStream(source, onError, test) { 3912 _HandleErrorStream(source, onError, test) {
3913 this[_transform] = onError; 3913 this[_transform] = onError;
3914 this[_test] = test; 3914 this[_test] = test;
3915 super._ForwardingStream(source); 3915 super._ForwardingStream(source);
3916 } 3916 }
3917 [_handleError](error, stackTrace, sink) { 3917 [_handleError](error, stackTrace, sink) {
3918 let matches = true; 3918 let matches = true;
3919 if (this[_test] != null) { 3919 if (this[_test] != null) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4041 if (!dart.notNull(satisfies)) { 4041 if (!dart.notNull(satisfies)) {
4042 this[_hasFailed] = true; 4042 this[_hasFailed] = true;
4043 sink[_add](inputEvent); 4043 sink[_add](inputEvent);
4044 } 4044 }
4045 } 4045 }
4046 } 4046 }
4047 return _SkipWhileStream; 4047 return _SkipWhileStream;
4048 }); 4048 });
4049 let _SkipWhileStream = _SkipWhileStream$(); 4049 let _SkipWhileStream = _SkipWhileStream$();
4050 let _Equality$ = dart.generic(function(T) { 4050 let _Equality$ = dart.generic(function(T) {
4051 class _Equality extends core.Function {} 4051 let _Equality = dart.typedef('_Equality', () => dart.functionType(core.bool, [T, T]));
4052 return _Equality; 4052 return _Equality;
4053 }); 4053 });
4054 let _Equality = _Equality$(); 4054 let _Equality = _Equality$();
4055 let _SENTINEL = Symbol('_SENTINEL'); 4055 let _SENTINEL = Symbol('_SENTINEL');
4056 let _equals = Symbol('_equals'); 4056 let _equals = Symbol('_equals');
4057 let _DistinctStream$ = dart.generic(function(T) { 4057 let _DistinctStream$ = dart.generic(function(T) {
4058 class _DistinctStream extends _ForwardingStream$(T, T) { 4058 class _DistinctStream extends _ForwardingStream$(T, T) {
4059 _DistinctStream(source, equals) { 4059 _DistinctStream(source, equals) {
4060 this[_previous] = _DistinctStream[_SENTINEL]; 4060 this[_previous] = _DistinctStream[_SENTINEL];
4061 this[_equals] = equals; 4061 this[_equals] = equals;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4197 let s = dart.stackTrace(e); 4197 let s = dart.stackTrace(e);
4198 this[_addError](e, s); 4198 this[_addError](e, s);
4199 } 4199 }
4200 4200
4201 } 4201 }
4202 } 4202 }
4203 return _SinkTransformerStreamSubscription; 4203 return _SinkTransformerStreamSubscription;
4204 }); 4204 });
4205 let _SinkTransformerStreamSubscription = _SinkTransformerStreamSubscription$() ; 4205 let _SinkTransformerStreamSubscription = _SinkTransformerStreamSubscription$() ;
4206 let _SinkMapper$ = dart.generic(function(S, T) { 4206 let _SinkMapper$ = dart.generic(function(S, T) {
4207 class _SinkMapper extends core.Function {} 4207 let _SinkMapper = dart.typedef('_SinkMapper', () => dart.functionType(EventS ink$(S), [EventSink$(T)]));
4208 return _SinkMapper; 4208 return _SinkMapper;
4209 }); 4209 });
4210 let _SinkMapper = _SinkMapper$(); 4210 let _SinkMapper = _SinkMapper$();
4211 let _sinkMapper = Symbol('_sinkMapper'); 4211 let _sinkMapper = Symbol('_sinkMapper');
4212 let _StreamSinkTransformer$ = dart.generic(function(S, T) { 4212 let _StreamSinkTransformer$ = dart.generic(function(S, T) {
4213 class _StreamSinkTransformer extends core.Object { 4213 class _StreamSinkTransformer extends core.Object {
4214 _StreamSinkTransformer(sinkMapper) { 4214 _StreamSinkTransformer(sinkMapper) {
4215 this[_sinkMapper] = sinkMapper; 4215 this[_sinkMapper] = sinkMapper;
4216 } 4216 }
4217 bind(stream) { 4217 bind(stream) {
(...skipping 20 matching lines...) Expand all
4238 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null; 4238 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
4239 cancelOnError = core.identical(true, cancelOnError); 4239 cancelOnError = core.identical(true, cancelOnError);
4240 let subscription = new _SinkTransformerStreamSubscription(this[_stream], dart.as(this[_sinkMapper], _SinkMapper), onData, onError, onDone, cancelOnError ); 4240 let subscription = new _SinkTransformerStreamSubscription(this[_stream], dart.as(this[_sinkMapper], _SinkMapper), onData, onError, onDone, cancelOnError );
4241 return subscription; 4241 return subscription;
4242 } 4242 }
4243 } 4243 }
4244 return _BoundSinkStream; 4244 return _BoundSinkStream;
4245 }); 4245 });
4246 let _BoundSinkStream = _BoundSinkStream$(); 4246 let _BoundSinkStream = _BoundSinkStream$();
4247 let _TransformDataHandler$ = dart.generic(function(S, T) { 4247 let _TransformDataHandler$ = dart.generic(function(S, T) {
4248 class _TransformDataHandler extends core.Function {} 4248 let _TransformDataHandler = dart.typedef('_TransformDataHandler', () => dart .functionType(dart.void, [S, EventSink$(T)]));
4249 return _TransformDataHandler; 4249 return _TransformDataHandler;
4250 }); 4250 });
4251 let _TransformDataHandler = _TransformDataHandler$(); 4251 let _TransformDataHandler = _TransformDataHandler$();
4252 let _TransformErrorHandler$ = dart.generic(function(T) { 4252 let _TransformErrorHandler$ = dart.generic(function(T) {
4253 class _TransformErrorHandler extends core.Function {} 4253 let _TransformErrorHandler = dart.typedef('_TransformErrorHandler', () => da rt.functionType(dart.void, [core.Object, core.StackTrace, EventSink$(T)]));
4254 return _TransformErrorHandler; 4254 return _TransformErrorHandler;
4255 }); 4255 });
4256 let _TransformErrorHandler = _TransformErrorHandler$(); 4256 let _TransformErrorHandler = _TransformErrorHandler$();
4257 let _TransformDoneHandler$ = dart.generic(function(T) { 4257 let _TransformDoneHandler$ = dart.generic(function(T) {
4258 class _TransformDoneHandler extends core.Function {} 4258 let _TransformDoneHandler = dart.typedef('_TransformDoneHandler', () => dart .functionType(dart.void, [EventSink$(T)]));
4259 return _TransformDoneHandler; 4259 return _TransformDoneHandler;
4260 }); 4260 });
4261 let _TransformDoneHandler = _TransformDoneHandler$(); 4261 let _TransformDoneHandler = _TransformDoneHandler$();
4262 let _HandlerEventSink$ = dart.generic(function(S, T) { 4262 let _HandlerEventSink$ = dart.generic(function(S, T) {
4263 class _HandlerEventSink extends core.Object { 4263 class _HandlerEventSink extends core.Object {
4264 _HandlerEventSink(handleData$, handleError$, handleDone$, sink$) { 4264 _HandlerEventSink(handleData$, handleError$, handleDone$, sink$) {
4265 this[_handleData] = handleData$; 4265 this[_handleData] = handleData$;
4266 this[_handleError] = handleError$; 4266 this[_handleError] = handleError$;
4267 this[_handleDone] = handleDone$; 4267 this[_handleDone] = handleDone$;
4268 this[_sink] = sink$; 4268 this[_sink] = sink$;
(...skipping 18 matching lines...) Expand all
4287 let _defaultHandleError = Symbol('_defaultHandleError'); 4287 let _defaultHandleError = Symbol('_defaultHandleError');
4288 let _defaultHandleDone = Symbol('_defaultHandleDone'); 4288 let _defaultHandleDone = Symbol('_defaultHandleDone');
4289 let _StreamHandlerTransformer$ = dart.generic(function(S, T) { 4289 let _StreamHandlerTransformer$ = dart.generic(function(S, T) {
4290 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) { 4290 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) {
4291 _StreamHandlerTransformer(opts) { 4291 _StreamHandlerTransformer(opts) {
4292 let handleData = opts && 'handleData' in opts ? opts.handleData : null; 4292 let handleData = opts && 'handleData' in opts ? opts.handleData : null;
4293 let handleError = opts && 'handleError' in opts ? opts.handleError : nul l; 4293 let handleError = opts && 'handleError' in opts ? opts.handleError : nul l;
4294 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null; 4294 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null;
4295 super._StreamSinkTransformer(dart.as((outputSink) => { 4295 super._StreamSinkTransformer(dart.as((outputSink) => {
4296 if (handleData == null) 4296 if (handleData == null)
4297 handleData = dart.as(_StreamHandlerTransformer[_defaultHandleData], dart.throw_("Unimplemented type (S, EventSink<T>) → void")); 4297 handleData = dart.as(_StreamHandlerTransformer[_defaultHandleData], dart.functionType(dart.void, [S, EventSink$(T)]));
4298 if (handleError == null) 4298 if (handleError == null)
4299 handleError = dart.as(_StreamHandlerTransformer[_defaultHandleError] , dart.throw_("Unimplemented type (Object, StackTrace, EventSink<T>) → void")); 4299 handleError = dart.as(_StreamHandlerTransformer[_defaultHandleError] , dart.functionType(dart.void, [core.Object, core.StackTrace, EventSink$(T)]));
4300 if (handleDone == null) 4300 if (handleDone == null)
4301 handleDone = _StreamHandlerTransformer[_defaultHandleDone]; 4301 handleDone = _StreamHandlerTransformer[_defaultHandleDone];
4302 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD one, outputSink); 4302 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD one, outputSink);
4303 }, _SinkMapper)); 4303 }, _SinkMapper));
4304 } 4304 }
4305 bind(stream) { 4305 bind(stream) {
4306 return super.bind(stream); 4306 return super.bind(stream);
4307 } 4307 }
4308 static [_defaultHandleData](data, sink) { 4308 static [_defaultHandleData](data, sink) {
4309 sink.add(data); 4309 sink.add(data);
4310 } 4310 }
4311 static [_defaultHandleError](error, stackTrace, sink) { 4311 static [_defaultHandleError](error, stackTrace, sink) {
4312 sink.addError(error); 4312 sink.addError(error);
4313 } 4313 }
4314 static [_defaultHandleDone](sink) { 4314 static [_defaultHandleDone](sink) {
4315 sink.close(); 4315 sink.close();
4316 } 4316 }
4317 } 4317 }
4318 return _StreamHandlerTransformer; 4318 return _StreamHandlerTransformer;
4319 }); 4319 });
4320 let _StreamHandlerTransformer = _StreamHandlerTransformer$(); 4320 let _StreamHandlerTransformer = _StreamHandlerTransformer$();
4321 let _SubscriptionTransformer$ = dart.generic(function(S, T) { 4321 let _SubscriptionTransformer$ = dart.generic(function(S, T) {
4322 class _SubscriptionTransformer extends core.Function {} 4322 let _SubscriptionTransformer = dart.typedef('_SubscriptionTransformer', () = > dart.functionType(StreamSubscription$(T), [Stream$(S), core.bool]));
4323 return _SubscriptionTransformer; 4323 return _SubscriptionTransformer;
4324 }); 4324 });
4325 let _SubscriptionTransformer = _SubscriptionTransformer$(); 4325 let _SubscriptionTransformer = _SubscriptionTransformer$();
4326 let _transformer = Symbol('_transformer'); 4326 let _transformer = Symbol('_transformer');
4327 let _StreamSubscriptionTransformer$ = dart.generic(function(S, T) { 4327 let _StreamSubscriptionTransformer$ = dart.generic(function(S, T) {
4328 class _StreamSubscriptionTransformer extends core.Object { 4328 class _StreamSubscriptionTransformer extends core.Object {
4329 _StreamSubscriptionTransformer(transformer$) { 4329 _StreamSubscriptionTransformer(transformer$) {
4330 this[_transformer] = transformer$; 4330 this[_transformer] = transformer$;
4331 } 4331 }
4332 bind(stream) { 4332 bind(stream) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4364 Timer(duration, callback) { 4364 Timer(duration, callback) {
4365 if (dart.equals(Zone.current, Zone.ROOT)) { 4365 if (dart.equals(Zone.current, Zone.ROOT)) {
4366 return Zone.current.createTimer(duration, callback); 4366 return Zone.current.createTimer(duration, callback);
4367 } 4367 }
4368 return Zone.current.createTimer(duration, Zone.current.bindCallback(callba ck, {runGuarded: true})); 4368 return Zone.current.createTimer(duration, Zone.current.bindCallback(callba ck, {runGuarded: true}));
4369 } 4369 }
4370 periodic(duration, callback) { 4370 periodic(duration, callback) {
4371 if (dart.equals(Zone.current, Zone.ROOT)) { 4371 if (dart.equals(Zone.current, Zone.ROOT)) {
4372 return Zone.current.createPeriodicTimer(duration, callback); 4372 return Zone.current.createPeriodicTimer(duration, callback);
4373 } 4373 }
4374 return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bin dUnaryCallback(callback, {runGuarded: true}), dart.throw_("Unimplemented type (T imer) → void"))); 4374 return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bin dUnaryCallback(callback, {runGuarded: true}), dart.functionType(dart.void, [Time r])));
4375 } 4375 }
4376 static run(callback) { 4376 static run(callback) {
4377 new Timer(core.Duration.ZERO, callback); 4377 new Timer(core.Duration.ZERO, callback);
4378 } 4378 }
4379 static [_createTimer](duration, callback) { 4379 static [_createTimer](duration, callback) {
4380 let milliseconds = duration.inMilliseconds; 4380 let milliseconds = duration.inMilliseconds;
4381 if (dart.notNull(milliseconds) < 0) 4381 if (dart.notNull(milliseconds) < 0)
4382 milliseconds = 0; 4382 milliseconds = 0;
4383 return new _isolate_helper.TimerImpl(milliseconds, callback); 4383 return new _isolate_helper.TimerImpl(milliseconds, callback);
4384 } 4384 }
4385 static [_createPeriodicTimer](duration, callback) { 4385 static [_createPeriodicTimer](duration, callback) {
4386 let milliseconds = duration.inMilliseconds; 4386 let milliseconds = duration.inMilliseconds;
4387 if (dart.notNull(milliseconds) < 0) 4387 if (dart.notNull(milliseconds) < 0)
4388 milliseconds = 0; 4388 milliseconds = 0;
4389 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback); 4389 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback);
4390 } 4390 }
4391 } 4391 }
4392 dart.defineNamedConstructor(Timer, 'periodic'); 4392 dart.defineNamedConstructor(Timer, 'periodic');
4393 class ZoneCallback extends core.Function {} 4393 let ZoneCallback = dart.typedef('ZoneCallback', () => dart.functionType(dynami c, []));
4394 class ZoneUnaryCallback extends core.Function {} 4394 let ZoneUnaryCallback = dart.typedef('ZoneUnaryCallback', () => dart.functionT ype(dynamic, [dynamic]));
4395 class ZoneBinaryCallback extends core.Function {} 4395 let ZoneBinaryCallback = dart.typedef('ZoneBinaryCallback', () => dart.functio nType(dynamic, [dynamic, dynamic]));
4396 class HandleUncaughtErrorHandler extends core.Function {} 4396 let HandleUncaughtErrorHandler = dart.typedef('HandleUncaughtErrorHandler', () => dart.functionType(dynamic, [Zone, ZoneDelegate, Zone, dynamic, core.StackTra ce]));
4397 class RunHandler extends core.Function {} 4397 let RunHandler = dart.typedef('RunHandler', () => dart.functionType(dynamic, [ Zone, ZoneDelegate, Zone, dart.functionType(dynamic, [])]));
4398 class RunUnaryHandler extends core.Function {} 4398 let RunUnaryHandler = dart.typedef('RunUnaryHandler', () => dart.functionType( dynamic, [Zone, ZoneDelegate, Zone, dart.functionType(dynamic, [dynamic]), dynam ic]));
4399 class RunBinaryHandler extends core.Function {} 4399 let RunBinaryHandler = dart.typedef('RunBinaryHandler', () => dart.functionTyp e(dynamic, [Zone, ZoneDelegate, Zone, dart.functionType(dynamic, [dynamic, dynam ic]), dynamic, dynamic]));
4400 class RegisterCallbackHandler extends core.Function {} 4400 let RegisterCallbackHandler = dart.typedef('RegisterCallbackHandler', () => da rt.functionType(ZoneCallback, [Zone, ZoneDelegate, Zone, dart.functionType(dynam ic, [])]));
4401 class RegisterUnaryCallbackHandler extends core.Function {} 4401 let RegisterUnaryCallbackHandler = dart.typedef('RegisterUnaryCallbackHandler' , () => dart.functionType(ZoneUnaryCallback, [Zone, ZoneDelegate, Zone, dart.fun ctionType(dynamic, [dynamic])]));
4402 class RegisterBinaryCallbackHandler extends core.Function {} 4402 let RegisterBinaryCallbackHandler = dart.typedef('RegisterBinaryCallbackHandle r', () => dart.functionType(ZoneBinaryCallback, [Zone, ZoneDelegate, Zone, dart. functionType(dynamic, [dynamic, dynamic])]));
4403 class ErrorCallbackHandler extends core.Function {} 4403 let ErrorCallbackHandler = dart.typedef('ErrorCallbackHandler', () => dart.fun ctionType(AsyncError, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace])) ;
4404 class ScheduleMicrotaskHandler extends core.Function {} 4404 let ScheduleMicrotaskHandler = dart.typedef('ScheduleMicrotaskHandler', () => dart.functionType(dart.void, [Zone, ZoneDelegate, Zone, dart.functionType(dynami c, [])]));
4405 class CreateTimerHandler extends core.Function {} 4405 let CreateTimerHandler = dart.typedef('CreateTimerHandler', () => dart.functio nType(Timer, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.vo id, [])]));
4406 class CreatePeriodicTimerHandler extends core.Function {} 4406 let CreatePeriodicTimerHandler = dart.typedef('CreatePeriodicTimerHandler', () => dart.functionType(Timer, [Zone, ZoneDelegate, Zone, core.Duration, dart.func tionType(dart.void, [Timer])]));
4407 class PrintHandler extends core.Function {} 4407 let PrintHandler = dart.typedef('PrintHandler', () => dart.functionType(dart.v oid, [Zone, ZoneDelegate, Zone, core.String]));
4408 class ForkHandler extends core.Function {} 4408 let ForkHandler = dart.typedef('ForkHandler', () => dart.functionType(Zone, [Z one, ZoneDelegate, Zone, ZoneSpecification, core.Map]));
4409 class _ZoneFunction extends core.Object { 4409 class _ZoneFunction extends core.Object {
4410 _ZoneFunction(zone, func) { 4410 _ZoneFunction(zone, func) {
4411 this.zone = zone; 4411 this.zone = zone;
4412 this.function = func; 4412 this.function = func;
4413 } 4413 }
4414 } 4414 }
4415 class ZoneSpecification extends core.Object { 4415 class ZoneSpecification extends core.Object {
4416 ZoneSpecification(opts) { 4416 ZoneSpecification(opts) {
4417 return new _ZoneSpecification(opts); 4417 return new _ZoneSpecification(opts);
4418 } 4418 }
4419 from(other, opts) { 4419 from(other, opts) {
4420 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han dleUncaughtError : null; 4420 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han dleUncaughtError : null;
4421 let run = opts && 'run' in opts ? opts.run : null; 4421 let run = opts && 'run' in opts ? opts.run : null;
4422 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; 4422 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null;
4423 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; 4423 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null;
4424 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null; 4424 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null;
4425 let registerUnaryCallback = opts && 'registerUnaryCallback' in opts ? opts .registerUnaryCallback : null; 4425 let registerUnaryCallback = opts && 'registerUnaryCallback' in opts ? opts .registerUnaryCallback : null;
4426 let registerBinaryCallback = opts && 'registerBinaryCallback' in opts ? op ts.registerBinaryCallback : null; 4426 let registerBinaryCallback = opts && 'registerBinaryCallback' in opts ? op ts.registerBinaryCallback : null;
4427 let errorCallback = opts && 'errorCallback' in opts ? opts.errorCallback : null; 4427 let errorCallback = opts && 'errorCallback' in opts ? opts.errorCallback : null;
4428 let scheduleMicrotask = opts && 'scheduleMicrotask' in opts ? opts.schedul eMicrotask : null; 4428 let scheduleMicrotask = opts && 'scheduleMicrotask' in opts ? opts.schedul eMicrotask : null;
4429 let createTimer = opts && 'createTimer' in opts ? opts.createTimer : null; 4429 let createTimer = opts && 'createTimer' in opts ? opts.createTimer : null;
4430 let createPeriodicTimer = opts && 'createPeriodicTimer' in opts ? opts.cre atePeriodicTimer : null; 4430 let createPeriodicTimer = opts && 'createPeriodicTimer' in opts ? opts.cre atePeriodicTimer : null;
4431 let print = opts && 'print' in opts ? opts.print : null; 4431 let print = opts && 'print' in opts ? opts.print : null;
4432 let fork = opts && 'fork' in opts ? opts.fork : null; 4432 let fork = opts && 'fork' in opts ? opts.fork : null;
4433 return new ZoneSpecification({handleUncaughtError: dart.as(handleUncaughtE rror != null ? handleUncaughtError : other.handleUncaughtError, dart.throw_("Uni mplemented type (Zone, ZoneDelegate, Zone, dynamic, StackTrace) → dynamic")), ru n: dart.as(run != null ? run : other.run, dart.throw_("Unimplemented type (Zone, ZoneDelegate, Zone, () → dynamic) → dynamic")), runUnary: dart.as(runUnary != n ull ? runUnary : other.runUnary, dart.throw_("Unimplemented type (Zone, ZoneDele gate, Zone, (dynamic) → dynamic, dynamic) → dynamic")), runBinary: dart.as(runBi nary != null ? runBinary : other.runBinary, dart.throw_("Unimplemented type (Zon e, ZoneDelegate, Zone, (dynamic, dynamic) → dynamic, dynamic, dynamic) → dynamic ")), registerCallback: dart.as(registerCallback != null ? registerCallback : oth er.registerCallback, dart.throw_("Unimplemented type (Zone, ZoneDelegate, Zone, () → dynamic) → ZoneCallback")), registerUnaryCallback: dart.as(registerUnaryCal lback != null ? registerUnaryCallback : other.registerUnaryCallback, dart.throw_ ("Unimplemented type (Zone, ZoneDelegate, Zone, (dynamic) → dynamic) → ZoneUnary Callback")), registerBinaryCallback: dart.as(registerBinaryCallback != null ? re gisterBinaryCallback : other.registerBinaryCallback, dart.throw_("Unimplemented type (Zone, ZoneDelegate, Zone, (dynamic, dynamic) → dynamic) → ZoneBinaryCallba ck")), errorCallback: dart.as(errorCallback != null ? errorCallback : other.erro rCallback, dart.throw_("Unimplemented type (Zone, ZoneDelegate, Zone, Object, St ackTrace) → AsyncError")), scheduleMicrotask: dart.as(scheduleMicrotask != null ? scheduleMicrotask : other.scheduleMicrotask, dart.throw_("Unimplemented type ( Zone, ZoneDelegate, Zone, () → dynamic) → void")), createTimer: dart.as(createTi mer != null ? createTimer : other.createTimer, dart.throw_("Unimplemented type ( Zone, ZoneDelegate, Zone, Duration, () → void) → Timer")), createPeriodicTimer: dart.as(createPeriodicTimer != null ? createPeriodicTimer : other.createPeriodic Timer, dart.throw_("Unimplemented type (Zone, ZoneDelegate, Zone, Duration, (Tim er) → void) → Timer")), print: dart.as(print != null ? print : other.print, dart .throw_("Unimplemented type (Zone, ZoneDelegate, Zone, String) → void")), fork: dart.as(fork != null ? fork : other.fork, dart.throw_("Unimplemented type (Zone, ZoneDelegate, Zone, ZoneSpecification, Map<dynamic, dynamic>) → Zone"))}); 4433 return new ZoneSpecification({handleUncaughtError: dart.as(handleUncaughtE rror != null ? handleUncaughtError : other.handleUncaughtError, dart.functionTyp e(dynamic, [Zone, ZoneDelegate, Zone, dynamic, core.StackTrace])), run: dart.as( run != null ? run : other.run, dart.functionType(dynamic, [Zone, ZoneDelegate, Z one, dart.functionType(dynamic, [])])), runUnary: dart.as(runUnary != null ? run Unary : other.runUnary, dart.functionType(dynamic, [Zone, ZoneDelegate, Zone, da rt.functionType(dynamic, [dynamic]), dynamic])), runBinary: dart.as(runBinary != null ? runBinary : other.runBinary, dart.functionType(dynamic, [Zone, ZoneDeleg ate, Zone, dart.functionType(dynamic, [dynamic, dynamic]), dynamic, dynamic])), registerCallback: dart.as(registerCallback != null ? registerCallback : other.re gisterCallback, dart.functionType(ZoneCallback, [Zone, ZoneDelegate, Zone, dart. functionType(dynamic, [])])), registerUnaryCallback: dart.as(registerUnaryCallba ck != null ? registerUnaryCallback : other.registerUnaryCallback, dart.functionT ype(ZoneUnaryCallback, [Zone, ZoneDelegate, Zone, dart.functionType(dynamic, [dy namic])])), registerBinaryCallback: dart.as(registerBinaryCallback != null ? reg isterBinaryCallback : other.registerBinaryCallback, dart.functionType(ZoneBinary Callback, [Zone, ZoneDelegate, Zone, dart.functionType(dynamic, [dynamic, dynami c])])), errorCallback: dart.as(errorCallback != null ? errorCallback : other.err orCallback, dart.functionType(AsyncError, [Zone, ZoneDelegate, Zone, core.Object , core.StackTrace])), scheduleMicrotask: dart.as(scheduleMicrotask != null ? sch eduleMicrotask : other.scheduleMicrotask, dart.functionType(dart.void, [Zone, Zo neDelegate, Zone, dart.functionType(dynamic, [])])), createTimer: dart.as(create Timer != null ? createTimer : other.createTimer, dart.functionType(Timer, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.void, [])])), createP eriodicTimer: dart.as(createPeriodicTimer != null ? createPeriodicTimer : other. createPeriodicTimer, dart.functionType(Timer, [Zone, ZoneDelegate, Zone, core.Du ration, dart.functionType(dart.void, [Timer])])), print: dart.as(print != null ? print : other.print, dart.functionType(dart.void, [Zone, ZoneDelegate, Zone, co re.String])), fork: dart.as(fork != null ? fork : other.fork, dart.functionType( Zone, [Zone, ZoneDelegate, Zone, ZoneSpecification, core.Map]))});
4434 } 4434 }
4435 } 4435 }
4436 dart.defineNamedConstructor(ZoneSpecification, 'from'); 4436 dart.defineNamedConstructor(ZoneSpecification, 'from');
4437 class _ZoneSpecification extends core.Object { 4437 class _ZoneSpecification extends core.Object {
4438 _ZoneSpecification(opts) { 4438 _ZoneSpecification(opts) {
4439 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han dleUncaughtError : null; 4439 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han dleUncaughtError : null;
4440 let run = opts && 'run' in opts ? opts.run : null; 4440 let run = opts && 'run' in opts ? opts.run : null;
4441 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; 4441 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null;
4442 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; 4442 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null;
4443 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null; 4443 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
4850 // Function _rootCreateTimer: (Zone, ZoneDelegate, Zone, Duration, () → void) → Timer 4850 // Function _rootCreateTimer: (Zone, ZoneDelegate, Zone, Duration, () → void) → Timer
4851 function _rootCreateTimer(self, parent, zone, duration, callback) { 4851 function _rootCreateTimer(self, parent, zone, duration, callback) {
4852 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) { 4852 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) {
4853 callback = zone.bindCallback(callback); 4853 callback = zone.bindCallback(callback);
4854 } 4854 }
4855 return Timer[_createTimer](duration, callback); 4855 return Timer[_createTimer](duration, callback);
4856 } 4856 }
4857 // Function _rootCreatePeriodicTimer: (Zone, ZoneDelegate, Zone, Duration, (Ti mer) → void) → Timer 4857 // Function _rootCreatePeriodicTimer: (Zone, ZoneDelegate, Zone, Duration, (Ti mer) → void) → Timer
4858 function _rootCreatePeriodicTimer(self, parent, zone, duration, callback) { 4858 function _rootCreatePeriodicTimer(self, parent, zone, duration, callback) {
4859 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) { 4859 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) {
4860 callback = dart.as(zone.bindUnaryCallback(callback), dart.throw_("Unimplem ented type (Timer) → void")); 4860 callback = dart.as(zone.bindUnaryCallback(callback), dart.functionType(dar t.void, [Timer]));
4861 } 4861 }
4862 return Timer[_createPeriodicTimer](duration, callback); 4862 return Timer[_createPeriodicTimer](duration, callback);
4863 } 4863 }
4864 // Function _rootPrint: (Zone, ZoneDelegate, Zone, String) → void 4864 // Function _rootPrint: (Zone, ZoneDelegate, Zone, String) → void
4865 function _rootPrint(self, parent, zone, line) { 4865 function _rootPrint(self, parent, zone, line) {
4866 _internal.printToConsole(line); 4866 _internal.printToConsole(line);
4867 } 4867 }
4868 // Function _printToZone: (String) → void 4868 // Function _printToZone: (String) → void
4869 function _printToZone(line) { 4869 function _printToZone(line) {
4870 Zone.current.print(line); 4870 Zone.current.print(line);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
5114 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; 5114 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null;
5115 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci fication : null; 5115 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci fication : null;
5116 let onError = opts && 'onError' in opts ? opts.onError : null; 5116 let onError = opts && 'onError' in opts ? opts.onError : null;
5117 let errorHandler = null; 5117 let errorHandler = null;
5118 if (onError != null) { 5118 if (onError != null) {
5119 errorHandler = (self, parent, zone, error, stackTrace) => { 5119 errorHandler = (self, parent, zone, error, stackTrace) => {
5120 try { 5120 try {
5121 if (dart.is(onError, ZoneBinaryCallback)) { 5121 if (dart.is(onError, ZoneBinaryCallback)) {
5122 return self.parent.runBinary(onError, error, stackTrace); 5122 return self.parent.runBinary(onError, error, stackTrace);
5123 } 5123 }
5124 return self.parent.runUnary(dart.as(onError, dart.throw_("Unimplemente d type (dynamic) → dynamic")), error); 5124 return self.parent.runUnary(dart.as(onError, dart.functionType(dynamic , [dynamic])), error);
5125 } catch (e) { 5125 } catch (e) {
5126 let s = dart.stackTrace(e); 5126 let s = dart.stackTrace(e);
5127 if (core.identical(e, error)) { 5127 if (core.identical(e, error)) {
5128 return parent.handleUncaughtError(zone, error, stackTrace); 5128 return parent.handleUncaughtError(zone, error, stackTrace);
5129 } else { 5129 } else {
5130 return parent.handleUncaughtError(zone, e, s); 5130 return parent.handleUncaughtError(zone, e, s);
5131 } 5131 }
5132 } 5132 }
5133 5133
5134 }; 5134 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5193 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5193 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5194 exports.CreateTimerHandler = CreateTimerHandler; 5194 exports.CreateTimerHandler = CreateTimerHandler;
5195 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5195 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5196 exports.PrintHandler = PrintHandler; 5196 exports.PrintHandler = PrintHandler;
5197 exports.ForkHandler = ForkHandler; 5197 exports.ForkHandler = ForkHandler;
5198 exports.ZoneSpecification = ZoneSpecification; 5198 exports.ZoneSpecification = ZoneSpecification;
5199 exports.ZoneDelegate = ZoneDelegate; 5199 exports.ZoneDelegate = ZoneDelegate;
5200 exports.Zone = Zone; 5200 exports.Zone = Zone;
5201 exports.runZoned = runZoned; 5201 exports.runZoned = runZoned;
5202 })(async || (async = {})); 5202 })(async || (async = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698