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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 let future = new (_Future$(core.bool))(); | 406 let future = new (_Future$(core.bool))(); |
407 let subscription = null; | 407 let subscription = null; |
408 subscription = this.listen(dart.fn(_ => { | 408 subscription = this.listen(dart.fn(_ => { |
409 _cancelAndValue(subscription, future, false); | 409 _cancelAndValue(subscription, future, false); |
410 }), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => { | 410 }), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => { |
411 future[_complete](true); | 411 future[_complete](true); |
412 }), cancelOnError: true}); | 412 }), cancelOnError: true}); |
413 return future; | 413 return future; |
414 } | 414 } |
415 toList() { | 415 toList() { |
416 let result = dart.setType([], core.List$(T)); | 416 let result = dart.list([], T); |
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[dartx.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 = core.Set$(T).new(); | 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); |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 result[_completeError](error, stackTrace); | 1907 result[_completeError](error, stackTrace); |
1908 } | 1908 } |
1909 }; | 1909 }; |
1910 dart.fn(handleError, dart.void, [core.Object, core.Object]); | 1910 dart.fn(handleError, dart.void, [core.Object, core.Object]); |
1911 for (let future of futures) { | 1911 for (let future of futures) { |
1912 let pos = remaining; | 1912 let pos = remaining; |
1913 remaining = dart.notNull(pos) + 1; | 1913 remaining = dart.notNull(pos) + 1; |
1914 future.then(dart.fn(value => { | 1914 future.then(dart.fn(value => { |
1915 remaining = dart.notNull(remaining) - 1; | 1915 remaining = dart.notNull(remaining) - 1; |
1916 if (values != null) { | 1916 if (values != null) { |
1917 values[core.$set](pos, value); | 1917 values[dartx.set](pos, value); |
1918 if (remaining == 0) { | 1918 if (remaining == 0) { |
1919 result[_completeWithValue](values); | 1919 result[_completeWithValue](values); |
1920 } | 1920 } |
1921 } else { | 1921 } else { |
1922 if (dart.notNull(cleanUp != null) && dart.notNull(value != null))
{ | 1922 if (dart.notNull(cleanUp != null) && dart.notNull(value != null))
{ |
1923 Future$().sync(dart.fn(() => { | 1923 Future$().sync(dart.fn(() => { |
1924 dart.dcall(cleanUp, value); | 1924 dart.dcall(cleanUp, value); |
1925 })); | 1925 })); |
1926 } | 1926 } |
1927 if (remaining == 0 && !dart.notNull(eagerError)) { | 1927 if (remaining == 0 && !dart.notNull(eagerError)) { |
1928 result[_completeError](error, stackTrace); | 1928 result[_completeError](error, stackTrace); |
1929 } | 1929 } |
1930 } | 1930 } |
1931 }, core.Object, [core.Object]), {onError: handleError}); | 1931 }, core.Object, [core.Object]), {onError: handleError}); |
1932 } | 1932 } |
1933 if (remaining == 0) { | 1933 if (remaining == 0) { |
1934 return Future$(core.List).value(dart.const([])); | 1934 return Future$(core.List).value(dart.const([])); |
1935 } | 1935 } |
1936 values = core.List.new(remaining); | 1936 values = core.List.new(remaining); |
1937 return result; | 1937 return result; |
1938 } | 1938 } |
1939 static forEach(input, f) { | 1939 static forEach(input, f) { |
1940 dart.as(f, dart.functionType(core.Object, [dart.bottom])); | 1940 dart.as(f, dart.functionType(core.Object, [dart.bottom])); |
1941 let iterator = input[core.$iterator]; | 1941 let iterator = input[dartx.iterator]; |
1942 return Future$().doWhile(dart.fn(() => { | 1942 return Future$().doWhile(dart.fn(() => { |
1943 if (!dart.notNull(iterator.moveNext())) | 1943 if (!dart.notNull(iterator.moveNext())) |
1944 return false; | 1944 return false; |
1945 return Future$().sync(dart.fn(() => dart.dcall(f, iterator.current))).
then(dart.fn(_ => true, core.bool, [core.Object])); | 1945 return Future$().sync(dart.fn(() => dart.dcall(f, iterator.current))).
then(dart.fn(_ => true, core.bool, [core.Object])); |
1946 })); | 1946 })); |
1947 } | 1947 } |
1948 static doWhile(f) { | 1948 static doWhile(f) { |
1949 dart.as(f, dart.functionType(core.Object, [])); | 1949 dart.as(f, dart.functionType(core.Object, [])); |
1950 let doneSignal = new _Future(); | 1950 let doneSignal = new _Future(); |
1951 let nextIteration = null; | 1951 let nextIteration = null; |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3569 dart.setSignature(_PendingEvents, { | 3569 dart.setSignature(_PendingEvents, { |
3570 methods: () => ({ | 3570 methods: () => ({ |
3571 schedule: [dart.void, [_EventDispatch]], | 3571 schedule: [dart.void, [_EventDispatch]], |
3572 cancelSchedule: [dart.void, []] | 3572 cancelSchedule: [dart.void, []] |
3573 }) | 3573 }) |
3574 }); | 3574 }); |
3575 let _iterator = Symbol('_iterator'); | 3575 let _iterator = Symbol('_iterator'); |
3576 let _IterablePendingEvents$ = dart.generic(function(T) { | 3576 let _IterablePendingEvents$ = dart.generic(function(T) { |
3577 class _IterablePendingEvents extends _PendingEvents { | 3577 class _IterablePendingEvents extends _PendingEvents { |
3578 _IterablePendingEvents(data) { | 3578 _IterablePendingEvents(data) { |
3579 this[_iterator] = data[core.$iterator]; | 3579 this[_iterator] = data[dartx.iterator]; |
3580 super._PendingEvents(); | 3580 super._PendingEvents(); |
3581 } | 3581 } |
3582 get isEmpty() { | 3582 get isEmpty() { |
3583 return this[_iterator] == null; | 3583 return this[_iterator] == null; |
3584 } | 3584 } |
3585 handleNext(dispatch) { | 3585 handleNext(dispatch) { |
3586 if (this[_iterator] == null) { | 3586 if (this[_iterator] == null) { |
3587 throw new core.StateError("No events pending."); | 3587 throw new core.StateError("No events pending."); |
3588 } | 3588 } |
3589 let isDone = null; | 3589 let isDone = null; |
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5901 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; | 5901 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; |
5902 exports.CreateTimerHandler = CreateTimerHandler; | 5902 exports.CreateTimerHandler = CreateTimerHandler; |
5903 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; | 5903 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; |
5904 exports.PrintHandler = PrintHandler; | 5904 exports.PrintHandler = PrintHandler; |
5905 exports.ForkHandler = ForkHandler; | 5905 exports.ForkHandler = ForkHandler; |
5906 exports.ZoneSpecification = ZoneSpecification; | 5906 exports.ZoneSpecification = ZoneSpecification; |
5907 exports.ZoneDelegate = ZoneDelegate; | 5907 exports.ZoneDelegate = ZoneDelegate; |
5908 exports.Zone = Zone; | 5908 exports.Zone = Zone; |
5909 exports.runZoned = runZoned; | 5909 exports.runZoned = runZoned; |
5910 })(async, core, _internal, _js_helper, _isolate_helper, collection); | 5910 })(async, core, _internal, _js_helper, _isolate_helper, collection); |
OLD | NEW |