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 _js_helper = dart.lazyImport(_js_helper); | 4 var _js_helper = dart.lazyImport(_js_helper); |
5 var _isolate_helper = dart.lazyImport(_isolate_helper); | 5 var _isolate_helper = dart.lazyImport(_isolate_helper); |
6 var collection = dart.import(collection); | 6 var collection = dart.import(collection); |
7 (function(exports, core, _internal, _js_helper, _isolate_helper, collection) { | 7 (function(exports, core, _internal, _js_helper, _isolate_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 let _add = Symbol('_add'); | 64 let _add = Symbol('_add'); |
65 let _closeUnchecked = Symbol('_closeUnchecked'); | 65 let _closeUnchecked = Symbol('_closeUnchecked'); |
66 let _addError = Symbol('_addError'); | 66 let _addError = Symbol('_addError'); |
67 let _completeError = Symbol('_completeError'); | 67 let _completeError = Symbol('_completeError'); |
68 let _complete = Symbol('_complete'); | 68 let _complete = Symbol('_complete'); |
69 let _sink = Symbol('_sink'); | 69 let _sink = Symbol('_sink'); |
70 let Stream$ = dart.generic(function(T) { | 70 let Stream$ = dart.generic(function(T) { |
71 class Stream extends core.Object { | 71 class Stream extends core.Object { |
72 Stream() { | 72 Stream() { |
73 } | 73 } |
74 fromFuture(future) { | 74 static fromFuture(future) { |
75 let controller = dart.as(new (StreamController$(T))({sync: true}), _Stre
amController$(T)); | 75 let controller = dart.as(StreamController$(T).new({sync: true}), _Stream
Controller$(T)); |
76 future.then(dart.fn(value => { | 76 future.then(dart.fn(value => { |
77 controller[_add](dart.as(value, T)); | 77 controller[_add](dart.as(value, T)); |
78 controller[_closeUnchecked](); | 78 controller[_closeUnchecked](); |
79 }), {onError: dart.fn((error, stackTrace) => { | 79 }), {onError: dart.fn((error, stackTrace) => { |
80 controller[_addError](error, dart.as(stackTrace, core.StackTrace)); | 80 controller[_addError](error, dart.as(stackTrace, core.StackTrace)); |
81 controller[_closeUnchecked](); | 81 controller[_closeUnchecked](); |
82 })}); | 82 })}); |
83 return controller.stream; | 83 return controller.stream; |
84 } | 84 } |
85 fromIterable(data) { | 85 static fromIterable(data) { |
86 return new (_GeneratedStreamImpl$(T))(dart.fn(() => new (_IterablePendin
gEvents$(T))(data), _IterablePendingEvents$(T), [])); | 86 return new (_GeneratedStreamImpl$(T))(dart.fn(() => new (_IterablePendin
gEvents$(T))(data), _IterablePendingEvents$(T), [])); |
87 } | 87 } |
88 periodic(period, computation) { | 88 static periodic(period, computation) { |
89 if (computation === void 0) | 89 if (computation === void 0) |
90 computation = null; | 90 computation = null; |
91 if (computation == null) | 91 if (computation == null) |
92 computation = dart.fn(i => null, dart.bottom, [core.Object]); | 92 computation = dart.fn(i => null, dart.bottom, [core.Object]); |
93 let timer = null; | 93 let timer = null; |
94 let computationCount = 0; | 94 let computationCount = 0; |
95 let controller = null; | 95 let controller = null; |
96 let watch = new core.Stopwatch(); | 96 let watch = new core.Stopwatch(); |
97 let sendEvent = () => { | 97 let sendEvent = () => { |
98 watch.reset(); | 98 watch.reset(); |
99 let data = computation((() => { | 99 let data = computation((() => { |
100 let x = computationCount; | 100 let x = computationCount; |
101 computationCount = dart.notNull(x) + 1; | 101 computationCount = dart.notNull(x) + 1; |
102 return x; | 102 return x; |
103 })()); | 103 })()); |
104 controller.add(data); | 104 controller.add(data); |
105 }; | 105 }; |
106 dart.fn(sendEvent, dart.void, []); | 106 dart.fn(sendEvent, dart.void, []); |
107 let startPeriodicTimer = () => { | 107 let startPeriodicTimer = () => { |
108 dart.assert(timer == null); | 108 dart.assert(timer == null); |
109 timer = new Timer.periodic(period, dart.fn(timer => { | 109 timer = Timer.periodic(period, dart.fn(timer => { |
110 sendEvent(); | 110 sendEvent(); |
111 }, core.Object, [Timer])); | 111 }, core.Object, [Timer])); |
112 }; | 112 }; |
113 dart.fn(startPeriodicTimer, dart.void, []); | 113 dart.fn(startPeriodicTimer, dart.void, []); |
114 controller = new (StreamController$(T))({sync: true, onListen: dart.fn((
) => { | 114 controller = StreamController$(T).new({sync: true, onListen: dart.fn(()
=> { |
115 watch.start(); | 115 watch.start(); |
116 startPeriodicTimer(); | 116 startPeriodicTimer(); |
117 }), onPause: dart.fn(() => { | 117 }), onPause: dart.fn(() => { |
118 timer.cancel(); | 118 timer.cancel(); |
119 timer = null; | 119 timer = null; |
120 watch.stop(); | 120 watch.stop(); |
121 }), onResume: dart.fn(() => { | 121 }), onResume: dart.fn(() => { |
122 dart.assert(timer == null); | 122 dart.assert(timer == null); |
123 let elapsed = watch.elapsed; | 123 let elapsed = watch.elapsed; |
124 watch.start(); | 124 watch.start(); |
125 timer = new Timer(period['-'](elapsed), dart.fn(() => { | 125 timer = Timer.new(period['-'](elapsed), dart.fn(() => { |
126 timer = null; | 126 timer = null; |
127 startPeriodicTimer(); | 127 startPeriodicTimer(); |
128 sendEvent(); | 128 sendEvent(); |
129 })); | 129 })); |
130 }), onCancel: dart.fn(() => { | 130 }), onCancel: dart.fn(() => { |
131 if (timer != null) | 131 if (timer != null) |
132 timer.cancel(); | 132 timer.cancel(); |
133 timer = null; | 133 timer = null; |
134 })}); | 134 })}); |
135 return controller.stream; | 135 return controller.stream; |
136 } | 136 } |
137 eventTransformed(source, mapSink) { | 137 static eventTransformed(source, mapSink) { |
138 return new (_BoundSinkStream$(core.Object, T))(source, dart.as(mapSink,
_SinkMapper)); | 138 return new (_BoundSinkStream$(core.Object, T))(source, dart.as(mapSink,
_SinkMapper)); |
139 } | 139 } |
140 get isBroadcast() { | 140 get isBroadcast() { |
141 return false; | 141 return false; |
142 } | 142 } |
143 asBroadcastStream(opts) { | 143 asBroadcastStream(opts) { |
144 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 144 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
145 dart.as(onListen, dart.functionType(dart.void, [StreamSubscription$(T)])
); | 145 dart.as(onListen, dart.functionType(dart.void, [StreamSubscription$(T)])
); |
146 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 146 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
147 dart.as(onCancel, dart.functionType(dart.void, [StreamSubscription$(T)])
); | 147 dart.as(onCancel, dart.functionType(dart.void, [StreamSubscription$(T)])
); |
(...skipping 30 matching lines...) Expand all Loading... |
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 }).bind(this); | 185 }).bind(this); |
186 dart.fn(onListen, dart.void, []); | 186 dart.fn(onListen, dart.void, []); |
187 if (this.isBroadcast) { | 187 if (this.isBroadcast) { |
188 controller = new StreamController.broadcast({onListen: onListen, onCan
cel: 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 = new StreamController({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(); |
198 }), sync: true}); | 198 }), sync: true}); |
199 } | 199 } |
200 return controller.stream; | 200 return controller.stream; |
201 } | 201 } |
202 asyncExpand(convert) { | 202 asyncExpand(convert) { |
(...skipping 15 matching lines...) Expand all Loading... |
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 }).bind(this); | 225 }).bind(this); |
226 dart.fn(onListen, dart.void, []); | 226 dart.fn(onListen, dart.void, []); |
227 if (this.isBroadcast) { | 227 if (this.isBroadcast) { |
228 controller = new StreamController.broadcast({onListen: onListen, onCan
cel: 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 = new StreamController({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(); |
238 }), sync: true}); | 238 }), sync: true}); |
239 } | 239 } |
240 return controller.stream; | 240 return controller.stream; |
241 } | 241 } |
242 handleError(onError, opts) { | 242 handleError(onError, opts) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 let future = new (_Future$(core.List$(T)))(); | 417 let future = new (_Future$(core.List$(T)))(); |
418 this.listen(dart.fn(data => { | 418 this.listen(dart.fn(data => { |
419 dart.as(data, T); | 419 dart.as(data, T); |
420 result[core.$add](data); | 420 result[core.$add](data); |
421 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 421 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
422 future[_complete](result); | 422 future[_complete](result); |
423 }), cancelOnError: true}); | 423 }), cancelOnError: true}); |
424 return future; | 424 return future; |
425 } | 425 } |
426 toSet() { | 426 toSet() { |
427 let result = new (core.Set$(T))(); | 427 let result = core.Set$(T).new(); |
428 let future = new (_Future$(core.Set$(T)))(); | 428 let future = new (_Future$(core.Set$(T)))(); |
429 this.listen(dart.fn(data => { | 429 this.listen(dart.fn(data => { |
430 dart.as(data, T); | 430 dart.as(data, T); |
431 result.add(data); | 431 result.add(data); |
432 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { | 432 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn(() => { |
433 future[_complete](result); | 433 future[_complete](result); |
434 }), cancelOnError: true}); | 434 }), cancelOnError: true}); |
435 return future; | 435 return future; |
436 } | 436 } |
437 drain(futureValue) { | 437 drain(futureValue) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 let subscription = null; | 643 let subscription = null; |
644 let elementIndex = 0; | 644 let elementIndex = 0; |
645 subscription = this.listen(dart.fn(value => { | 645 subscription = this.listen(dart.fn(value => { |
646 dart.as(value, T); | 646 dart.as(value, T); |
647 if (index == elementIndex) { | 647 if (index == elementIndex) { |
648 _cancelAndValue(subscription, future, value); | 648 _cancelAndValue(subscription, future, value); |
649 return; | 649 return; |
650 } | 650 } |
651 elementIndex = dart.notNull(elementIndex) + 1; | 651 elementIndex = dart.notNull(elementIndex) + 1; |
652 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn((() => { | 652 }, core.Object, [T]), {onError: dart.bind(future, _completeError), onDon
e: dart.fn((() => { |
653 future[_completeError](new core.RangeError.index(index, this, "index
", null, elementIndex)); | 653 future[_completeError](core.RangeError.index(index, this, "index", n
ull, elementIndex)); |
654 }).bind(this)), cancelOnError: true}); | 654 }).bind(this)), cancelOnError: true}); |
655 return future; | 655 return future; |
656 } | 656 } |
657 timeout(timeLimit, opts) { | 657 timeout(timeLimit, opts) { |
658 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; | 658 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; |
659 dart.as(onTimeout, dart.functionType(dart.void, [EventSink])); | 659 dart.as(onTimeout, dart.functionType(dart.void, [EventSink])); |
660 let controller = null; | 660 let controller = null; |
661 let subscription = null; | 661 let subscription = null; |
662 let timer = null; | 662 let timer = null; |
663 let zone = null; | 663 let zone = null; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 controller = this.isBroadcast ? new _SyncBroadcastStreamController(onLis
ten, onCancel) : new _SyncStreamController(onListen, dart.fn(() => { | 711 controller = this.isBroadcast ? new _SyncBroadcastStreamController(onLis
ten, 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.defineNamedConstructor(Stream, 'fromFuture'); | |
722 dart.defineNamedConstructor(Stream, 'fromIterable'); | |
723 dart.defineNamedConstructor(Stream, 'periodic'); | |
724 dart.defineNamedConstructor(Stream, 'eventTransformed'); | |
725 dart.setSignature(Stream, { | 721 dart.setSignature(Stream, { |
726 constructors: () => ({ | 722 constructors: () => ({ |
727 Stream: [Stream$(T), []], | 723 Stream: [Stream$(T), []], |
728 fromFuture: [Stream$(T), [Future$(T)]], | 724 fromFuture: [Stream$(T), [Future$(T)]], |
729 fromIterable: [Stream$(T), [core.Iterable$(T)]], | 725 fromIterable: [Stream$(T), [core.Iterable$(T)]], |
730 periodic: [Stream$(T), [core.Duration], [dart.functionType(T, [core.int]
)]], | 726 periodic: [Stream$(T), [core.Duration], [dart.functionType(T, [core.int]
)]], |
731 eventTransformed: [Stream$(T), [Stream$(), dart.functionType(EventSink,
[EventSink$(T)])]] | 727 eventTransformed: [Stream$(T), [Stream$(), dart.functionType(EventSink,
[EventSink$(T)])]] |
732 }), | 728 }), |
733 methods: () => ({ | 729 methods: () => ({ |
734 asBroadcastStream: [Stream$(T), [], {onListen: dart.functionType(dart.vo
id, [StreamSubscription$(T)]), onCancel: dart.functionType(dart.void, [StreamSub
scription$(T)])}], | 730 asBroadcastStream: [Stream$(T), [], {onListen: dart.functionType(dart.vo
id, [StreamSubscription$(T)]), onCancel: dart.functionType(dart.void, [StreamSub
scription$(T)])}], |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 return `DeferredLoadException: '${this[_s]}'`; | 1799 return `DeferredLoadException: '${this[_s]}'`; |
1804 } | 1800 } |
1805 } | 1801 } |
1806 DeferredLoadException[dart.implements] = () => [core.Exception]; | 1802 DeferredLoadException[dart.implements] = () => [core.Exception]; |
1807 dart.setSignature(DeferredLoadException, { | 1803 dart.setSignature(DeferredLoadException, { |
1808 constructors: () => ({DeferredLoadException: [DeferredLoadException, [core.S
tring]]}) | 1804 constructors: () => ({DeferredLoadException: [DeferredLoadException, [core.S
tring]]}) |
1809 }); | 1805 }); |
1810 let _completeWithValue = Symbol('_completeWithValue'); | 1806 let _completeWithValue = Symbol('_completeWithValue'); |
1811 let Future$ = dart.generic(function(T) { | 1807 let Future$ = dart.generic(function(T) { |
1812 class Future extends core.Object { | 1808 class Future extends core.Object { |
1813 Future(computation) { | 1809 static new(computation) { |
1814 let result = new (_Future$(T))(); | 1810 let result = new (_Future$(T))(); |
1815 Timer.run(dart.fn(() => { | 1811 Timer.run(dart.fn(() => { |
1816 try { | 1812 try { |
1817 result[_complete](computation()); | 1813 result[_complete](computation()); |
1818 } catch (e) { | 1814 } catch (e) { |
1819 let s = dart.stackTrace(e); | 1815 let s = dart.stackTrace(e); |
1820 _completeWithErrorCallback(result, e, s); | 1816 _completeWithErrorCallback(result, e, s); |
1821 } | 1817 } |
1822 | 1818 |
1823 })); | 1819 })); |
1824 return dart.as(result, Future$(T)); | 1820 return dart.as(result, Future$(T)); |
1825 } | 1821 } |
1826 microtask(computation) { | 1822 static microtask(computation) { |
1827 let result = new (_Future$(T))(); | 1823 let result = new (_Future$(T))(); |
1828 scheduleMicrotask(dart.fn(() => { | 1824 scheduleMicrotask(dart.fn(() => { |
1829 try { | 1825 try { |
1830 result[_complete](computation()); | 1826 result[_complete](computation()); |
1831 } catch (e) { | 1827 } catch (e) { |
1832 let s = dart.stackTrace(e); | 1828 let s = dart.stackTrace(e); |
1833 _completeWithErrorCallback(result, e, s); | 1829 _completeWithErrorCallback(result, e, s); |
1834 } | 1830 } |
1835 | 1831 |
1836 })); | 1832 })); |
1837 return dart.as(result, Future$(T)); | 1833 return dart.as(result, Future$(T)); |
1838 } | 1834 } |
1839 sync(computation) { | 1835 static sync(computation) { |
1840 try { | 1836 try { |
1841 let result = computation(); | 1837 let result = computation(); |
1842 return new (Future$(T)).value(result); | 1838 return Future$(T).value(result); |
1843 } catch (error) { | 1839 } catch (error) { |
1844 let stackTrace = dart.stackTrace(error); | 1840 let stackTrace = dart.stackTrace(error); |
1845 return new (Future$(T)).error(error, stackTrace); | 1841 return Future$(T).error(error, stackTrace); |
1846 } | 1842 } |
1847 | 1843 |
1848 } | 1844 } |
1849 value(value) { | 1845 static value(value) { |
1850 if (value === void 0) | 1846 if (value === void 0) |
1851 value = null; | 1847 value = null; |
1852 return new (_Future$(T)).immediate(value); | 1848 return new (_Future$(T)).immediate(value); |
1853 } | 1849 } |
1854 error(error, stackTrace) { | 1850 static error(error, stackTrace) { |
1855 if (stackTrace === void 0) | 1851 if (stackTrace === void 0) |
1856 stackTrace = null; | 1852 stackTrace = null; |
1857 error = _nonNullError(error); | 1853 error = _nonNullError(error); |
1858 if (!dart.notNull(core.identical(Zone.current, _ROOT_ZONE))) { | 1854 if (!dart.notNull(core.identical(Zone.current, _ROOT_ZONE))) { |
1859 let replacement = Zone.current.errorCallback(error, stackTrace); | 1855 let replacement = Zone.current.errorCallback(error, stackTrace); |
1860 if (replacement != null) { | 1856 if (replacement != null) { |
1861 error = _nonNullError(replacement.error); | 1857 error = _nonNullError(replacement.error); |
1862 stackTrace = replacement.stackTrace; | 1858 stackTrace = replacement.stackTrace; |
1863 } | 1859 } |
1864 } | 1860 } |
1865 return new (_Future$(T)).immediateError(error, stackTrace); | 1861 return new (_Future$(T)).immediateError(error, stackTrace); |
1866 } | 1862 } |
1867 delayed(duration, computation) { | 1863 static delayed(duration, computation) { |
1868 if (computation === void 0) | 1864 if (computation === void 0) |
1869 computation = null; | 1865 computation = null; |
1870 let result = new (_Future$(T))(); | 1866 let result = new (_Future$(T))(); |
1871 new Timer(duration, dart.fn(() => { | 1867 Timer.new(duration, dart.fn(() => { |
1872 try { | 1868 try { |
1873 result[_complete](computation == null ? null : computation()); | 1869 result[_complete](computation == null ? null : computation()); |
1874 } catch (e) { | 1870 } catch (e) { |
1875 let s = dart.stackTrace(e); | 1871 let s = dart.stackTrace(e); |
1876 _completeWithErrorCallback(result, e, s); | 1872 _completeWithErrorCallback(result, e, s); |
1877 } | 1873 } |
1878 | 1874 |
1879 })); | 1875 })); |
1880 return dart.as(result, Future$(T)); | 1876 return dart.as(result, Future$(T)); |
1881 } | 1877 } |
1882 static wait(futures, opts) { | 1878 static wait(futures, opts) { |
1883 let eagerError = opts && 'eagerError' in opts ? opts.eagerError : false; | 1879 let eagerError = opts && 'eagerError' in opts ? opts.eagerError : false; |
1884 let cleanUp = opts && 'cleanUp' in opts ? opts.cleanUp : null; | 1880 let cleanUp = opts && 'cleanUp' in opts ? opts.cleanUp : null; |
1885 dart.as(cleanUp, dart.functionType(dart.void, [dart.bottom])); | 1881 dart.as(cleanUp, dart.functionType(dart.void, [dart.bottom])); |
1886 let result = new (_Future$(core.List))(); | 1882 let result = new (_Future$(core.List))(); |
1887 let values = null; | 1883 let values = null; |
1888 let remaining = 0; | 1884 let remaining = 0; |
1889 let error = null; | 1885 let error = null; |
1890 let stackTrace = null; | 1886 let stackTrace = null; |
1891 let handleError = (theError, theStackTrace) => { | 1887 let handleError = (theError, theStackTrace) => { |
1892 remaining = dart.notNull(remaining) - 1; | 1888 remaining = dart.notNull(remaining) - 1; |
1893 if (values != null) { | 1889 if (values != null) { |
1894 if (cleanUp != null) { | 1890 if (cleanUp != null) { |
1895 for (let value of values) { | 1891 for (let value of values) { |
1896 if (value != null) { | 1892 if (value != null) { |
1897 new (Future$()).sync(dart.fn(() => { | 1893 Future$().sync(dart.fn(() => { |
1898 dart.dcall(cleanUp, value); | 1894 dart.dcall(cleanUp, value); |
1899 })); | 1895 })); |
1900 } | 1896 } |
1901 } | 1897 } |
1902 } | 1898 } |
1903 values = null; | 1899 values = null; |
1904 if (remaining == 0 || dart.notNull(eagerError)) { | 1900 if (remaining == 0 || dart.notNull(eagerError)) { |
1905 result[_completeError](theError, dart.as(theStackTrace, core.Stack
Trace)); | 1901 result[_completeError](theError, dart.as(theStackTrace, core.Stack
Trace)); |
1906 } else { | 1902 } else { |
1907 error = theError; | 1903 error = theError; |
1908 stackTrace = dart.as(theStackTrace, core.StackTrace); | 1904 stackTrace = dart.as(theStackTrace, core.StackTrace); |
1909 } | 1905 } |
1910 } else if (remaining == 0 && !dart.notNull(eagerError)) { | 1906 } else if (remaining == 0 && !dart.notNull(eagerError)) { |
1911 result[_completeError](error, stackTrace); | 1907 result[_completeError](error, stackTrace); |
1912 } | 1908 } |
1913 }; | 1909 }; |
1914 dart.fn(handleError, dart.void, [core.Object, core.Object]); | 1910 dart.fn(handleError, dart.void, [core.Object, core.Object]); |
1915 for (let future of futures) { | 1911 for (let future of futures) { |
1916 let pos = remaining; | 1912 let pos = remaining; |
1917 remaining = dart.notNull(pos) + 1; | 1913 remaining = dart.notNull(pos) + 1; |
1918 future.then(dart.fn(value => { | 1914 future.then(dart.fn(value => { |
1919 remaining = dart.notNull(remaining) - 1; | 1915 remaining = dart.notNull(remaining) - 1; |
1920 if (values != null) { | 1916 if (values != null) { |
1921 values[core.$set](pos, value); | 1917 values[core.$set](pos, value); |
1922 if (remaining == 0) { | 1918 if (remaining == 0) { |
1923 result[_completeWithValue](values); | 1919 result[_completeWithValue](values); |
1924 } | 1920 } |
1925 } else { | 1921 } else { |
1926 if (dart.notNull(cleanUp != null) && dart.notNull(value != null))
{ | 1922 if (dart.notNull(cleanUp != null) && dart.notNull(value != null))
{ |
1927 new (Future$()).sync(dart.fn(() => { | 1923 Future$().sync(dart.fn(() => { |
1928 dart.dcall(cleanUp, value); | 1924 dart.dcall(cleanUp, value); |
1929 })); | 1925 })); |
1930 } | 1926 } |
1931 if (remaining == 0 && !dart.notNull(eagerError)) { | 1927 if (remaining == 0 && !dart.notNull(eagerError)) { |
1932 result[_completeError](error, stackTrace); | 1928 result[_completeError](error, stackTrace); |
1933 } | 1929 } |
1934 } | 1930 } |
1935 }, core.Object, [core.Object]), {onError: handleError}); | 1931 }, core.Object, [core.Object]), {onError: handleError}); |
1936 } | 1932 } |
1937 if (remaining == 0) { | 1933 if (remaining == 0) { |
1938 return new (Future$(core.List)).value(dart.const([])); | 1934 return Future$(core.List).value(dart.const([])); |
1939 } | 1935 } |
1940 values = new core.List(remaining); | 1936 values = core.List.new(remaining); |
1941 return result; | 1937 return result; |
1942 } | 1938 } |
1943 static forEach(input, f) { | 1939 static forEach(input, f) { |
1944 dart.as(f, dart.functionType(core.Object, [dart.bottom])); | 1940 dart.as(f, dart.functionType(core.Object, [dart.bottom])); |
1945 let iterator = input[core.$iterator]; | 1941 let iterator = input[core.$iterator]; |
1946 return Future$().doWhile(dart.fn(() => { | 1942 return Future$().doWhile(dart.fn(() => { |
1947 if (!dart.notNull(iterator.moveNext())) | 1943 if (!dart.notNull(iterator.moveNext())) |
1948 return false; | 1944 return false; |
1949 return new (Future$()).sync(dart.fn(() => dart.dcall(f, iterator.curre
nt))).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])); |
1950 })); | 1946 })); |
1951 } | 1947 } |
1952 static doWhile(f) { | 1948 static doWhile(f) { |
1953 dart.as(f, dart.functionType(core.Object, [])); | 1949 dart.as(f, dart.functionType(core.Object, [])); |
1954 let doneSignal = new _Future(); | 1950 let doneSignal = new _Future(); |
1955 let nextIteration = null; | 1951 let nextIteration = null; |
1956 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => { | 1952 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => { |
1957 if (keepGoing) { | 1953 if (keepGoing) { |
1958 new (Future$()).sync(f).then(dart.as(nextIteration, __CastType4), {o
nError: dart.bind(doneSignal, _completeError)}); | 1954 Future$().sync(f).then(dart.as(nextIteration, __CastType4), {onError
: dart.bind(doneSignal, _completeError)}); |
1959 } else { | 1955 } else { |
1960 doneSignal[_complete](null); | 1956 doneSignal[_complete](null); |
1961 } | 1957 } |
1962 }, core.Object, [core.bool]), {runGuarded: true}); | 1958 }, core.Object, [core.bool]), {runGuarded: true}); |
1963 dart.dcall(nextIteration, true); | 1959 dart.dcall(nextIteration, true); |
1964 return doneSignal; | 1960 return doneSignal; |
1965 } | 1961 } |
1966 } | 1962 } |
1967 dart.defineNamedConstructor(Future, 'microtask'); | |
1968 dart.defineNamedConstructor(Future, 'sync'); | |
1969 dart.defineNamedConstructor(Future, 'value'); | |
1970 dart.defineNamedConstructor(Future, 'error'); | |
1971 dart.defineNamedConstructor(Future, 'delayed'); | |
1972 dart.setSignature(Future, { | 1963 dart.setSignature(Future, { |
1973 constructors: () => ({ | 1964 constructors: () => ({ |
1974 Future: [Future$(T), [dart.functionType(core.Object, [])]], | 1965 new: [Future$(T), [dart.functionType(core.Object, [])]], |
1975 microtask: [Future$(T), [dart.functionType(core.Object, [])]], | 1966 microtask: [Future$(T), [dart.functionType(core.Object, [])]], |
1976 sync: [Future$(T), [dart.functionType(core.Object, [])]], | 1967 sync: [Future$(T), [dart.functionType(core.Object, [])]], |
1977 value: [Future$(T), [], [core.Object]], | 1968 value: [Future$(T), [], [core.Object]], |
1978 error: [Future$(T), [core.Object], [core.StackTrace]], | 1969 error: [Future$(T), [core.Object], [core.StackTrace]], |
1979 delayed: [Future$(T), [core.Duration], [dart.functionType(T, [])]] | 1970 delayed: [Future$(T), [core.Duration], [dart.functionType(T, [])]] |
1980 }), | 1971 }), |
1981 statics: () => ({ | 1972 statics: () => ({ |
1982 wait: [Future$(core.List), [core.Iterable$(Future$())], {eagerError: cor
e.bool, cleanUp: dart.functionType(dart.void, [dart.bottom])}], | 1973 wait: [Future$(core.List), [core.Iterable$(Future$())], {eagerError: cor
e.bool, cleanUp: dart.functionType(dart.void, [dart.bottom])}], |
1983 forEach: [Future$(), [core.Iterable, dart.functionType(core.Object, [dar
t.bottom])]], | 1974 forEach: [Future$(), [core.Iterable, dart.functionType(core.Object, [dar
t.bottom])]], |
1984 doWhile: [Future$(), [dart.functionType(core.Object, [])]] | 1975 doWhile: [Future$(), [dart.functionType(core.Object, [])]] |
(...skipping 23 matching lines...) Expand all Loading... |
2008 result = `${result}: ${this.message}`; | 1999 result = `${result}: ${this.message}`; |
2009 return result; | 2000 return result; |
2010 } | 2001 } |
2011 } | 2002 } |
2012 TimeoutException[dart.implements] = () => [core.Exception]; | 2003 TimeoutException[dart.implements] = () => [core.Exception]; |
2013 dart.setSignature(TimeoutException, { | 2004 dart.setSignature(TimeoutException, { |
2014 constructors: () => ({TimeoutException: [TimeoutException, [core.String], [c
ore.Duration]]}) | 2005 constructors: () => ({TimeoutException: [TimeoutException, [core.String], [c
ore.Duration]]}) |
2015 }); | 2006 }); |
2016 let Completer$ = dart.generic(function(T) { | 2007 let Completer$ = dart.generic(function(T) { |
2017 class Completer extends core.Object { | 2008 class Completer extends core.Object { |
2018 Completer() { | 2009 static new() { |
2019 return new (_AsyncCompleter$(T))(); | 2010 return new (_AsyncCompleter$(T))(); |
2020 } | 2011 } |
2021 sync() { | 2012 static sync() { |
2022 return new (_SyncCompleter$(T))(); | 2013 return new (_SyncCompleter$(T))(); |
2023 } | 2014 } |
2024 } | 2015 } |
2025 dart.defineNamedConstructor(Completer, 'sync'); | |
2026 dart.setSignature(Completer, { | 2016 dart.setSignature(Completer, { |
2027 constructors: () => ({ | 2017 constructors: () => ({ |
2028 Completer: [Completer$(T), []], | 2018 new: [Completer$(T), []], |
2029 sync: [Completer$(T), []] | 2019 sync: [Completer$(T), []] |
2030 }) | 2020 }) |
2031 }); | 2021 }); |
2032 return Completer; | 2022 return Completer; |
2033 }); | 2023 }); |
2034 let Completer = Completer$(); | 2024 let Completer = Completer$(); |
2035 function _completeWithErrorCallback(result, error, stackTrace) { | 2025 function _completeWithErrorCallback(result, error, stackTrace) { |
2036 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core
.StackTrace)); | 2026 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core
.StackTrace)); |
2037 if (replacement != null) { | 2027 if (replacement != null) { |
2038 error = _nonNullError(replacement.error); | 2028 error = _nonNullError(replacement.error); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2304 whenComplete(action) { | 2294 whenComplete(action) { |
2305 dart.as(action, dart.functionType(core.Object, [])); | 2295 dart.as(action, dart.functionType(core.Object, [])); |
2306 let result = new (_Future$(T))(); | 2296 let result = new (_Future$(T))(); |
2307 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { | 2297 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { |
2308 action = result[_zone].registerCallback(action); | 2298 action = result[_zone].registerCallback(action); |
2309 } | 2299 } |
2310 this[_addListener](new _FutureListener.whenComplete(result, action)); | 2300 this[_addListener](new _FutureListener.whenComplete(result, action)); |
2311 return dart.as(result, Future$(T)); | 2301 return dart.as(result, Future$(T)); |
2312 } | 2302 } |
2313 asStream() { | 2303 asStream() { |
2314 return new (Stream$(T)).fromFuture(this); | 2304 return Stream$(T).fromFuture(this); |
2315 } | 2305 } |
2316 [_markPendingCompletion]() { | 2306 [_markPendingCompletion]() { |
2317 if (!dart.notNull(this[_mayComplete])) | 2307 if (!dart.notNull(this[_mayComplete])) |
2318 throw new core.StateError("Future already completed"); | 2308 throw new core.StateError("Future already completed"); |
2319 this[_state] = _Future$()._PENDING_COMPLETE; | 2309 this[_state] = _Future$()._PENDING_COMPLETE; |
2320 } | 2310 } |
2321 get [_value]() { | 2311 get [_value]() { |
2322 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasVal
ue])); | 2312 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasVal
ue])); |
2323 return dart.as(this[_resultOrListeners], T); | 2313 return dart.as(this[_resultOrListeners], T); |
2324 } | 2314 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 } | 2601 } |
2612 } | 2602 } |
2613 timeout(timeLimit, opts) { | 2603 timeout(timeLimit, opts) { |
2614 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; | 2604 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; |
2615 dart.as(onTimeout, dart.functionType(core.Object, [])); | 2605 dart.as(onTimeout, dart.functionType(core.Object, [])); |
2616 if (this[_isComplete]) | 2606 if (this[_isComplete]) |
2617 return new (_Future$()).immediate(this); | 2607 return new (_Future$()).immediate(this); |
2618 let result = new (_Future$())(); | 2608 let result = new (_Future$())(); |
2619 let timer = null; | 2609 let timer = null; |
2620 if (onTimeout == null) { | 2610 if (onTimeout == null) { |
2621 timer = new Timer(timeLimit, dart.fn(() => { | 2611 timer = Timer.new(timeLimit, dart.fn(() => { |
2622 result[_completeError](new TimeoutException("Future not completed",
timeLimit)); | 2612 result[_completeError](new TimeoutException("Future not completed",
timeLimit)); |
2623 })); | 2613 })); |
2624 } else { | 2614 } else { |
2625 let zone = Zone.current; | 2615 let zone = Zone.current; |
2626 onTimeout = zone.registerCallback(onTimeout); | 2616 onTimeout = zone.registerCallback(onTimeout); |
2627 timer = new Timer(timeLimit, dart.fn(() => { | 2617 timer = Timer.new(timeLimit, dart.fn(() => { |
2628 try { | 2618 try { |
2629 result[_complete](zone.run(onTimeout)); | 2619 result[_complete](zone.run(onTimeout)); |
2630 } catch (e) { | 2620 } catch (e) { |
2631 let s = dart.stackTrace(e); | 2621 let s = dart.stackTrace(e); |
2632 result[_completeError](e, s); | 2622 result[_completeError](e, s); |
2633 } | 2623 } |
2634 | 2624 |
2635 })); | 2625 })); |
2636 } | 2626 } |
2637 this.then(dart.fn(v => { | 2627 this.then(dart.fn(v => { |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 }); | 2890 }); |
2901 let StreamConsumer = StreamConsumer$(); | 2891 let StreamConsumer = StreamConsumer$(); |
2902 let StreamSink$ = dart.generic(function(S) { | 2892 let StreamSink$ = dart.generic(function(S) { |
2903 class StreamSink extends core.Object {} | 2893 class StreamSink extends core.Object {} |
2904 StreamSink[dart.implements] = () => [StreamConsumer$(S), EventSink$(S)]; | 2894 StreamSink[dart.implements] = () => [StreamConsumer$(S), EventSink$(S)]; |
2905 return StreamSink; | 2895 return StreamSink; |
2906 }); | 2896 }); |
2907 let StreamSink = StreamSink$(); | 2897 let StreamSink = StreamSink$(); |
2908 let StreamTransformer$ = dart.generic(function(S, T) { | 2898 let StreamTransformer$ = dart.generic(function(S, T) { |
2909 class StreamTransformer extends core.Object { | 2899 class StreamTransformer extends core.Object { |
2910 StreamTransformer(transformer) { | 2900 static new(transformer) { |
2911 return new _StreamSubscriptionTransformer(transformer); | 2901 return new _StreamSubscriptionTransformer(transformer); |
2912 } | 2902 } |
2913 fromHandlers(opts) { | 2903 static fromHandlers(opts) { |
2914 return new _StreamHandlerTransformer(opts); | 2904 return new _StreamHandlerTransformer(opts); |
2915 } | 2905 } |
2916 } | 2906 } |
2917 dart.defineNamedConstructor(StreamTransformer, 'fromHandlers'); | |
2918 dart.setSignature(StreamTransformer, { | 2907 dart.setSignature(StreamTransformer, { |
2919 constructors: () => ({ | 2908 constructors: () => ({ |
2920 StreamTransformer: [StreamTransformer$(S, T), [dart.functionType(StreamS
ubscription$(T), [Stream$(S), core.bool])]], | 2909 new: [StreamTransformer$(S, T), [dart.functionType(StreamSubscription$(T
), [Stream$(S), core.bool])]], |
2921 fromHandlers: [StreamTransformer$(S, T), [], {handleData: dart.functionT
ype(dart.void, [S, EventSink$(T)]), handleError: dart.functionType(dart.void, [c
ore.Object, core.StackTrace, EventSink$(T)]), handleDone: dart.functionType(dart
.void, [EventSink$(T)])}] | 2910 fromHandlers: [StreamTransformer$(S, T), [], {handleData: dart.functionT
ype(dart.void, [S, EventSink$(T)]), handleError: dart.functionType(dart.void, [c
ore.Object, core.StackTrace, EventSink$(T)]), handleDone: dart.functionType(dart
.void, [EventSink$(T)])}] |
2922 }) | 2911 }) |
2923 }); | 2912 }); |
2924 return StreamTransformer; | 2913 return StreamTransformer; |
2925 }); | 2914 }); |
2926 let StreamTransformer = StreamTransformer$(); | 2915 let StreamTransformer = StreamTransformer$(); |
2927 let StreamIterator$ = dart.generic(function(T) { | 2916 let StreamIterator$ = dart.generic(function(T) { |
2928 class StreamIterator extends core.Object { | 2917 class StreamIterator extends core.Object { |
2929 StreamIterator(stream) { | 2918 static new(stream) { |
2930 return new (_StreamIteratorImpl$(T))(stream); | 2919 return new (_StreamIteratorImpl$(T))(stream); |
2931 } | 2920 } |
2932 } | 2921 } |
2933 dart.setSignature(StreamIterator, { | 2922 dart.setSignature(StreamIterator, { |
2934 constructors: () => ({StreamIterator: [StreamIterator$(T), [Stream$(T)]]}) | 2923 constructors: () => ({new: [StreamIterator$(T), [Stream$(T)]]}) |
2935 }); | 2924 }); |
2936 return StreamIterator; | 2925 return StreamIterator; |
2937 }); | 2926 }); |
2938 let StreamIterator = StreamIterator$(); | 2927 let StreamIterator = StreamIterator$(); |
2939 let _ControllerEventSinkWrapper$ = dart.generic(function(T) { | 2928 let _ControllerEventSinkWrapper$ = dart.generic(function(T) { |
2940 class _ControllerEventSinkWrapper extends core.Object { | 2929 class _ControllerEventSinkWrapper extends core.Object { |
2941 _ControllerEventSinkWrapper(sink) { | 2930 _ControllerEventSinkWrapper(sink) { |
2942 this[_sink] = sink; | 2931 this[_sink] = sink; |
2943 } | 2932 } |
2944 add(data) { | 2933 add(data) { |
(...skipping 20 matching lines...) Expand all Loading... |
2965 }); | 2954 }); |
2966 return _ControllerEventSinkWrapper; | 2955 return _ControllerEventSinkWrapper; |
2967 }); | 2956 }); |
2968 let _ControllerEventSinkWrapper = _ControllerEventSinkWrapper$(); | 2957 let _ControllerEventSinkWrapper = _ControllerEventSinkWrapper$(); |
2969 let __CastType12 = dart.typedef('__CastType12', () => dart.functionType(dart.v
oid, [StreamSubscription])); | 2958 let __CastType12 = dart.typedef('__CastType12', () => dart.functionType(dart.v
oid, [StreamSubscription])); |
2970 let __CastType14 = dart.typedef('__CastType14', () => dart.functionType(core.O
bject, [dart.bottom, core.StackTrace])); | 2959 let __CastType14 = dart.typedef('__CastType14', () => dart.functionType(core.O
bject, [dart.bottom, core.StackTrace])); |
2971 let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(dart.v
oid, [])); | 2960 let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(dart.v
oid, [])); |
2972 let __CastType18 = dart.typedef('__CastType18', () => dart.functionType(dart.v
oid, [EventSink])); | 2961 let __CastType18 = dart.typedef('__CastType18', () => dart.functionType(dart.v
oid, [EventSink])); |
2973 let StreamController$ = dart.generic(function(T) { | 2962 let StreamController$ = dart.generic(function(T) { |
2974 class StreamController extends core.Object { | 2963 class StreamController extends core.Object { |
2975 StreamController(opts) { | 2964 static new(opts) { |
2976 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 2965 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
2977 let onPause = opts && 'onPause' in opts ? opts.onPause : null; | 2966 let onPause = opts && 'onPause' in opts ? opts.onPause : null; |
2978 let onResume = opts && 'onResume' in opts ? opts.onResume : null; | 2967 let onResume = opts && 'onResume' in opts ? opts.onResume : null; |
2979 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 2968 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
2980 let sync = opts && 'sync' in opts ? opts.sync : false; | 2969 let sync = opts && 'sync' in opts ? opts.sync : false; |
2981 if (dart.notNull(onListen == null) && dart.notNull(onPause == null) && d
art.notNull(onResume == null) && dart.notNull(onCancel == null)) { | 2970 if (dart.notNull(onListen == null) && dart.notNull(onPause == null) && d
art.notNull(onResume == null) && dart.notNull(onCancel == null)) { |
2982 return dart.as(sync ? new _NoCallbackSyncStreamController() : new _NoC
allbackAsyncStreamController(), StreamController$(T)); | 2971 return dart.as(sync ? new _NoCallbackSyncStreamController() : new _NoC
allbackAsyncStreamController(), StreamController$(T)); |
2983 } | 2972 } |
2984 return sync ? new (_SyncStreamController$(T))(onListen, onPause, onResum
e, onCancel) : new (_AsyncStreamController$(T))(onListen, onPause, onResume, onC
ancel); | 2973 return sync ? new (_SyncStreamController$(T))(onListen, onPause, onResum
e, onCancel) : new (_AsyncStreamController$(T))(onListen, onPause, onResume, onC
ancel); |
2985 } | 2974 } |
2986 broadcast(opts) { | 2975 static broadcast(opts) { |
2987 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 2976 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
2988 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 2977 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
2989 let sync = opts && 'sync' in opts ? opts.sync : false; | 2978 let sync = opts && 'sync' in opts ? opts.sync : false; |
2990 return sync ? new (_SyncBroadcastStreamController$(T))(onListen, onCance
l) : new (_AsyncBroadcastStreamController$(T))(onListen, onCancel); | 2979 return sync ? new (_SyncBroadcastStreamController$(T))(onListen, onCance
l) : new (_AsyncBroadcastStreamController$(T))(onListen, onCancel); |
2991 } | 2980 } |
2992 } | 2981 } |
2993 StreamController[dart.implements] = () => [StreamSink$(T)]; | 2982 StreamController[dart.implements] = () => [StreamSink$(T)]; |
2994 dart.defineNamedConstructor(StreamController, 'broadcast'); | |
2995 dart.setSignature(StreamController, { | 2983 dart.setSignature(StreamController, { |
2996 constructors: () => ({ | 2984 constructors: () => ({ |
2997 StreamController: [StreamController$(T), [], {onListen: dart.functionTyp
e(dart.void, []), onPause: dart.functionType(dart.void, []), onResume: dart.func
tionType(dart.void, []), onCancel: dart.functionType(core.Object, []), sync: cor
e.bool}], | 2985 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}], |
2998 broadcast: [StreamController$(T), [], {onListen: dart.functionType(dart.
void, []), onCancel: dart.functionType(dart.void, []), sync: core.bool}] | 2986 broadcast: [StreamController$(T), [], {onListen: dart.functionType(dart.
void, []), onCancel: dart.functionType(dart.void, []), sync: core.bool}] |
2999 }) | 2987 }) |
3000 }); | 2988 }); |
3001 return StreamController; | 2989 return StreamController; |
3002 }); | 2990 }); |
3003 let StreamController = StreamController$(); | 2991 let StreamController = StreamController$(); |
3004 let _StreamControllerLifecycle$ = dart.generic(function(T) { | 2992 let _StreamControllerLifecycle$ = dart.generic(function(T) { |
3005 class _StreamControllerLifecycle extends core.Object { | 2993 class _StreamControllerLifecycle extends core.Object { |
3006 [_recordPause](subscription) { | 2994 [_recordPause](subscription) { |
3007 dart.as(subscription, StreamSubscription$(T)); | 2995 dart.as(subscription, StreamSubscription$(T)); |
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4970 let __CastType27 = dart.typedef('__CastType27', () => dart.functionType(dart
.void, [S, EventSink$(T)])); | 4958 let __CastType27 = dart.typedef('__CastType27', () => dart.functionType(dart
.void, [S, EventSink$(T)])); |
4971 return __CastType27; | 4959 return __CastType27; |
4972 }); | 4960 }); |
4973 let __CastType27 = __CastType27$(); | 4961 let __CastType27 = __CastType27$(); |
4974 let __CastType30$ = dart.generic(function(T) { | 4962 let __CastType30$ = dart.generic(function(T) { |
4975 let __CastType30 = dart.typedef('__CastType30', () => dart.functionType(dart
.void, [core.Object, core.StackTrace, EventSink$(T)])); | 4963 let __CastType30 = dart.typedef('__CastType30', () => dart.functionType(dart
.void, [core.Object, core.StackTrace, EventSink$(T)])); |
4976 return __CastType30; | 4964 return __CastType30; |
4977 }); | 4965 }); |
4978 let __CastType30 = __CastType30$(); | 4966 let __CastType30 = __CastType30$(); |
4979 class Timer extends core.Object { | 4967 class Timer extends core.Object { |
4980 Timer(duration, callback) { | 4968 static new(duration, callback) { |
4981 if (dart.equals(Zone.current, Zone.ROOT)) { | 4969 if (dart.equals(Zone.current, Zone.ROOT)) { |
4982 return Zone.current.createTimer(duration, callback); | 4970 return Zone.current.createTimer(duration, callback); |
4983 } | 4971 } |
4984 return Zone.current.createTimer(duration, Zone.current.bindCallback(callba
ck, {runGuarded: true})); | 4972 return Zone.current.createTimer(duration, Zone.current.bindCallback(callba
ck, {runGuarded: true})); |
4985 } | 4973 } |
4986 periodic(duration, callback) { | 4974 static periodic(duration, callback) { |
4987 if (dart.equals(Zone.current, Zone.ROOT)) { | 4975 if (dart.equals(Zone.current, Zone.ROOT)) { |
4988 return Zone.current.createPeriodicTimer(duration, callback); | 4976 return Zone.current.createPeriodicTimer(duration, callback); |
4989 } | 4977 } |
4990 return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bin
dUnaryCallback(callback, {runGuarded: true}), __CastType34)); | 4978 return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bin
dUnaryCallback(callback, {runGuarded: true}), __CastType34)); |
4991 } | 4979 } |
4992 static run(callback) { | 4980 static run(callback) { |
4993 new Timer(core.Duration.ZERO, callback); | 4981 Timer.new(core.Duration.ZERO, callback); |
4994 } | 4982 } |
4995 static _createTimer(duration, callback) { | 4983 static _createTimer(duration, callback) { |
4996 let milliseconds = duration.inMilliseconds; | 4984 let milliseconds = duration.inMilliseconds; |
4997 if (dart.notNull(milliseconds) < 0) | 4985 if (dart.notNull(milliseconds) < 0) |
4998 milliseconds = 0; | 4986 milliseconds = 0; |
4999 return new _isolate_helper.TimerImpl(milliseconds, callback); | 4987 return new _isolate_helper.TimerImpl(milliseconds, callback); |
5000 } | 4988 } |
5001 static _createPeriodicTimer(duration, callback) { | 4989 static _createPeriodicTimer(duration, callback) { |
5002 let milliseconds = duration.inMilliseconds; | 4990 let milliseconds = duration.inMilliseconds; |
5003 if (dart.notNull(milliseconds) < 0) | 4991 if (dart.notNull(milliseconds) < 0) |
5004 milliseconds = 0; | 4992 milliseconds = 0; |
5005 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback); | 4993 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback); |
5006 } | 4994 } |
5007 } | 4995 } |
5008 dart.defineNamedConstructor(Timer, 'periodic'); | |
5009 dart.setSignature(Timer, { | 4996 dart.setSignature(Timer, { |
5010 constructors: () => ({ | 4997 constructors: () => ({ |
5011 Timer: [Timer, [core.Duration, dart.functionType(dart.void, [])]], | 4998 new: [Timer, [core.Duration, dart.functionType(dart.void, [])]], |
5012 periodic: [Timer, [core.Duration, dart.functionType(dart.void, [Timer])]] | 4999 periodic: [Timer, [core.Duration, dart.functionType(dart.void, [Timer])]] |
5013 }), | 5000 }), |
5014 statics: () => ({ | 5001 statics: () => ({ |
5015 run: [dart.void, [dart.functionType(dart.void, [])]], | 5002 run: [dart.void, [dart.functionType(dart.void, [])]], |
5016 _createTimer: [Timer, [core.Duration, dart.functionType(dart.void, [])]], | 5003 _createTimer: [Timer, [core.Duration, dart.functionType(dart.void, [])]], |
5017 _createPeriodicTimer: [Timer, [core.Duration, dart.functionType(dart.void,
[Timer])]] | 5004 _createPeriodicTimer: [Timer, [core.Duration, dart.functionType(dart.void,
[Timer])]] |
5018 }), | 5005 }), |
5019 names: ['run', '_createTimer', '_createPeriodicTimer'] | 5006 names: ['run', '_createTimer', '_createPeriodicTimer'] |
5020 }); | 5007 }); |
5021 let __CastType34 = dart.typedef('__CastType34', () => dart.functionType(dart.v
oid, [Timer])); | 5008 let __CastType34 = dart.typedef('__CastType34', () => dart.functionType(dart.v
oid, [Timer])); |
(...skipping 16 matching lines...) Expand all Loading... |
5038 class _ZoneFunction extends core.Object { | 5025 class _ZoneFunction extends core.Object { |
5039 _ZoneFunction(zone, func) { | 5026 _ZoneFunction(zone, func) { |
5040 this.zone = zone; | 5027 this.zone = zone; |
5041 this.function = func; | 5028 this.function = func; |
5042 } | 5029 } |
5043 } | 5030 } |
5044 dart.setSignature(_ZoneFunction, { | 5031 dart.setSignature(_ZoneFunction, { |
5045 constructors: () => ({_ZoneFunction: [_ZoneFunction, [_Zone, core.Function]]
}) | 5032 constructors: () => ({_ZoneFunction: [_ZoneFunction, [_Zone, core.Function]]
}) |
5046 }); | 5033 }); |
5047 class ZoneSpecification extends core.Object { | 5034 class ZoneSpecification extends core.Object { |
5048 ZoneSpecification(opts) { | 5035 static new(opts) { |
5049 return new _ZoneSpecification(opts); | 5036 return new _ZoneSpecification(opts); |
5050 } | 5037 } |
5051 from(other, opts) { | 5038 static from(other, opts) { |
5052 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han
dleUncaughtError : null; | 5039 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han
dleUncaughtError : null; |
5053 let run = opts && 'run' in opts ? opts.run : null; | 5040 let run = opts && 'run' in opts ? opts.run : null; |
5054 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; | 5041 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; |
5055 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; | 5042 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; |
5056 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC
allback : null; | 5043 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC
allback : null; |
5057 let registerUnaryCallback = opts && 'registerUnaryCallback' in opts ? opts
.registerUnaryCallback : null; | 5044 let registerUnaryCallback = opts && 'registerUnaryCallback' in opts ? opts
.registerUnaryCallback : null; |
5058 let registerBinaryCallback = opts && 'registerBinaryCallback' in opts ? op
ts.registerBinaryCallback : null; | 5045 let registerBinaryCallback = opts && 'registerBinaryCallback' in opts ? op
ts.registerBinaryCallback : null; |
5059 let errorCallback = opts && 'errorCallback' in opts ? opts.errorCallback :
null; | 5046 let errorCallback = opts && 'errorCallback' in opts ? opts.errorCallback :
null; |
5060 let scheduleMicrotask = opts && 'scheduleMicrotask' in opts ? opts.schedul
eMicrotask : null; | 5047 let scheduleMicrotask = opts && 'scheduleMicrotask' in opts ? opts.schedul
eMicrotask : null; |
5061 let createTimer = opts && 'createTimer' in opts ? opts.createTimer : null; | 5048 let createTimer = opts && 'createTimer' in opts ? opts.createTimer : null; |
5062 let createPeriodicTimer = opts && 'createPeriodicTimer' in opts ? opts.cre
atePeriodicTimer : null; | 5049 let createPeriodicTimer = opts && 'createPeriodicTimer' in opts ? opts.cre
atePeriodicTimer : null; |
5063 let print = opts && 'print' in opts ? opts.print : null; | 5050 let print = opts && 'print' in opts ? opts.print : null; |
5064 let fork = opts && 'fork' in opts ? opts.fork : null; | 5051 let fork = opts && 'fork' in opts ? opts.fork : null; |
5065 return new ZoneSpecification({handleUncaughtError: handleUncaughtError !=
null ? handleUncaughtError : other.handleUncaughtError, run: run != null ? run :
other.run, runUnary: runUnary != null ? runUnary : other.runUnary, runBinary: r
unBinary != null ? runBinary : other.runBinary, registerCallback: registerCallba
ck != null ? registerCallback : other.registerCallback, registerUnaryCallback: r
egisterUnaryCallback != null ? registerUnaryCallback : other.registerUnaryCallba
ck, registerBinaryCallback: registerBinaryCallback != null ? registerBinaryCallb
ack : other.registerBinaryCallback, errorCallback: errorCallback != null ? error
Callback : other.errorCallback, scheduleMicrotask: scheduleMicrotask != null ? s
cheduleMicrotask : other.scheduleMicrotask, createTimer: createTimer != null ? c
reateTimer : other.createTimer, createPeriodicTimer: createPeriodicTimer != null
? createPeriodicTimer : other.createPeriodicTimer, print: print != null ? print
: other.print, fork: fork != null ? fork : other.fork}); | 5052 return ZoneSpecification.new({handleUncaughtError: handleUncaughtError !=
null ? handleUncaughtError : other.handleUncaughtError, run: run != null ? run :
other.run, runUnary: runUnary != null ? runUnary : other.runUnary, runBinary: r
unBinary != null ? runBinary : other.runBinary, registerCallback: registerCallba
ck != null ? registerCallback : other.registerCallback, registerUnaryCallback: r
egisterUnaryCallback != null ? registerUnaryCallback : other.registerUnaryCallba
ck, registerBinaryCallback: registerBinaryCallback != null ? registerBinaryCallb
ack : other.registerBinaryCallback, errorCallback: errorCallback != null ? error
Callback : other.errorCallback, scheduleMicrotask: scheduleMicrotask != null ? s
cheduleMicrotask : other.scheduleMicrotask, createTimer: createTimer != null ? c
reateTimer : other.createTimer, createPeriodicTimer: createPeriodicTimer != null
? createPeriodicTimer : other.createPeriodicTimer, print: print != null ? print
: other.print, fork: fork != null ? fork : other.fork}); |
5066 } | 5053 } |
5067 } | 5054 } |
5068 dart.defineNamedConstructor(ZoneSpecification, 'from'); | |
5069 dart.setSignature(ZoneSpecification, { | 5055 dart.setSignature(ZoneSpecification, { |
5070 constructors: () => ({ | 5056 constructors: () => ({ |
5071 ZoneSpecification: [ZoneSpecification, [], {handleUncaughtError: dart.func
tionType(core.Object, [Zone, ZoneDelegate, Zone, dart.bottom, core.StackTrace]),
run: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functionTyp
e(core.Object, [])]), runUnary: dart.functionType(core.Object, [Zone, ZoneDelega
te, Zone, dart.functionType(core.Object, [dart.bottom]), dart.bottom]), runBinar
y: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functionType(c
ore.Object, [dart.bottom, dart.bottom]), dart.bottom, dart.bottom]), registerCal
lback: dart.functionType(ZoneCallback, [Zone, ZoneDelegate, Zone, dart.functionT
ype(core.Object, [])]), registerUnaryCallback: dart.functionType(ZoneUnaryCallba
ck, [Zone, ZoneDelegate, Zone, dart.functionType(core.Object, [dart.bottom])]),
registerBinaryCallback: dart.functionType(ZoneBinaryCallback, [Zone, ZoneDelegat
e, Zone, dart.functionType(core.Object, [dart.bottom, dart.bottom])]), errorCall
back: dart.functionType(AsyncError, [Zone, ZoneDelegate, Zone, core.Object, core
.StackTrace]), scheduleMicrotask: dart.functionType(dart.void, [Zone, ZoneDelega
te, Zone, dart.functionType(core.Object, [])]), createTimer: dart.functionType(T
imer, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.void, [])
]), createPeriodicTimer: dart.functionType(Timer, [Zone, ZoneDelegate, Zone, cor
e.Duration, dart.functionType(dart.void, [Timer])]), print: dart.functionType(da
rt.void, [Zone, ZoneDelegate, Zone, core.String]), fork: dart.functionType(Zone,
[Zone, ZoneDelegate, Zone, ZoneSpecification, core.Map])}], | 5057 new: [ZoneSpecification, [], {handleUncaughtError: dart.functionType(core.
Object, [Zone, ZoneDelegate, Zone, dart.bottom, core.StackTrace]), run: dart.fun
ctionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functionType(core.Object,
[])]), runUnary: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart
.functionType(core.Object, [dart.bottom]), dart.bottom]), runBinary: dart.functi
onType(core.Object, [Zone, ZoneDelegate, Zone, dart.functionType(core.Object, [d
art.bottom, dart.bottom]), dart.bottom, dart.bottom]), registerCallback: dart.fu
nctionType(ZoneCallback, [Zone, ZoneDelegate, Zone, dart.functionType(core.Objec
t, [])]), registerUnaryCallback: dart.functionType(ZoneUnaryCallback, [Zone, Zon
eDelegate, Zone, dart.functionType(core.Object, [dart.bottom])]), registerBinary
Callback: dart.functionType(ZoneBinaryCallback, [Zone, ZoneDelegate, Zone, dart.
functionType(core.Object, [dart.bottom, dart.bottom])]), errorCallback: dart.fun
ctionType(AsyncError, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace]),
scheduleMicrotask: dart.functionType(dart.void, [Zone, ZoneDelegate, Zone, dart
.functionType(core.Object, [])]), createTimer: dart.functionType(Timer, [Zone, Z
oneDelegate, Zone, core.Duration, dart.functionType(dart.void, [])]), createPeri
odicTimer: dart.functionType(Timer, [Zone, ZoneDelegate, Zone, core.Duration, da
rt.functionType(dart.void, [Timer])]), print: dart.functionType(dart.void, [Zone
, ZoneDelegate, Zone, core.String]), fork: dart.functionType(Zone, [Zone, ZoneDe
legate, Zone, ZoneSpecification, core.Map])}], |
5072 from: [ZoneSpecification, [ZoneSpecification], {handleUncaughtError: dart.
functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.bottom, core.StackTrac
e]), run: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functio
nType(core.Object, [])]), runUnary: dart.functionType(core.Object, [Zone, ZoneDe
legate, Zone, dart.functionType(core.Object, [dart.bottom]), dart.bottom]), runB
inary: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functionTy
pe(core.Object, [dart.bottom, dart.bottom]), dart.bottom, dart.bottom]), registe
rCallback: dart.functionType(ZoneCallback, [Zone, ZoneDelegate, Zone, dart.funct
ionType(core.Object, [])]), registerUnaryCallback: dart.functionType(ZoneUnaryCa
llback, [Zone, ZoneDelegate, Zone, dart.functionType(core.Object, [dart.bottom])
]), registerBinaryCallback: dart.functionType(ZoneBinaryCallback, [Zone, ZoneDel
egate, Zone, dart.functionType(core.Object, [dart.bottom, dart.bottom])]), error
Callback: dart.functionType(AsyncError, [Zone, ZoneDelegate, Zone, core.Object,
core.StackTrace]), scheduleMicrotask: dart.functionType(dart.void, [Zone, ZoneDe
legate, Zone, dart.functionType(core.Object, [])]), createTimer: dart.functionTy
pe(Timer, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.void,
[])]), createPeriodicTimer: dart.functionType(Timer, [Zone, ZoneDelegate, Zone,
core.Duration, dart.functionType(dart.void, [Timer])]), print: dart.functionTyp
e(dart.void, [Zone, ZoneDelegate, Zone, core.String]), fork: dart.functionType(Z
one, [Zone, ZoneDelegate, Zone, ZoneSpecification, core.Map])}] | 5058 from: [ZoneSpecification, [ZoneSpecification], {handleUncaughtError: dart.
functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.bottom, core.StackTrac
e]), run: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functio
nType(core.Object, [])]), runUnary: dart.functionType(core.Object, [Zone, ZoneDe
legate, Zone, dart.functionType(core.Object, [dart.bottom]), dart.bottom]), runB
inary: dart.functionType(core.Object, [Zone, ZoneDelegate, Zone, dart.functionTy
pe(core.Object, [dart.bottom, dart.bottom]), dart.bottom, dart.bottom]), registe
rCallback: dart.functionType(ZoneCallback, [Zone, ZoneDelegate, Zone, dart.funct
ionType(core.Object, [])]), registerUnaryCallback: dart.functionType(ZoneUnaryCa
llback, [Zone, ZoneDelegate, Zone, dart.functionType(core.Object, [dart.bottom])
]), registerBinaryCallback: dart.functionType(ZoneBinaryCallback, [Zone, ZoneDel
egate, Zone, dart.functionType(core.Object, [dart.bottom, dart.bottom])]), error
Callback: dart.functionType(AsyncError, [Zone, ZoneDelegate, Zone, core.Object,
core.StackTrace]), scheduleMicrotask: dart.functionType(dart.void, [Zone, ZoneDe
legate, Zone, dart.functionType(core.Object, [])]), createTimer: dart.functionTy
pe(Timer, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.void,
[])]), createPeriodicTimer: dart.functionType(Timer, [Zone, ZoneDelegate, Zone,
core.Duration, dart.functionType(dart.void, [Timer])]), print: dart.functionTyp
e(dart.void, [Zone, ZoneDelegate, Zone, core.String]), fork: dart.functionType(Z
one, [Zone, ZoneDelegate, Zone, ZoneSpecification, core.Map])}] |
5073 }) | 5059 }) |
5074 }); | 5060 }); |
5075 class _ZoneSpecification extends core.Object { | 5061 class _ZoneSpecification extends core.Object { |
5076 _ZoneSpecification(opts) { | 5062 _ZoneSpecification(opts) { |
5077 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han
dleUncaughtError : null; | 5063 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han
dleUncaughtError : null; |
5078 let run = opts && 'run' in opts ? opts.run : null; | 5064 let run = opts && 'run' in opts ? opts.run : null; |
5079 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; | 5065 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; |
5080 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; | 5066 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; |
5081 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC
allback : null; | 5067 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC
allback : null; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5756 _internal.printToConsole(line); | 5742 _internal.printToConsole(line); |
5757 } | 5743 } |
5758 dart.fn(_rootPrint, dart.void, [Zone, ZoneDelegate, Zone, core.String]); | 5744 dart.fn(_rootPrint, dart.void, [Zone, ZoneDelegate, Zone, core.String]); |
5759 function _printToZone(line) { | 5745 function _printToZone(line) { |
5760 Zone.current.print(line); | 5746 Zone.current.print(line); |
5761 } | 5747 } |
5762 dart.fn(_printToZone, dart.void, [core.String]); | 5748 dart.fn(_printToZone, dart.void, [core.String]); |
5763 function _rootFork(self, parent, zone, specification, zoneValues) { | 5749 function _rootFork(self, parent, zone, specification, zoneValues) { |
5764 _internal.printToZone = _printToZone; | 5750 _internal.printToZone = _printToZone; |
5765 if (specification == null) { | 5751 if (specification == null) { |
5766 specification = dart.const(new ZoneSpecification()); | 5752 specification = dart.const(ZoneSpecification.new()); |
5767 } else if (!dart.is(specification, _ZoneSpecification)) { | 5753 } else if (!dart.is(specification, _ZoneSpecification)) { |
5768 throw new core.ArgumentError("ZoneSpecifications must be instantiated" + "
with the provided constructor."); | 5754 throw new core.ArgumentError("ZoneSpecifications must be instantiated" + "
with the provided constructor."); |
5769 } | 5755 } |
5770 let valueMap = null; | 5756 let valueMap = null; |
5771 if (zoneValues == null) { | 5757 if (zoneValues == null) { |
5772 if (dart.is(zone, _Zone)) { | 5758 if (dart.is(zone, _Zone)) { |
5773 valueMap = zone[_map]; | 5759 valueMap = zone[_map]; |
5774 } else { | 5760 } else { |
5775 valueMap = new collection.HashMap(); | 5761 valueMap = collection.HashMap.new(); |
5776 } | 5762 } |
5777 } else { | 5763 } else { |
5778 valueMap = new collection.HashMap.from(zoneValues); | 5764 valueMap = collection.HashMap.from(zoneValues); |
5779 } | 5765 } |
5780 return new _CustomZone(dart.as(zone, _Zone), specification, valueMap); | 5766 return new _CustomZone(dart.as(zone, _Zone), specification, valueMap); |
5781 } | 5767 } |
5782 dart.fn(_rootFork, Zone, [Zone, ZoneDelegate, Zone, ZoneSpecification, core.Ma
p]); | 5768 dart.fn(_rootFork, Zone, [Zone, ZoneDelegate, Zone, ZoneSpecification, core.Ma
p]); |
5783 class _RootZoneSpecification extends core.Object { | 5769 class _RootZoneSpecification extends core.Object { |
5784 get handleUncaughtError() { | 5770 get handleUncaughtError() { |
5785 return _rootHandleUncaughtError; | 5771 return _rootHandleUncaughtError; |
5786 } | 5772 } |
5787 get run() { | 5773 get run() { |
5788 return _rootRun; | 5774 return _rootRun; |
(...skipping 29 matching lines...) Expand all Loading... |
5818 return _rootPrint; | 5804 return _rootPrint; |
5819 } | 5805 } |
5820 get fork() { | 5806 get fork() { |
5821 return _rootFork; | 5807 return _rootFork; |
5822 } | 5808 } |
5823 } | 5809 } |
5824 _RootZoneSpecification[dart.implements] = () => [ZoneSpecification]; | 5810 _RootZoneSpecification[dart.implements] = () => [ZoneSpecification]; |
5825 _RootZone._rootDelegate = null; | 5811 _RootZone._rootDelegate = null; |
5826 dart.defineLazyProperties(_RootZone, { | 5812 dart.defineLazyProperties(_RootZone, { |
5827 get _rootMap() { | 5813 get _rootMap() { |
5828 return new collection.HashMap(); | 5814 return collection.HashMap.new(); |
5829 }, | 5815 }, |
5830 set _rootMap(_) {} | 5816 set _rootMap(_) {} |
5831 }); | 5817 }); |
5832 function runZoned(body, opts) { | 5818 function runZoned(body, opts) { |
5833 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; | 5819 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; |
5834 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci
fication : null; | 5820 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci
fication : null; |
5835 let onError = opts && 'onError' in opts ? opts.onError : null; | 5821 let onError = opts && 'onError' in opts ? opts.onError : null; |
5836 let errorHandler = null; | 5822 let errorHandler = null; |
5837 if (onError != null) { | 5823 if (onError != null) { |
5838 errorHandler = dart.fn((self, parent, zone, error, stackTrace) => { | 5824 errorHandler = dart.fn((self, parent, zone, error, stackTrace) => { |
5839 try { | 5825 try { |
5840 if (dart.is(onError, ZoneBinaryCallback)) { | 5826 if (dart.is(onError, ZoneBinaryCallback)) { |
5841 return self.parent.runBinary(onError, error, stackTrace); | 5827 return self.parent.runBinary(onError, error, stackTrace); |
5842 } | 5828 } |
5843 return self.parent.runUnary(dart.as(onError, __CastType38), error); | 5829 return self.parent.runUnary(dart.as(onError, __CastType38), error); |
5844 } catch (e) { | 5830 } catch (e) { |
5845 let s = dart.stackTrace(e); | 5831 let s = dart.stackTrace(e); |
5846 if (core.identical(e, error)) { | 5832 if (core.identical(e, error)) { |
5847 return parent.handleUncaughtError(zone, error, stackTrace); | 5833 return parent.handleUncaughtError(zone, error, stackTrace); |
5848 } else { | 5834 } else { |
5849 return parent.handleUncaughtError(zone, e, s); | 5835 return parent.handleUncaughtError(zone, e, s); |
5850 } | 5836 } |
5851 } | 5837 } |
5852 | 5838 |
5853 }, core.Object, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace]); | 5839 }, core.Object, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace]); |
5854 } | 5840 } |
5855 if (zoneSpecification == null) { | 5841 if (zoneSpecification == null) { |
5856 zoneSpecification = new ZoneSpecification({handleUncaughtError: errorHandl
er}); | 5842 zoneSpecification = ZoneSpecification.new({handleUncaughtError: errorHandl
er}); |
5857 } else if (errorHandler != null) { | 5843 } else if (errorHandler != null) { |
5858 zoneSpecification = new ZoneSpecification.from(zoneSpecification, {handleU
ncaughtError: errorHandler}); | 5844 zoneSpecification = ZoneSpecification.from(zoneSpecification, {handleUncau
ghtError: errorHandler}); |
5859 } | 5845 } |
5860 let zone = Zone.current.fork({specification: zoneSpecification, zoneValues:
zoneValues}); | 5846 let zone = Zone.current.fork({specification: zoneSpecification, zoneValues:
zoneValues}); |
5861 if (onError != null) { | 5847 if (onError != null) { |
5862 return zone.runGuarded(body); | 5848 return zone.runGuarded(body); |
5863 } else { | 5849 } else { |
5864 return zone.run(body); | 5850 return zone.run(body); |
5865 } | 5851 } |
5866 } | 5852 } |
5867 dart.fn(runZoned, core.Object, [dart.functionType(core.Object, [])], {zoneValu
es: core.Map, zoneSpecification: ZoneSpecification, onError: core.Function}); | 5853 dart.fn(runZoned, core.Object, [dart.functionType(core.Object, [])], {zoneValu
es: core.Map, zoneSpecification: ZoneSpecification, onError: core.Function}); |
5868 let __CastType36 = dart.typedef('__CastType36', () => dart.functionType(dart.v
oid, [Timer])); | 5854 let __CastType36 = dart.typedef('__CastType36', () => dart.functionType(dart.v
oid, [Timer])); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5915 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; | 5901 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; |
5916 exports.CreateTimerHandler = CreateTimerHandler; | 5902 exports.CreateTimerHandler = CreateTimerHandler; |
5917 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; | 5903 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; |
5918 exports.PrintHandler = PrintHandler; | 5904 exports.PrintHandler = PrintHandler; |
5919 exports.ForkHandler = ForkHandler; | 5905 exports.ForkHandler = ForkHandler; |
5920 exports.ZoneSpecification = ZoneSpecification; | 5906 exports.ZoneSpecification = ZoneSpecification; |
5921 exports.ZoneDelegate = ZoneDelegate; | 5907 exports.ZoneDelegate = ZoneDelegate; |
5922 exports.Zone = Zone; | 5908 exports.Zone = Zone; |
5923 exports.runZoned = runZoned; | 5909 exports.runZoned = runZoned; |
5924 })(async, core, _internal, _js_helper, _isolate_helper, collection); | 5910 })(async, core, _internal, _js_helper, _isolate_helper, collection); |
OLD | NEW |