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

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

Issue 1767803002: a few small refactorings to closure workarounds (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « lib/runtime/dart/_native_typed_data.js ('k') | lib/runtime/dart/collection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/async', null, /* Imports */[ 1 dart_library.library('dart/async', null, /* Imports */[
2 'dart/_runtime', 2 'dart/_runtime',
3 'dart/core', 3 'dart/core',
4 'dart/_internal', 4 'dart/_internal',
5 'dart/collection' 5 'dart/collection'
6 ], /* Lazy imports */[ 6 ], /* Lazy imports */[
7 'dart/_isolate_helper' 7 'dart/_isolate_helper'
8 ], function(exports, dart, core, _internal, collection, _isolate_helper) { 8 ], function(exports, dart, core, _internal, collection, _isolate_helper) {
9 'use strict'; 9 'use strict';
10 let dartx = dart.dartx; 10 let dartx = dart.dartx;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 return result; 56 return result;
57 } 57 }
58 } 58 }
59 dart.setSignature(_UncaughtAsyncError, { 59 dart.setSignature(_UncaughtAsyncError, {
60 constructors: () => ({_UncaughtAsyncError: [_UncaughtAsyncError, [dart.dynam ic, core.StackTrace]]}), 60 constructors: () => ({_UncaughtAsyncError: [_UncaughtAsyncError, [dart.dynam ic, core.StackTrace]]}),
61 statics: () => ({_getBestStackTrace: [core.StackTrace, [dart.dynamic, core.S tackTrace]]}), 61 statics: () => ({_getBestStackTrace: [core.StackTrace, [dart.dynamic, core.S tackTrace]]}),
62 names: ['_getBestStackTrace'] 62 names: ['_getBestStackTrace']
63 }); 63 });
64 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d ynamic, [dart.dynamic])); 64 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d ynamic, [dart.dynamic]));
65 const _controller = Symbol('_controller');
66 const _subscribe = Symbol('_subscribe');
67 const _createSubscription = Symbol('_createSubscription');
68 const _onListen = Symbol('_onListen');
65 const _add = Symbol('_add'); 69 const _add = Symbol('_add');
66 const _closeUnchecked = Symbol('_closeUnchecked'); 70 const _closeUnchecked = Symbol('_closeUnchecked');
67 const _addError = Symbol('_addError'); 71 const _addError = Symbol('_addError');
68 const _completeError = Symbol('_completeError'); 72 const _completeError = Symbol('_completeError');
69 const _complete = Symbol('_complete'); 73 const _complete = Symbol('_complete');
70 const _sink = Symbol('_sink'); 74 const _sink = Symbol('_sink');
71 const Stream$ = dart.generic(function(T) { 75 const Stream$ = dart.generic(function(T) {
72 class Stream extends core.Object { 76 class Stream extends core.Object {
73 Stream() { 77 Stream() {
74 } 78 }
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 firstWhere: [Future, [dart.functionType(core.bool, [T])], {defaultValue: dart.functionType(core.Object, [])}], 751 firstWhere: [Future, [dart.functionType(core.bool, [T])], {defaultValue: dart.functionType(core.Object, [])}],
748 lastWhere: [Future, [dart.functionType(core.bool, [T])], {defaultValue: dart.functionType(core.Object, [])}], 752 lastWhere: [Future, [dart.functionType(core.bool, [T])], {defaultValue: dart.functionType(core.Object, [])}],
749 singleWhere: [Future$(T), [dart.functionType(core.bool, [T])]], 753 singleWhere: [Future$(T), [dart.functionType(core.bool, [T])]],
750 elementAt: [Future$(T), [core.int]], 754 elementAt: [Future$(T), [core.int]],
751 timeout: [Stream$(), [core.Duration], {onTimeout: dart.functionType(dart .void, [EventSink])}] 755 timeout: [Stream$(), [core.Duration], {onTimeout: dart.functionType(dart .void, [EventSink])}]
752 }) 756 })
753 }); 757 });
754 return Stream; 758 return Stream;
755 }); 759 });
756 let Stream = Stream$(); 760 let Stream = Stream$();
757 const _createSubscription = Symbol('_createSubscription');
758 const _onListen = Symbol('_onListen');
759 const _StreamImpl$ = dart.generic(function(T) { 761 const _StreamImpl$ = dart.generic(function(T) {
760 class _StreamImpl extends Stream$(T) { 762 class _StreamImpl extends Stream$(T) {
761 _StreamImpl() { 763 _StreamImpl() {
762 super.Stream(); 764 super.Stream();
763 } 765 }
764 listen(onData, opts) { 766 listen(onData, opts) {
765 dart.as(onData, dart.functionType(dart.void, [T])); 767 dart.as(onData, dart.functionType(dart.void, [T]));
766 let onError = opts && 'onError' in opts ? opts.onError : null; 768 let onError = opts && 'onError' in opts ? opts.onError : null;
767 let onDone = opts && 'onDone' in opts ? opts.onDone : null; 769 let onDone = opts && 'onDone' in opts ? opts.onDone : null;
768 dart.as(onDone, dart.functionType(dart.void, [])); 770 dart.as(onDone, dart.functionType(dart.void, []));
(...skipping 13 matching lines...) Expand all
782 dart.setSignature(_StreamImpl, { 784 dart.setSignature(_StreamImpl, {
783 methods: () => ({ 785 methods: () => ({
784 listen: [StreamSubscription$(T), [dart.functionType(dart.void, [T])], {o nError: core.Function, onDone: dart.functionType(dart.void, []), cancelOnError: core.bool}], 786 listen: [StreamSubscription$(T), [dart.functionType(dart.void, [T])], {o nError: core.Function, onDone: dart.functionType(dart.void, []), cancelOnError: core.bool}],
785 [_createSubscription]: [StreamSubscription$(T), [dart.functionType(dart. void, [T]), core.Function, dart.functionType(dart.void, []), core.bool]], 787 [_createSubscription]: [StreamSubscription$(T), [dart.functionType(dart. void, [T]), core.Function, dart.functionType(dart.void, []), core.bool]],
786 [_onListen]: [dart.void, [StreamSubscription]] 788 [_onListen]: [dart.void, [StreamSubscription]]
787 }) 789 })
788 }); 790 });
789 return _StreamImpl; 791 return _StreamImpl;
790 }); 792 });
791 let _StreamImpl = _StreamImpl$(); 793 let _StreamImpl = _StreamImpl$();
792 const _controller = Symbol('_controller');
793 const _subscribe = Symbol('_subscribe');
794 const _ControllerStream$ = dart.generic(function(T) { 794 const _ControllerStream$ = dart.generic(function(T) {
795 class _ControllerStream extends _StreamImpl$(T) { 795 class _ControllerStream extends _StreamImpl$(T) {
796 _ControllerStream(controller) { 796 _ControllerStream(controller) {
797 this[_controller] = controller; 797 this[_controller] = controller;
798 } 798 }
799 [_createSubscription](onData, onError, onDone, cancelOnError) { 799 [_createSubscription](onData, onError, onDone, cancelOnError) {
800 dart.as(onData, dart.functionType(dart.void, [T])); 800 dart.as(onData, dart.functionType(dart.void, [T]));
801 dart.as(onDone, dart.functionType(dart.void, [])); 801 dart.as(onDone, dart.functionType(dart.void, []));
802 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr ror); 802 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr ror);
803 } 803 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 }); 837 });
838 let _BroadcastStream = _BroadcastStream$(); 838 let _BroadcastStream = _BroadcastStream$();
839 const _next = Symbol('_next'); 839 const _next = Symbol('_next');
840 const _previous = Symbol('_previous'); 840 const _previous = Symbol('_previous');
841 class _BroadcastSubscriptionLink extends core.Object { 841 class _BroadcastSubscriptionLink extends core.Object {
842 _BroadcastSubscriptionLink() { 842 _BroadcastSubscriptionLink() {
843 this[_next] = null; 843 this[_next] = null;
844 this[_previous] = null; 844 this[_previous] = null;
845 } 845 }
846 } 846 }
847 const _eventState = Symbol('_eventState');
848 const _expectsEvent = Symbol('_expectsEvent');
849 const _toggleEventId = Symbol('_toggleEventId');
850 const _isFiring = Symbol('_isFiring');
851 const _setRemoveAfterFiring = Symbol('_setRemoveAfterFiring');
852 const _removeAfterFiring = Symbol('_removeAfterFiring');
853 const _onPause = Symbol('_onPause');
854 const _onResume = Symbol('_onResume');
855 const _recordCancel = Symbol('_recordCancel');
856 const _onCancel = Symbol('_onCancel');
857 const _recordPause = Symbol('_recordPause');
858 const _recordResume = Symbol('_recordResume');
847 const _zone = Symbol('_zone'); 859 const _zone = Symbol('_zone');
848 const _state = Symbol('_state'); 860 const _state = Symbol('_state');
849 const _onData = Symbol('_onData'); 861 const _onData = Symbol('_onData');
850 const _onError = Symbol('_onError'); 862 const _onError = Symbol('_onError');
851 const _onDone = Symbol('_onDone'); 863 const _onDone = Symbol('_onDone');
852 const _cancelFuture = Symbol('_cancelFuture'); 864 const _cancelFuture = Symbol('_cancelFuture');
853 const _pending = Symbol('_pending'); 865 const _pending = Symbol('_pending');
854 const _setPendingEvents = Symbol('_setPendingEvents'); 866 const _setPendingEvents = Symbol('_setPendingEvents');
855 const _isCanceled = Symbol('_isCanceled'); 867 const _isCanceled = Symbol('_isCanceled');
856 const _extractPending = Symbol('_extractPending'); 868 const _extractPending = Symbol('_extractPending');
857 const _isPaused = Symbol('_isPaused'); 869 const _isPaused = Symbol('_isPaused');
858 const _isInputPaused = Symbol('_isInputPaused'); 870 const _isInputPaused = Symbol('_isInputPaused');
859 const _inCallback = Symbol('_inCallback'); 871 const _inCallback = Symbol('_inCallback');
860 const _guardCallback = Symbol('_guardCallback'); 872 const _guardCallback = Symbol('_guardCallback');
861 const _onPause = Symbol('_onPause');
862 const _decrementPauseCount = Symbol('_decrementPauseCount'); 873 const _decrementPauseCount = Symbol('_decrementPauseCount');
863 const _hasPending = Symbol('_hasPending'); 874 const _hasPending = Symbol('_hasPending');
864 const _mayResumeInput = Symbol('_mayResumeInput'); 875 const _mayResumeInput = Symbol('_mayResumeInput');
865 const _onResume = Symbol('_onResume');
866 const _cancel = Symbol('_cancel'); 876 const _cancel = Symbol('_cancel');
867 const _isClosed = Symbol('_isClosed'); 877 const _isClosed = Symbol('_isClosed');
868 const _waitsForCancel = Symbol('_waitsForCancel'); 878 const _waitsForCancel = Symbol('_waitsForCancel');
869 const _canFire = Symbol('_canFire'); 879 const _canFire = Symbol('_canFire');
870 const _cancelOnError = Symbol('_cancelOnError'); 880 const _cancelOnError = Symbol('_cancelOnError');
871 const _onCancel = Symbol('_onCancel');
872 const _incrementPauseCount = Symbol('_incrementPauseCount'); 881 const _incrementPauseCount = Symbol('_incrementPauseCount');
873 const _sendData = Symbol('_sendData'); 882 const _sendData = Symbol('_sendData');
874 const _addPending = Symbol('_addPending'); 883 const _addPending = Symbol('_addPending');
875 const _sendError = Symbol('_sendError'); 884 const _sendError = Symbol('_sendError');
876 const _sendDone = Symbol('_sendDone'); 885 const _sendDone = Symbol('_sendDone');
877 const _close = Symbol('_close'); 886 const _close = Symbol('_close');
878 const _checkState = Symbol('_checkState'); 887 const _checkState = Symbol('_checkState');
879 const _BufferingStreamSubscription$ = dart.generic(function(T) { 888 const _BufferingStreamSubscription$ = dart.generic(function(T) {
880 class _BufferingStreamSubscription extends core.Object { 889 class _BufferingStreamSubscription extends core.Object {
881 _BufferingStreamSubscription(onData, onError, onDone, cancelOnError) { 890 _BufferingStreamSubscription(onData, onError, onDone, cancelOnError) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 _BufferingStreamSubscription._STATE_INPUT_PAUSED = 4; 1199 _BufferingStreamSubscription._STATE_INPUT_PAUSED = 4;
1191 _BufferingStreamSubscription._STATE_CANCELED = 8; 1200 _BufferingStreamSubscription._STATE_CANCELED = 8;
1192 _BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL = 16; 1201 _BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL = 16;
1193 _BufferingStreamSubscription._STATE_IN_CALLBACK = 32; 1202 _BufferingStreamSubscription._STATE_IN_CALLBACK = 32;
1194 _BufferingStreamSubscription._STATE_HAS_PENDING = 64; 1203 _BufferingStreamSubscription._STATE_HAS_PENDING = 64;
1195 _BufferingStreamSubscription._STATE_PAUSE_COUNT = 128; 1204 _BufferingStreamSubscription._STATE_PAUSE_COUNT = 128;
1196 _BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7; 1205 _BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7;
1197 return _BufferingStreamSubscription; 1206 return _BufferingStreamSubscription;
1198 }); 1207 });
1199 let _BufferingStreamSubscription = _BufferingStreamSubscription$(); 1208 let _BufferingStreamSubscription = _BufferingStreamSubscription$();
1200 const _recordCancel = Symbol('_recordCancel');
1201 const _recordPause = Symbol('_recordPause');
1202 const _recordResume = Symbol('_recordResume');
1203 const _ControllerSubscription$ = dart.generic(function(T) { 1209 const _ControllerSubscription$ = dart.generic(function(T) {
1204 class _ControllerSubscription extends _BufferingStreamSubscription$(T) { 1210 class _ControllerSubscription extends _BufferingStreamSubscription$(T) {
1205 _ControllerSubscription(controller, onData, onError, onDone, cancelOnError ) { 1211 _ControllerSubscription(controller, onData, onError, onDone, cancelOnError ) {
1206 this[_controller] = controller; 1212 this[_controller] = controller;
1207 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 1213 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
1208 } 1214 }
1209 [_onCancel]() { 1215 [_onCancel]() {
1210 return this[_controller][_recordCancel](this); 1216 return this[_controller][_recordCancel](this);
1211 } 1217 }
1212 [_onPause]() { 1218 [_onPause]() {
1213 this[_controller][_recordPause](this); 1219 this[_controller][_recordPause](this);
1214 } 1220 }
1215 [_onResume]() { 1221 [_onResume]() {
1216 this[_controller][_recordResume](this); 1222 this[_controller][_recordResume](this);
1217 } 1223 }
1218 } 1224 }
1219 dart.setSignature(_ControllerSubscription, { 1225 dart.setSignature(_ControllerSubscription, {
1220 constructors: () => ({_ControllerSubscription: [_ControllerSubscription$(T ), [_StreamControllerLifecycle$(T), dart.functionType(dart.void, [T]), core.Func tion, dart.functionType(dart.void, []), core.bool]]}) 1226 constructors: () => ({_ControllerSubscription: [_ControllerSubscription$(T ), [_StreamControllerLifecycle$(T), dart.functionType(dart.void, [T]), core.Func tion, dart.functionType(dart.void, []), core.bool]]})
1221 }); 1227 });
1222 return _ControllerSubscription; 1228 return _ControllerSubscription;
1223 }); 1229 });
1224 let _ControllerSubscription = _ControllerSubscription$(); 1230 let _ControllerSubscription = _ControllerSubscription$();
1225 const _eventState = Symbol('_eventState');
1226 const _expectsEvent = Symbol('_expectsEvent');
1227 const _toggleEventId = Symbol('_toggleEventId');
1228 const _isFiring = Symbol('_isFiring');
1229 const _setRemoveAfterFiring = Symbol('_setRemoveAfterFiring');
1230 const _removeAfterFiring = Symbol('_removeAfterFiring');
1231 const _BroadcastSubscription$ = dart.generic(function(T) { 1231 const _BroadcastSubscription$ = dart.generic(function(T) {
1232 class _BroadcastSubscription extends _ControllerSubscription$(T) { 1232 class _BroadcastSubscription extends _ControllerSubscription$(T) {
1233 _BroadcastSubscription(controller, onData, onError, onDone, cancelOnError) { 1233 _BroadcastSubscription(controller, onData, onError, onDone, cancelOnError) {
1234 this[_eventState] = null; 1234 this[_eventState] = null;
1235 this[_next] = null; 1235 this[_next] = null;
1236 this[_previous] = null; 1236 this[_previous] = null;
1237 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError); 1237 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError);
1238 this[_next] = this[_previous] = this; 1238 this[_next] = this[_previous] = this;
1239 } 1239 }
1240 [_expectsEvent](eventId) { 1240 [_expectsEvent](eventId) {
(...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after
3457 return _; 3457 return _;
3458 } 3458 }
3459 } 3459 }
3460 dart.setSignature(_GeneratedStreamImpl, { 3460 dart.setSignature(_GeneratedStreamImpl, {
3461 constructors: () => ({_GeneratedStreamImpl: [_GeneratedStreamImpl$(T), [_E ventGenerator]]}), 3461 constructors: () => ({_GeneratedStreamImpl: [_GeneratedStreamImpl$(T), [_E ventGenerator]]}),
3462 methods: () => ({[_createSubscription]: [StreamSubscription$(T), [dart.fun ctionType(dart.void, [T]), core.Function, dart.functionType(dart.void, []), core .bool]]}) 3462 methods: () => ({[_createSubscription]: [StreamSubscription$(T), [dart.fun ctionType(dart.void, [T]), core.Function, dart.functionType(dart.void, []), core .bool]]})
3463 }); 3463 });
3464 return _GeneratedStreamImpl; 3464 return _GeneratedStreamImpl;
3465 }); 3465 });
3466 let _GeneratedStreamImpl = _GeneratedStreamImpl$(); 3466 let _GeneratedStreamImpl = _GeneratedStreamImpl$();
3467 const _iterator = Symbol('_iterator');
3467 const _eventScheduled = Symbol('_eventScheduled'); 3468 const _eventScheduled = Symbol('_eventScheduled');
3468 class _PendingEvents extends core.Object { 3469 class _PendingEvents extends core.Object {
3469 _PendingEvents() { 3470 _PendingEvents() {
3470 this[_state] = _PendingEvents._STATE_UNSCHEDULED; 3471 this[_state] = _PendingEvents._STATE_UNSCHEDULED;
3471 } 3472 }
3472 get isScheduled() { 3473 get isScheduled() {
3473 return this[_state] == _PendingEvents._STATE_SCHEDULED; 3474 return this[_state] == _PendingEvents._STATE_SCHEDULED;
3474 } 3475 }
3475 get [_eventScheduled]() { 3476 get [_eventScheduled]() {
3476 return dart.notNull(this[_state]) >= dart.notNull(_PendingEvents._STATE_SC HEDULED); 3477 return dart.notNull(this[_state]) >= dart.notNull(_PendingEvents._STATE_SC HEDULED);
(...skipping 20 matching lines...) Expand all
3497 } 3498 }
3498 dart.setSignature(_PendingEvents, { 3499 dart.setSignature(_PendingEvents, {
3499 methods: () => ({ 3500 methods: () => ({
3500 schedule: [dart.void, [_EventDispatch]], 3501 schedule: [dart.void, [_EventDispatch]],
3501 cancelSchedule: [dart.void, []] 3502 cancelSchedule: [dart.void, []]
3502 }) 3503 })
3503 }); 3504 });
3504 _PendingEvents._STATE_UNSCHEDULED = 0; 3505 _PendingEvents._STATE_UNSCHEDULED = 0;
3505 _PendingEvents._STATE_SCHEDULED = 1; 3506 _PendingEvents._STATE_SCHEDULED = 1;
3506 _PendingEvents._STATE_CANCELED = 3; 3507 _PendingEvents._STATE_CANCELED = 3;
3507 const _iterator = Symbol('_iterator');
3508 const _IterablePendingEvents$ = dart.generic(function(T) { 3508 const _IterablePendingEvents$ = dart.generic(function(T) {
3509 class _IterablePendingEvents extends _PendingEvents { 3509 class _IterablePendingEvents extends _PendingEvents {
3510 _IterablePendingEvents(data) { 3510 _IterablePendingEvents(data) {
3511 this[_iterator] = data[dartx.iterator]; 3511 this[_iterator] = data[dartx.iterator];
3512 super._PendingEvents(); 3512 super._PendingEvents();
3513 } 3513 }
3514 get isEmpty() { 3514 get isEmpty() {
3515 return this[_iterator] == null; 3515 return this[_iterator] == null;
3516 } 3516 }
3517 handleNext(dispatch) { 3517 handleNext(dispatch) {
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after
5779 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5779 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5780 exports.CreateTimerHandler = CreateTimerHandler; 5780 exports.CreateTimerHandler = CreateTimerHandler;
5781 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5781 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5782 exports.PrintHandler = PrintHandler; 5782 exports.PrintHandler = PrintHandler;
5783 exports.ForkHandler = ForkHandler; 5783 exports.ForkHandler = ForkHandler;
5784 exports.ZoneSpecification = ZoneSpecification; 5784 exports.ZoneSpecification = ZoneSpecification;
5785 exports.ZoneDelegate = ZoneDelegate; 5785 exports.ZoneDelegate = ZoneDelegate;
5786 exports.Zone = Zone; 5786 exports.Zone = Zone;
5787 exports.runZoned = runZoned; 5787 exports.runZoned = runZoned;
5788 }); 5788 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_native_typed_data.js ('k') | lib/runtime/dart/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698