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

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

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var async; 1 var async;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic
5 function _invokeErrorHandler(errorHandler, error, stackTrace) { 5 function _invokeErrorHandler(errorHandler, error, stackTrace) {
6 if (dart.is(errorHandler, ZoneBinaryCallback)) { 6 if (dart.is(errorHandler, ZoneBinaryCallback)) {
7 return dart.dinvokef(errorHandler, error, stackTrace); 7 return dart.dinvokef(errorHandler, error, stackTrace);
8 } else { 8 } else {
9 return dart.dinvokef(errorHandler, error); 9 return dart.dinvokef(errorHandler, error);
10 } 10 }
(...skipping 25 matching lines...) Expand all
36 if (stackTrace != null) 36 if (stackTrace != null)
37 return stackTrace; 37 return stackTrace;
38 if (dart.is(error, core.Error)) { 38 if (dart.is(error, core.Error)) {
39 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace); 39 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace);
40 } 40 }
41 return null; 41 return null;
42 } 42 }
43 toString() { 43 toString() {
44 let result = `Uncaught Error: ${this.error}`; 44 let result = `Uncaught Error: ${this.error}`;
45 if (this.stackTrace != null) { 45 if (this.stackTrace != null) {
46 result = `\nStack Trace:\n${this.stackTrace}`; 46 result = core.String['+'](result, `\nStack Trace:\n${this.stackTrace}`);
47 } 47 }
48 return result; 48 return result;
49 } 49 }
50 } 50 }
51 let _controller = Symbol('_controller'); 51 let _controller = Symbol('_controller');
52 let _createSubscription = Symbol('_createSubscription'); 52 let _createSubscription = Symbol('_createSubscription');
53 let _subscribe = Symbol('_subscribe'); 53 let _subscribe = Symbol('_subscribe');
54 let _onListen = Symbol('_onListen'); 54 let _onListen = Symbol('_onListen');
55 let _add = Symbol('_add'); 55 let _add = Symbol('_add');
56 let _closeUnchecked = Symbol('_closeUnchecked'); 56 let _closeUnchecked = Symbol('_closeUnchecked');
(...skipping 26 matching lines...) Expand all
83 computation = null; 83 computation = null;
84 if (computation == null) 84 if (computation == null)
85 computation = dart.as((i) => null, dart.throw_("Unimplemented type (in t) → T")); 85 computation = dart.as((i) => null, dart.throw_("Unimplemented type (in t) → T"));
86 let timer = null; 86 let timer = null;
87 let computationCount = 0; 87 let computationCount = 0;
88 let controller = null; 88 let controller = null;
89 let watch = new core.Stopwatch(); 89 let watch = new core.Stopwatch();
90 // Function sendEvent: () → void 90 // Function sendEvent: () → void
91 function sendEvent() { 91 function sendEvent() {
92 watch.reset(); 92 watch.reset();
93 let data = computation(((x) => computationCount = dart.notNull(x) + 1, x)(computationCount)); 93 let data = computation(((x) => (x = computationCount, computationCount = dart.notNull(x) + 1, x))());
94 controller.add(data); 94 controller.add(data);
95 } 95 }
96 // Function startPeriodicTimer: () → void 96 // Function startPeriodicTimer: () → void
97 function startPeriodicTimer() { 97 function startPeriodicTimer() {
98 dart.assert(timer == null); 98 dart.assert(timer == null);
99 timer = new Timer.periodic(period, (timer) => { 99 timer = new Timer.periodic(period, (timer) => {
100 sendEvent(); 100 sendEvent();
101 }); 101 });
102 } 102 }
103 controller = new (StreamController$(T))({ 103 controller = new (StreamController$(T))({
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 if (dart.notNull(!(typeof index == 'number')) || dart.notNull(index) < 0 ) 682 if (dart.notNull(!(typeof index == 'number')) || dart.notNull(index) < 0 )
683 throw new core.ArgumentError(index); 683 throw new core.ArgumentError(index);
684 let future = new (_Future$(T))(); 684 let future = new (_Future$(T))();
685 let subscription = null; 685 let subscription = null;
686 let elementIndex = 0; 686 let elementIndex = 0;
687 subscription = this.listen((value) => { 687 subscription = this.listen((value) => {
688 if (index == elementIndex) { 688 if (index == elementIndex) {
689 _cancelAndValue(subscription, future, value); 689 _cancelAndValue(subscription, future, value);
690 return; 690 return;
691 } 691 }
692 elementIndex = 1; 692 elementIndex = dart.notNull(elementIndex) + 1;
693 }, { 693 }, {
694 onError: future[_completeError], 694 onError: future[_completeError],
695 onDone: (() => { 695 onDone: (() => {
696 future[_completeError](new core.RangeError.index(index, this, "index ", null, elementIndex)); 696 future[_completeError](new core.RangeError.index(index, this, "index ", null, elementIndex));
697 }).bind(this), 697 }).bind(this),
698 cancelOnError: true 698 cancelOnError: true
699 }); 699 });
700 return future; 700 return future;
701 } 701 }
702 timeout(timeLimit, opts) { 702 timeout(timeLimit, opts) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 this.onData(onData); 896 this.onData(onData);
897 this.onError(onError); 897 this.onError(onError);
898 this.onDone(onDone); 898 this.onDone(onDone);
899 } 899 }
900 [_setPendingEvents](pendingEvents) { 900 [_setPendingEvents](pendingEvents) {
901 dart.assert(this[_pending] == null); 901 dart.assert(this[_pending] == null);
902 if (pendingEvents == null) 902 if (pendingEvents == null)
903 return; 903 return;
904 this[_pending] = pendingEvents; 904 this[_pending] = pendingEvents;
905 if (!dart.notNull(pendingEvents.isEmpty)) { 905 if (!dart.notNull(pendingEvents.isEmpty)) {
906 this[_state] = _BufferingStreamSubscription[_STATE_HAS_PENDING]; 906 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_HAS_PENDING]);
907 this[_pending].schedule(this); 907 this[_pending].schedule(this);
908 } 908 }
909 } 909 }
910 [_extractPending]() { 910 [_extractPending]() {
911 dart.assert(this[_isCanceled]); 911 dart.assert(this[_isCanceled]);
912 let events = this[_pending]; 912 let events = this[_pending];
913 this[_pending] = null; 913 this[_pending] = null;
914 return events; 914 return events;
915 } 915 }
916 onData(handleData) { 916 onData(handleData) {
(...skipping 29 matching lines...) Expand all
946 resume() { 946 resume() {
947 if (this[_isCanceled]) 947 if (this[_isCanceled])
948 return; 948 return;
949 if (this[_isPaused]) { 949 if (this[_isPaused]) {
950 this[_decrementPauseCount](); 950 this[_decrementPauseCount]();
951 if (!dart.notNull(this[_isPaused])) { 951 if (!dart.notNull(this[_isPaused])) {
952 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) { 952 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) {
953 this[_pending].schedule(this); 953 this[_pending].schedule(this);
954 } else { 954 } else {
955 dart.assert(this[_mayResumeInput]); 955 dart.assert(this[_mayResumeInput]);
956 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_I NPUT_PAUSED]); 956 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi ngStreamSubscription[_STATE_INPUT_PAUSED]);
957 if (!dart.notNull(this[_inCallback])) 957 if (!dart.notNull(this[_inCallback]))
958 this[_guardCallback](this[_onResume]); 958 this[_guardCallback](this[_onResume]);
959 } 959 }
960 } 960 }
961 } 961 }
962 } 962 }
963 cancel() { 963 cancel() {
964 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_WAIT_FO R_CANCEL]); 964 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription[_STATE_WAIT_FOR_CANCEL]);
965 if (this[_isCanceled]) 965 if (this[_isCanceled])
966 return this[_cancelFuture]; 966 return this[_cancelFuture];
967 this[_cancel](); 967 this[_cancel]();
968 return this[_cancelFuture]; 968 return this[_cancelFuture];
969 } 969 }
970 asFuture(futureValue) { 970 asFuture(futureValue) {
971 if (futureValue === void 0) 971 if (futureValue === void 0)
972 futureValue = null; 972 futureValue = null;
973 let result = new (_Future$(T))(); 973 let result = new (_Future$(T))();
974 this[_onDone] = () => { 974 this[_onDone] = () => {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 get [_mayResumeInput]() { 1007 get [_mayResumeInput]() {
1008 return !dart.notNull(this[_isPaused]) && (dart.notNull(this[_pending] == null) || dart.notNull(this[_pending].isEmpty)); 1008 return !dart.notNull(this[_isPaused]) && (dart.notNull(this[_pending] == null) || dart.notNull(this[_pending].isEmpty));
1009 } 1009 }
1010 get [_cancelOnError]() { 1010 get [_cancelOnError]() {
1011 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr iption[_STATE_CANCEL_ON_ERROR])) != 0; 1011 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr iption[_STATE_CANCEL_ON_ERROR])) != 0;
1012 } 1012 }
1013 get isPaused() { 1013 get isPaused() {
1014 return this[_isPaused]; 1014 return this[_isPaused];
1015 } 1015 }
1016 [_cancel]() { 1016 [_cancel]() {
1017 this[_state] = _BufferingStreamSubscription[_STATE_CANCELED]; 1017 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_CANCELED]);
1018 if (this[_hasPending]) { 1018 if (this[_hasPending]) {
1019 this[_pending].cancelSchedule(); 1019 this[_pending].cancelSchedule();
1020 } 1020 }
1021 if (!dart.notNull(this[_inCallback])) 1021 if (!dart.notNull(this[_inCallback]))
1022 this[_pending] = null; 1022 this[_pending] = null;
1023 this[_cancelFuture] = this[_onCancel](); 1023 this[_cancelFuture] = this[_onCancel]();
1024 } 1024 }
1025 [_incrementPauseCount]() { 1025 [_incrementPauseCount]() {
1026 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription[_STATE_PAUSE_COUNT]) | dart.notNull(_BufferingStreamSubscription[_ STATE_INPUT_PAUSED]); 1026 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription[_STATE_PAUSE_COUNT]) | dart.notNull(_BufferingStreamSubscription[_ STATE_INPUT_PAUSED]);
1027 } 1027 }
1028 [_decrementPauseCount]() { 1028 [_decrementPauseCount]() {
1029 dart.assert(this[_isPaused]); 1029 dart.assert(this[_isPaused]);
1030 this[_state] = _BufferingStreamSubscription[_STATE_PAUSE_COUNT]; 1030 this[_state] = dart.notNull(this[_state]) - dart.notNull(_BufferingStrea mSubscription[_STATE_PAUSE_COUNT]);
1031 } 1031 }
1032 [_add](data) { 1032 [_add](data) {
1033 dart.assert(!dart.notNull(this[_isClosed])); 1033 dart.assert(!dart.notNull(this[_isClosed]));
1034 if (this[_isCanceled]) 1034 if (this[_isCanceled])
1035 return; 1035 return;
1036 if (this[_canFire]) { 1036 if (this[_canFire]) {
1037 this[_sendData](data); 1037 this[_sendData](data);
1038 } else { 1038 } else {
1039 this[_addPending](new _DelayedData(data)); 1039 this[_addPending](new _DelayedData(data));
1040 } 1040 }
1041 } 1041 }
1042 [_addError](error, stackTrace) { 1042 [_addError](error, stackTrace) {
1043 if (this[_isCanceled]) 1043 if (this[_isCanceled])
1044 return; 1044 return;
1045 if (this[_canFire]) { 1045 if (this[_canFire]) {
1046 this[_sendError](error, stackTrace); 1046 this[_sendError](error, stackTrace);
1047 } else { 1047 } else {
1048 this[_addPending](new _DelayedError(error, stackTrace)); 1048 this[_addPending](new _DelayedError(error, stackTrace));
1049 } 1049 }
1050 } 1050 }
1051 [_close]() { 1051 [_close]() {
1052 dart.assert(!dart.notNull(this[_isClosed])); 1052 dart.assert(!dart.notNull(this[_isClosed]));
1053 if (this[_isCanceled]) 1053 if (this[_isCanceled])
1054 return; 1054 return;
1055 this[_state] = _BufferingStreamSubscription[_STATE_CLOSED]; 1055 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_CLOSED]);
1056 if (this[_canFire]) { 1056 if (this[_canFire]) {
1057 this[_sendDone](); 1057 this[_sendDone]();
1058 } else { 1058 } else {
1059 this[_addPending](new _DelayedDone()); 1059 this[_addPending](new _DelayedDone());
1060 } 1060 }
1061 } 1061 }
1062 [_onPause]() { 1062 [_onPause]() {
1063 dart.assert(this[_isInputPaused]); 1063 dart.assert(this[_isInputPaused]);
1064 } 1064 }
1065 [_onResume]() { 1065 [_onResume]() {
1066 dart.assert(!dart.notNull(this[_isInputPaused])); 1066 dart.assert(!dart.notNull(this[_isInputPaused]));
1067 } 1067 }
1068 [_onCancel]() { 1068 [_onCancel]() {
1069 dart.assert(this[_isCanceled]); 1069 dart.assert(this[_isCanceled]);
1070 return null; 1070 return null;
1071 } 1071 }
1072 [_addPending](event) { 1072 [_addPending](event) {
1073 let pending = dart.as(this[_pending], _StreamImplEvents); 1073 let pending = dart.as(this[_pending], _StreamImplEvents);
1074 if (this[_pending] == null) 1074 if (this[_pending] == null)
1075 pending = this[_pending] = new _StreamImplEvents(); 1075 pending = this[_pending] = new _StreamImplEvents();
1076 pending.add(event); 1076 pending.add(event);
1077 if (!dart.notNull(this[_hasPending])) { 1077 if (!dart.notNull(this[_hasPending])) {
1078 this[_state] = _BufferingStreamSubscription[_STATE_HAS_PENDING]; 1078 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_HAS_PENDING]);
1079 if (!dart.notNull(this[_isPaused])) { 1079 if (!dart.notNull(this[_isPaused])) {
1080 this[_pending].schedule(this); 1080 this[_pending].schedule(this);
1081 } 1081 }
1082 } 1082 }
1083 } 1083 }
1084 [_sendData](data) { 1084 [_sendData](data) {
1085 dart.assert(!dart.notNull(this[_isCanceled])); 1085 dart.assert(!dart.notNull(this[_isCanceled]));
1086 dart.assert(!dart.notNull(this[_isPaused])); 1086 dart.assert(!dart.notNull(this[_isPaused]));
1087 dart.assert(!dart.notNull(this[_inCallback])); 1087 dart.assert(!dart.notNull(this[_inCallback]));
1088 let wasInputPaused = this[_isInputPaused]; 1088 let wasInputPaused = this[_isInputPaused];
1089 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1089 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_IN_CALLBACK]);
1090 this[_zone].runUnaryGuarded(this[_onData], data); 1090 this[_zone].runUnaryGuarded(this[_onData], data);
1091 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CALL BACK]); 1091 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription[_STATE_IN_CALLBACK]);
1092 this[_checkState](wasInputPaused); 1092 this[_checkState](wasInputPaused);
1093 } 1093 }
1094 [_sendError](error, stackTrace) { 1094 [_sendError](error, stackTrace) {
1095 dart.assert(!dart.notNull(this[_isCanceled])); 1095 dart.assert(!dart.notNull(this[_isCanceled]));
1096 dart.assert(!dart.notNull(this[_isPaused])); 1096 dart.assert(!dart.notNull(this[_isPaused]));
1097 dart.assert(!dart.notNull(this[_inCallback])); 1097 dart.assert(!dart.notNull(this[_inCallback]));
1098 let wasInputPaused = this[_isInputPaused]; 1098 let wasInputPaused = this[_isInputPaused];
1099 // Function sendError: () → void 1099 // Function sendError: () → void
1100 function sendError() { 1100 function sendError() {
1101 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel])) 1101 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel]))
1102 return; 1102 return;
1103 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1103 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_IN_CALLBACK]);
1104 if (dart.is(this[_onError], ZoneBinaryCallback)) { 1104 if (dart.is(this[_onError], ZoneBinaryCallback)) {
1105 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.throw_("Un implemented type (dynamic, dynamic) → dynamic")), error, stackTrace); 1105 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.throw_("Un implemented type (dynamic, dynamic) → dynamic")), error, stackTrace);
1106 } else { 1106 } else {
1107 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.throw_("Uni mplemented type (dynamic) → dynamic")), error); 1107 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.throw_("Uni mplemented type (dynamic) → dynamic")), error);
1108 } 1108 }
1109 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1109 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_IN_CALLBACK]);
1110 } 1110 }
1111 if (this[_cancelOnError]) { 1111 if (this[_cancelOnError]) {
1112 this[_state] = _BufferingStreamSubscription[_STATE_WAIT_FOR_CANCEL]; 1112 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_WAIT_FOR_CANCEL]);
1113 this[_cancel](); 1113 this[_cancel]();
1114 if (dart.is(this[_cancelFuture], Future)) { 1114 if (dart.is(this[_cancelFuture], Future)) {
1115 this[_cancelFuture].whenComplete(sendError); 1115 this[_cancelFuture].whenComplete(sendError);
1116 } else { 1116 } else {
1117 sendError(); 1117 sendError();
1118 } 1118 }
1119 } else { 1119 } else {
1120 sendError(); 1120 sendError();
1121 this[_checkState](wasInputPaused); 1121 this[_checkState](wasInputPaused);
1122 } 1122 }
1123 } 1123 }
1124 [_sendDone]() { 1124 [_sendDone]() {
1125 dart.assert(!dart.notNull(this[_isCanceled])); 1125 dart.assert(!dart.notNull(this[_isCanceled]));
1126 dart.assert(!dart.notNull(this[_isPaused])); 1126 dart.assert(!dart.notNull(this[_isPaused]));
1127 dart.assert(!dart.notNull(this[_inCallback])); 1127 dart.assert(!dart.notNull(this[_inCallback]));
1128 // Function sendDone: () → void 1128 // Function sendDone: () → void
1129 function sendDone() { 1129 function sendDone() {
1130 if (!dart.notNull(this[_waitsForCancel])) 1130 if (!dart.notNull(this[_waitsForCancel]))
1131 return; 1131 return;
1132 this[_state] = dart.notNull(_BufferingStreamSubscription[_STATE_CANCEL ED]) | dart.notNull(_BufferingStreamSubscription[_STATE_CLOSED]) | dart.notNull( _BufferingStreamSubscription[_STATE_IN_CALLBACK]); 1132 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_CANCELED]) | dart.notNull(_BufferingStreamSubscription[_S TATE_CLOSED]) | dart.notNull(_BufferingStreamSubscription[_STATE_IN_CALLBACK]);
1133 this[_zone].runGuarded(this[_onDone]); 1133 this[_zone].runGuarded(this[_onDone]);
1134 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1134 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_IN_CALLBACK]);
1135 } 1135 }
1136 this[_cancel](); 1136 this[_cancel]();
1137 this[_state] = _BufferingStreamSubscription[_STATE_WAIT_FOR_CANCEL]; 1137 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_WAIT_FOR_CANCEL]);
1138 if (dart.is(this[_cancelFuture], Future)) { 1138 if (dart.is(this[_cancelFuture], Future)) {
1139 this[_cancelFuture].whenComplete(sendDone); 1139 this[_cancelFuture].whenComplete(sendDone);
1140 } else { 1140 } else {
1141 sendDone(); 1141 sendDone();
1142 } 1142 }
1143 } 1143 }
1144 [_guardCallback](callback) { 1144 [_guardCallback](callback) {
1145 dart.assert(!dart.notNull(this[_inCallback])); 1145 dart.assert(!dart.notNull(this[_inCallback]));
1146 let wasInputPaused = this[_isInputPaused]; 1146 let wasInputPaused = this[_isInputPaused];
1147 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1147 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_IN_CALLBACK]);
1148 dart.dinvokef(callback); 1148 dart.dinvokef(callback);
1149 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CALL BACK]); 1149 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription[_STATE_IN_CALLBACK]);
1150 this[_checkState](wasInputPaused); 1150 this[_checkState](wasInputPaused);
1151 } 1151 }
1152 [_checkState](wasInputPaused) { 1152 [_checkState](wasInputPaused) {
1153 dart.assert(!dart.notNull(this[_inCallback])); 1153 dart.assert(!dart.notNull(this[_inCallback]));
1154 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp ty)) { 1154 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp ty)) {
1155 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_HAS_P ENDING]); 1155 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_HAS_PENDING]);
1156 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) { 1156 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) {
1157 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_INP UT_PAUSED]); 1157 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Buffering StreamSubscription[_STATE_INPUT_PAUSED]);
1158 } 1158 }
1159 } 1159 }
1160 while (true) { 1160 while (true) {
1161 if (this[_isCanceled]) { 1161 if (this[_isCanceled]) {
1162 this[_pending] = null; 1162 this[_pending] = null;
1163 return; 1163 return;
1164 } 1164 }
1165 let isInputPaused = this[_isInputPaused]; 1165 let isInputPaused = this[_isInputPaused];
1166 if (wasInputPaused == isInputPaused) 1166 if (wasInputPaused == isInputPaused)
1167 break; 1167 break;
1168 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1168 this[_state] = dart.notNull(this[_state]) ^ dart.notNull(_BufferingStr eamSubscription[_STATE_IN_CALLBACK]);
1169 if (isInputPaused) { 1169 if (isInputPaused) {
1170 this[_onPause](); 1170 this[_onPause]();
1171 } else { 1171 } else {
1172 this[_onResume](); 1172 this[_onResume]();
1173 } 1173 }
1174 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1174 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_IN_CALLBACK]);
1175 wasInputPaused = isInputPaused; 1175 wasInputPaused = isInputPaused;
1176 } 1176 }
1177 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) { 1177 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) {
1178 this[_pending].schedule(this); 1178 this[_pending].schedule(this);
1179 } 1179 }
1180 } 1180 }
1181 } 1181 }
1182 _BufferingStreamSubscription[dart.implements] = () => [StreamSubscription$(T ), _EventSink$(T), _EventDispatch$(T)]; 1182 _BufferingStreamSubscription[dart.implements] = () => [StreamSubscription$(T ), _EventSink$(T), _EventDispatch$(T)];
1183 _BufferingStreamSubscription._STATE_CANCEL_ON_ERROR = 1; 1183 _BufferingStreamSubscription._STATE_CANCEL_ON_ERROR = 1;
1184 _BufferingStreamSubscription._STATE_CLOSED = 2; 1184 _BufferingStreamSubscription._STATE_CLOSED = 2;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError); 1220 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError);
1221 this[_next] = this[_previous] = this; 1221 this[_next] = this[_previous] = this;
1222 } 1222 }
1223 get [_controller]() { 1223 get [_controller]() {
1224 return dart.as(super[_controller], _BroadcastStreamController); 1224 return dart.as(super[_controller], _BroadcastStreamController);
1225 } 1225 }
1226 [_expectsEvent](eventId) { 1226 [_expectsEvent](eventId) {
1227 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_EVENT_ID])) == eventId; 1227 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_EVENT_ID])) == eventId;
1228 } 1228 }
1229 [_toggleEventId]() { 1229 [_toggleEventId]() {
1230 this[_eventState] = _BroadcastSubscription[_STATE_EVENT_ID]; 1230 this[_eventState] = dart.notNull(this[_eventState]) ^ dart.notNull(_Broa dcastSubscription[_STATE_EVENT_ID]);
1231 } 1231 }
1232 get [_isFiring]() { 1232 get [_isFiring]() {
1233 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_FIRING])) != 0; 1233 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_FIRING])) != 0;
1234 } 1234 }
1235 [_setRemoveAfterFiring]() { 1235 [_setRemoveAfterFiring]() {
1236 dart.assert(this[_isFiring]); 1236 dart.assert(this[_isFiring]);
1237 this[_eventState] = _BroadcastSubscription[_STATE_REMOVE_AFTER_FIRING]; 1237 this[_eventState] = dart.notNull(this[_eventState]) | dart.notNull(_Broa dcastSubscription[_STATE_REMOVE_AFTER_FIRING]);
1238 } 1238 }
1239 get [_removeAfterFiring]() { 1239 get [_removeAfterFiring]() {
1240 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_REMOVE_AFTER_FIRING])) != 0; 1240 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_REMOVE_AFTER_FIRING])) != 0;
1241 } 1241 }
1242 [_onPause]() {} 1242 [_onPause]() {}
1243 [_onResume]() {} 1243 [_onResume]() {}
1244 } 1244 }
1245 _BroadcastSubscription[dart.implements] = () => [_BroadcastSubscriptionLink] ; 1245 _BroadcastSubscription[dart.implements] = () => [_BroadcastSubscriptionLink] ;
1246 _BroadcastSubscription._STATE_EVENT_ID = 1; 1246 _BroadcastSubscription._STATE_EVENT_ID = 1;
1247 _BroadcastSubscription._STATE_FIRING = 2; 1247 _BroadcastSubscription._STATE_FIRING = 2;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 } 1385 }
1386 this[_sendError](error, stackTrace); 1386 this[_sendError](error, stackTrace);
1387 } 1387 }
1388 close() { 1388 close() {
1389 if (this.isClosed) { 1389 if (this.isClosed) {
1390 dart.assert(this[_doneFuture] != null); 1390 dart.assert(this[_doneFuture] != null);
1391 return this[_doneFuture]; 1391 return this[_doneFuture];
1392 } 1392 }
1393 if (!dart.notNull(this[_mayAddEvent])) 1393 if (!dart.notNull(this[_mayAddEvent]))
1394 throw this[_addEventError](); 1394 throw this[_addEventError]();
1395 this[_state] = _BroadcastStreamController[_STATE_CLOSED]; 1395 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController[_STATE_CLOSED]);
1396 let doneFuture = this[_ensureDoneFuture](); 1396 let doneFuture = this[_ensureDoneFuture]();
1397 this[_sendDone](); 1397 this[_sendDone]();
1398 return doneFuture; 1398 return doneFuture;
1399 } 1399 }
1400 get done() { 1400 get done() {
1401 return this[_ensureDoneFuture](); 1401 return this[_ensureDoneFuture]();
1402 } 1402 }
1403 addStream(stream, opts) { 1403 addStream(stream, opts) {
1404 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 1404 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
1405 if (!dart.notNull(this[_mayAddEvent])) 1405 if (!dart.notNull(this[_mayAddEvent]))
1406 throw this[_addEventError](); 1406 throw this[_addEventError]();
1407 this[_state] = _BroadcastStreamController[_STATE_ADDSTREAM]; 1407 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController[_STATE_ADDSTREAM]);
1408 this[_addStreamState] = dart.as(new _AddStreamState(this, stream, cancel OnError), _AddStreamState$(T)); 1408 this[_addStreamState] = dart.as(new _AddStreamState(this, stream, cancel OnError), _AddStreamState$(T));
1409 return this[_addStreamState].addStreamFuture; 1409 return this[_addStreamState].addStreamFuture;
1410 } 1410 }
1411 [_add](data) { 1411 [_add](data) {
1412 this[_sendData](data); 1412 this[_sendData](data);
1413 } 1413 }
1414 [_addError](error, stackTrace) { 1414 [_addError](error, stackTrace) {
1415 this[_sendError](error, stackTrace); 1415 this[_sendError](error, stackTrace);
1416 } 1416 }
1417 [_close]() { 1417 [_close]() {
1418 dart.assert(this[_isAddingStream]); 1418 dart.assert(this[_isAddingStream]);
1419 let addState = this[_addStreamState]; 1419 let addState = this[_addStreamState];
1420 this[_addStreamState] = null; 1420 this[_addStreamState] = null;
1421 this[_state] = ~dart.notNull(_BroadcastStreamController[_STATE_ADDSTREAM ]); 1421 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre amController[_STATE_ADDSTREAM]);
1422 addState.complete(); 1422 addState.complete();
1423 } 1423 }
1424 [_forEachListener](action) { 1424 [_forEachListener](action) {
1425 if (this[_isFiring]) { 1425 if (this[_isFiring]) {
1426 throw new core.StateError("Cannot fire new event. Controller is alread y firing an event"); 1426 throw new core.StateError("Cannot fire new event. Controller is alread y firing an event");
1427 } 1427 }
1428 if (this[_isEmpty]) 1428 if (this[_isEmpty])
1429 return; 1429 return;
1430 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr oller[_STATE_EVENT_ID]); 1430 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr oller[_STATE_EVENT_ID]);
1431 this[_state] = dart.notNull(_BroadcastStreamController[_STATE_EVENT_ID]) | dart.notNull(_BroadcastStreamController[_STATE_FIRING]); 1431 this[_state] = dart.notNull(this[_state]) ^ (dart.notNull(_BroadcastStre amController[_STATE_EVENT_ID]) | dart.notNull(_BroadcastStreamController[_STATE_ FIRING]));
1432 let link = this[_next]; 1432 let link = this[_next];
1433 while (!dart.notNull(core.identical(link, this))) { 1433 while (!dart.notNull(core.identical(link, this))) {
1434 let subscription = dart.as(link, _BroadcastSubscription$(T)); 1434 let subscription = dart.as(link, _BroadcastSubscription$(T));
1435 if (subscription[_expectsEvent](id)) { 1435 if (subscription[_expectsEvent](id)) {
1436 subscription[_eventState] = _BroadcastSubscription[_STATE_FIRING]; 1436 subscription[_eventState] = dart.notNull(subscription[_eventState]) | dart.notNull(_BroadcastSubscription[_STATE_FIRING]);
1437 action(subscription); 1437 action(subscription);
1438 subscription[_toggleEventId](); 1438 subscription[_toggleEventId]();
1439 link = subscription[_next]; 1439 link = subscription[_next];
1440 if (subscription[_removeAfterFiring]) { 1440 if (subscription[_removeAfterFiring]) {
1441 this[_removeListener](subscription); 1441 this[_removeListener](subscription);
1442 } 1442 }
1443 subscription[_eventState] = ~dart.notNull(_BroadcastSubscription[_ST ATE_FIRING]); 1443 subscription[_eventState] = dart.notNull(subscription[_eventState]) & ~dart.notNull(_BroadcastSubscription[_STATE_FIRING]);
1444 } else { 1444 } else {
1445 link = subscription[_next]; 1445 link = subscription[_next];
1446 } 1446 }
1447 } 1447 }
1448 this[_state] = ~dart.notNull(_BroadcastStreamController[_STATE_FIRING]); 1448 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre amController[_STATE_FIRING]);
1449 if (this[_isEmpty]) { 1449 if (this[_isEmpty]) {
1450 this[_callOnCancel](); 1450 this[_callOnCancel]();
1451 } 1451 }
1452 } 1452 }
1453 [_callOnCancel]() { 1453 [_callOnCancel]() {
1454 dart.assert(this[_isEmpty]); 1454 dart.assert(this[_isEmpty]);
1455 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo mplete])) { 1455 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo mplete])) {
1456 this[_doneFuture][_asyncComplete](null); 1456 this[_doneFuture][_asyncComplete](null);
1457 } 1457 }
1458 _runGuarded(this[_onCancel]); 1458 _runGuarded(this[_onCancel]);
(...skipping 10 matching lines...) Expand all
1469 let _BroadcastStreamController = _BroadcastStreamController$(); 1469 let _BroadcastStreamController = _BroadcastStreamController$();
1470 let _SyncBroadcastStreamController$ = dart.generic(function(T) { 1470 let _SyncBroadcastStreamController$ = dart.generic(function(T) {
1471 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) { 1471 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) {
1472 _SyncBroadcastStreamController(onListen, onCancel) { 1472 _SyncBroadcastStreamController(onListen, onCancel) {
1473 super._BroadcastStreamController(onListen, onCancel); 1473 super._BroadcastStreamController(onListen, onCancel);
1474 } 1474 }
1475 [_sendData](data) { 1475 [_sendData](data) {
1476 if (this[_isEmpty]) 1476 if (this[_isEmpty])
1477 return; 1477 return;
1478 if (this[_hasOneListener]) { 1478 if (this[_hasOneListener]) {
1479 this[_state] = _BroadcastStreamController[_STATE_FIRING]; 1479 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController[_STATE_FIRING]);
1480 let subscription = dart.as(this[_next], _BroadcastSubscription); 1480 let subscription = dart.as(this[_next], _BroadcastSubscription);
1481 subscription[_add](data); 1481 subscription[_add](data);
1482 this[_state] = ~dart.notNull(_BroadcastStreamController[_STATE_FIRING] ); 1482 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastSt reamController[_STATE_FIRING]);
1483 if (this[_isEmpty]) { 1483 if (this[_isEmpty]) {
1484 this[_callOnCancel](); 1484 this[_callOnCancel]();
1485 } 1485 }
1486 return; 1486 return;
1487 } 1487 }
1488 this[_forEachListener]((subscription) => { 1488 this[_forEachListener]((subscription) => {
1489 subscription[_add](data); 1489 subscription[_add](data);
1490 }); 1490 });
1491 } 1491 }
1492 [_sendError](error, stackTrace) { 1492 [_sendError](error, stackTrace) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 if (!dart.notNull(this[_mayAddEvent])) 1580 if (!dart.notNull(this[_mayAddEvent]))
1581 throw this[_addEventError](); 1581 throw this[_addEventError]();
1582 this[_sendError](error, stackTrace); 1582 this[_sendError](error, stackTrace);
1583 while (this[_hasPending]) { 1583 while (this[_hasPending]) {
1584 this[_pending].handleNext(this); 1584 this[_pending].handleNext(this);
1585 } 1585 }
1586 } 1586 }
1587 close() { 1587 close() {
1588 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { 1588 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) {
1589 this[_addPendingEvent](new _DelayedDone()); 1589 this[_addPendingEvent](new _DelayedDone());
1590 this[_state] = _BroadcastStreamController[_STATE_CLOSED]; 1590 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController[_STATE_CLOSED]);
1591 return super.done; 1591 return super.done;
1592 } 1592 }
1593 let result = super.close(); 1593 let result = super.close();
1594 dart.assert(!dart.notNull(this[_hasPending])); 1594 dart.assert(!dart.notNull(this[_hasPending]));
1595 return result; 1595 return result;
1596 } 1596 }
1597 [_callOnCancel]() { 1597 [_callOnCancel]() {
1598 if (this[_hasPending]) { 1598 if (this[_hasPending]) {
1599 this[_pending].clear(); 1599 this[_pending].clear();
1600 this[_pending] = null; 1600 this[_pending] = null;
(...skipping 19 matching lines...) Expand all
1620 if (resumeSignal === void 0) 1620 if (resumeSignal === void 0)
1621 resumeSignal = null; 1621 resumeSignal = null;
1622 if (resumeSignal != null) 1622 if (resumeSignal != null)
1623 resumeSignal.then(this[_resume]); 1623 resumeSignal.then(this[_resume]);
1624 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1; 1624 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
1625 } 1625 }
1626 resume() { 1626 resume() {
1627 this[_resume](null); 1627 this[_resume](null);
1628 } 1628 }
1629 [_resume](_) { 1629 [_resume](_) {
1630 if (dart.notNull(this[_pauseCount]) > 0) 1630 if (dart.notNull(this[_pauseCount]) > 0) {
1631 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1; 1631 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1;
1632 }
1632 } 1633 }
1633 cancel() { 1634 cancel() {
1634 return new _Future.immediate(null); 1635 return new _Future.immediate(null);
1635 } 1636 }
1636 get isPaused() { 1637 get isPaused() {
1637 return dart.notNull(this[_pauseCount]) > 0; 1638 return dart.notNull(this[_pauseCount]) > 0;
1638 } 1639 }
1639 asFuture(value) { 1640 asFuture(value) {
1640 if (value === void 0) 1641 if (value === void 0)
1641 value = null; 1642 value = null;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 result[_completeError](theError, dart.as(theStackTrace, core.Stack Trace)); 1765 result[_completeError](theError, dart.as(theStackTrace, core.Stack Trace));
1765 } else { 1766 } else {
1766 error = theError; 1767 error = theError;
1767 stackTrace = dart.as(theStackTrace, core.StackTrace); 1768 stackTrace = dart.as(theStackTrace, core.StackTrace);
1768 } 1769 }
1769 } else if (remaining == 0 && !dart.notNull(eagerError)) { 1770 } else if (remaining == 0 && !dart.notNull(eagerError)) {
1770 result[_completeError](error, stackTrace); 1771 result[_completeError](error, stackTrace);
1771 } 1772 }
1772 } 1773 }
1773 for (let future of futures) { 1774 for (let future of futures) {
1774 let pos = ((x) => remaining = dart.notNull(x) + 1, x)(remaining); 1775 let pos = remaining;
1776 remaining = dart.notNull(pos) + 1;
1775 future.then((value) => { 1777 future.then((value) => {
1776 remaining = dart.notNull(remaining) - 1; 1778 remaining = dart.notNull(remaining) - 1;
1777 if (values != null) { 1779 if (values != null) {
1778 values[core.$set](pos, value); 1780 values[core.$set](pos, value);
1779 if (remaining == 0) { 1781 if (remaining == 0) {
1780 result[_completeWithValue](values); 1782 result[_completeWithValue](values);
1781 } 1783 }
1782 } else { 1784 } else {
1783 if (dart.notNull(cleanUp != null) && dart.notNull(value != null)) { 1785 if (dart.notNull(cleanUp != null) && dart.notNull(value != null)) {
1784 new Future.sync(() => { 1786 new Future.sync(() => {
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 return new core.StateError("Cannot add event while adding a stream"); 2819 return new core.StateError("Cannot add event while adding a stream");
2818 } 2820 }
2819 addStream(source, opts) { 2821 addStream(source, opts) {
2820 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 2822 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
2821 if (!dart.notNull(this[_mayAddEvent])) 2823 if (!dart.notNull(this[_mayAddEvent]))
2822 throw this[_badEventState](); 2824 throw this[_badEventState]();
2823 if (this[_isCanceled]) 2825 if (this[_isCanceled])
2824 return new _Future.immediate(null); 2826 return new _Future.immediate(null);
2825 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError); 2827 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError);
2826 this[_varData] = addState; 2828 this[_varData] = addState;
2827 this[_state] = _StreamController[_STATE_ADDSTREAM]; 2829 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er[_STATE_ADDSTREAM]);
2828 return addState.addStreamFuture; 2830 return addState.addStreamFuture;
2829 } 2831 }
2830 get done() { 2832 get done() {
2831 return this[_ensureDoneFuture](); 2833 return this[_ensureDoneFuture]();
2832 } 2834 }
2833 [_ensureDoneFuture]() { 2835 [_ensureDoneFuture]() {
2834 if (this[_doneFuture] == null) { 2836 if (this[_doneFuture] == null) {
2835 this[_doneFuture] = this[_isCanceled] ? Future[_nullFuture] : new _Fut ure(); 2837 this[_doneFuture] = this[_isCanceled] ? Future[_nullFuture] : new _Fut ure();
2836 } 2838 }
2837 return this[_doneFuture]; 2839 return this[_doneFuture];
(...skipping 19 matching lines...) Expand all
2857 close() { 2859 close() {
2858 if (this.isClosed) { 2860 if (this.isClosed) {
2859 return this[_ensureDoneFuture](); 2861 return this[_ensureDoneFuture]();
2860 } 2862 }
2861 if (!dart.notNull(this[_mayAddEvent])) 2863 if (!dart.notNull(this[_mayAddEvent]))
2862 throw this[_badEventState](); 2864 throw this[_badEventState]();
2863 this[_closeUnchecked](); 2865 this[_closeUnchecked]();
2864 return this[_ensureDoneFuture](); 2866 return this[_ensureDoneFuture]();
2865 } 2867 }
2866 [_closeUnchecked]() { 2868 [_closeUnchecked]() {
2867 this[_state] = _StreamController[_STATE_CLOSED]; 2869 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er[_STATE_CLOSED]);
2868 if (this.hasListener) { 2870 if (this.hasListener) {
2869 this[_sendDone](); 2871 this[_sendDone]();
2870 } else if (this[_isInitialState]) { 2872 } else if (this[_isInitialState]) {
2871 this[_ensurePendingEvents]().add(new _DelayedDone()); 2873 this[_ensurePendingEvents]().add(new _DelayedDone());
2872 } 2874 }
2873 } 2875 }
2874 [_add](value) { 2876 [_add](value) {
2875 if (this.hasListener) { 2877 if (this.hasListener) {
2876 this[_sendData](value); 2878 this[_sendData](value);
2877 } else if (this[_isInitialState]) { 2879 } else if (this[_isInitialState]) {
2878 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value)); 2880 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value));
2879 } 2881 }
2880 } 2882 }
2881 [_addError](error, stackTrace) { 2883 [_addError](error, stackTrace) {
2882 if (this.hasListener) { 2884 if (this.hasListener) {
2883 this[_sendError](error, stackTrace); 2885 this[_sendError](error, stackTrace);
2884 } else if (this[_isInitialState]) { 2886 } else if (this[_isInitialState]) {
2885 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace)) ; 2887 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace)) ;
2886 } 2888 }
2887 } 2889 }
2888 [_close]() { 2890 [_close]() {
2889 dart.assert(this[_isAddingStream]); 2891 dart.assert(this[_isAddingStream]);
2890 let addState = dart.as(this[_varData], _StreamControllerAddStreamState); 2892 let addState = dart.as(this[_varData], _StreamControllerAddStreamState);
2891 this[_varData] = addState.varData; 2893 this[_varData] = addState.varData;
2892 this[_state] = ~dart.notNull(_StreamController[_STATE_ADDSTREAM]); 2894 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_StreamControl ler[_STATE_ADDSTREAM]);
2893 addState.complete(); 2895 addState.complete();
2894 } 2896 }
2895 [_subscribe](onData, onError, onDone, cancelOnError) { 2897 [_subscribe](onData, onError, onDone, cancelOnError) {
2896 if (!dart.notNull(this[_isInitialState])) { 2898 if (!dart.notNull(this[_isInitialState])) {
2897 throw new core.StateError("Stream has already been listened to."); 2899 throw new core.StateError("Stream has already been listened to.");
2898 } 2900 }
2899 let subscription = new _ControllerSubscription(this, onData, onError, on Done, cancelOnError); 2901 let subscription = new _ControllerSubscription(this, onData, onError, on Done, cancelOnError);
2900 let pendingEvents = this[_pendingEvents]; 2902 let pendingEvents = this[_pendingEvents];
2901 this[_state] = _StreamController[_STATE_SUBSCRIBED]; 2903 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er[_STATE_SUBSCRIBED]);
2902 if (this[_isAddingStream]) { 2904 if (this[_isAddingStream]) {
2903 let addState = dart.as(this[_varData], _StreamControllerAddStreamState ); 2905 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2904 addState.varData = subscription; 2906 addState.varData = subscription;
2905 addState.resume(); 2907 addState.resume();
2906 } else { 2908 } else {
2907 this[_varData] = subscription; 2909 this[_varData] = subscription;
2908 } 2910 }
2909 subscription[_setPendingEvents](pendingEvents); 2911 subscription[_setPendingEvents](pendingEvents);
2910 subscription[_guardCallback]((() => { 2912 subscription[_guardCallback]((() => {
2911 _runGuarded(this[_onListen]); 2913 _runGuarded(this[_onListen]);
2912 }).bind(this)); 2914 }).bind(this));
2913 return dart.as(subscription, StreamSubscription$(T)); 2915 return dart.as(subscription, StreamSubscription$(T));
2914 } 2916 }
2915 [_recordCancel](subscription) { 2917 [_recordCancel](subscription) {
2916 let result = null; 2918 let result = null;
2917 if (this[_isAddingStream]) { 2919 if (this[_isAddingStream]) {
2918 let addState = dart.as(this[_varData], _StreamControllerAddStreamState ); 2920 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2919 result = addState.cancel(); 2921 result = addState.cancel();
2920 } 2922 }
2921 this[_varData] = null; 2923 this[_varData] = null;
2922 this[_state] = dart.notNull(this[_state]) & ~(dart.notNull(_StreamContro ller[_STATE_SUBSCRIBED]) | dart.notNull(_StreamController[_STATE_ADDSTREAM])) | dart.notNull(_StreamController[_STATE_CANCELED]); 2924 this[_state] = dart.notNull(this[_state]) & ~(dart.notNull(_StreamContro ller[_STATE_SUBSCRIBED]) | dart.notNull(_StreamController[_STATE_ADDSTREAM])) | dart.notNull(_StreamController[_STATE_CANCELED]);
2923 if (this[_onCancel] != null) { 2925 if (this[_onCancel] != null) {
2924 if (result == null) { 2926 if (result == null) {
2925 try { 2927 try {
2926 result = dart.as(this[_onCancel](), Future); 2928 result = dart.as(this[_onCancel](), Future);
2927 } catch (e) { 2929 } catch (e) {
2928 let s = dart.stackTrace(e); 2930 let s = dart.stackTrace(e);
2929 result = ((_$) => { 2931 result = new _Future();
2930 _$[_asyncCompleteError](e, s); 2932 result[_asyncCompleteError](e, s);
2931 return _$;
2932 })(new _Future());
2933 } 2933 }
2934 2934
2935 } else { 2935 } else {
2936 result = result.whenComplete(this[_onCancel]); 2936 result = result.whenComplete(this[_onCancel]);
2937 } 2937 }
2938 } 2938 }
2939 // Function complete: () → void 2939 // Function complete: () → void
2940 function complete() { 2940 function complete() {
2941 if (dart.notNull(this[_doneFuture] != null) && dart.notNull(this[_done Future][_mayComplete])) { 2941 if (dart.notNull(this[_doneFuture] != null) && dart.notNull(this[_done Future][_mayComplete])) {
2942 this[_doneFuture][_asyncComplete](null); 2942 this[_doneFuture][_asyncComplete](null);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3157 class _GeneratedStreamImpl extends _StreamImpl$(T) { 3157 class _GeneratedStreamImpl extends _StreamImpl$(T) {
3158 _GeneratedStreamImpl(pending$) { 3158 _GeneratedStreamImpl(pending$) {
3159 this[_pending] = pending$; 3159 this[_pending] = pending$;
3160 this[_isUsed] = false; 3160 this[_isUsed] = false;
3161 super._StreamImpl(); 3161 super._StreamImpl();
3162 } 3162 }
3163 [_createSubscription](onData, onError, onDone, cancelOnError) { 3163 [_createSubscription](onData, onError, onDone, cancelOnError) {
3164 if (this[_isUsed]) 3164 if (this[_isUsed])
3165 throw new core.StateError("Stream has already been listened to."); 3165 throw new core.StateError("Stream has already been listened to.");
3166 this[_isUsed] = true; 3166 this[_isUsed] = true;
3167 return ((_$) => { 3167 let _$ = new _BufferingStreamSubscription(onData, onError, onDone, cance lOnError);
3168 _$[_setPendingEvents](this[_pending]()); 3168 _$[_setPendingEvents](this[_pending]());
3169 return _$; 3169 return _$;
3170 }).bind(this)(new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError));
3171 } 3170 }
3172 } 3171 }
3173 return _GeneratedStreamImpl; 3172 return _GeneratedStreamImpl;
3174 }); 3173 });
3175 let _GeneratedStreamImpl = _GeneratedStreamImpl$(); 3174 let _GeneratedStreamImpl = _GeneratedStreamImpl$();
3176 let _iterator = Symbol('_iterator'); 3175 let _iterator = Symbol('_iterator');
3177 let _STATE_UNSCHEDULED = Symbol('_STATE_UNSCHEDULED'); 3176 let _STATE_UNSCHEDULED = Symbol('_STATE_UNSCHEDULED');
3178 let _STATE_SCHEDULED = Symbol('_STATE_SCHEDULED'); 3177 let _STATE_SCHEDULED = Symbol('_STATE_SCHEDULED');
3179 let _eventScheduled = Symbol('_eventScheduled'); 3178 let _eventScheduled = Symbol('_eventScheduled');
3180 class _PendingEvents extends core.Object { 3179 class _PendingEvents extends core.Object {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 get [_isScheduled]() { 3383 get [_isScheduled]() {
3385 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n[_SCHEDULED])) != 0; 3384 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n[_SCHEDULED])) != 0;
3386 } 3385 }
3387 get isPaused() { 3386 get isPaused() {
3388 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n[_PAUSED]); 3387 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n[_PAUSED]);
3389 } 3388 }
3390 [_schedule]() { 3389 [_schedule]() {
3391 if (this[_isScheduled]) 3390 if (this[_isScheduled])
3392 return; 3391 return;
3393 this[_zone].scheduleMicrotask(this[_sendDone]); 3392 this[_zone].scheduleMicrotask(this[_sendDone]);
3394 this[_state] = _DoneStreamSubscription[_SCHEDULED]; 3393 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription[_SCHEDULED]);
3395 } 3394 }
3396 onData(handleData) {} 3395 onData(handleData) {}
3397 onError(handleError) {} 3396 onError(handleError) {}
3398 onDone(handleDone) { 3397 onDone(handleDone) {
3399 this[_onDone] = handleDone; 3398 this[_onDone] = handleDone;
3400 } 3399 }
3401 pause(resumeSignal) { 3400 pause(resumeSignal) {
3402 if (resumeSignal === void 0) 3401 if (resumeSignal === void 0)
3403 resumeSignal = null; 3402 resumeSignal = null;
3404 this[_state] = _DoneStreamSubscription[_PAUSED]; 3403 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs cription[_PAUSED]);
3405 if (resumeSignal != null) 3404 if (resumeSignal != null)
3406 resumeSignal.whenComplete(this.resume); 3405 resumeSignal.whenComplete(this.resume);
3407 } 3406 }
3408 resume() { 3407 resume() {
3409 if (this.isPaused) { 3408 if (this.isPaused) {
3410 this[_state] = _DoneStreamSubscription[_PAUSED]; 3409 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu bscription[_PAUSED]);
3411 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { 3410 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) {
3412 this[_schedule](); 3411 this[_schedule]();
3413 } 3412 }
3414 } 3413 }
3415 } 3414 }
3416 cancel() { 3415 cancel() {
3417 return null; 3416 return null;
3418 } 3417 }
3419 asFuture(futureValue) { 3418 asFuture(futureValue) {
3420 if (futureValue === void 0) 3419 if (futureValue === void 0)
3421 futureValue = null; 3420 futureValue = null;
3422 let result = new _Future(); 3421 let result = new _Future();
3423 this[_onDone] = () => { 3422 this[_onDone] = () => {
3424 result[_completeWithValue](null); 3423 result[_completeWithValue](null);
3425 }; 3424 };
3426 return result; 3425 return result;
3427 } 3426 }
3428 [_sendDone]() { 3427 [_sendDone]() {
3429 this[_state] = ~dart.notNull(_DoneStreamSubscription[_SCHEDULED]); 3428 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_DoneStreamSub scription[_SCHEDULED]);
3430 if (this.isPaused) 3429 if (this.isPaused)
3431 return; 3430 return;
3432 this[_state] = _DoneStreamSubscription[_DONE_SENT]; 3431 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription[_DONE_SENT]);
3433 if (this[_onDone] != null) 3432 if (this[_onDone] != null)
3434 this[_zone].runGuarded(this[_onDone]); 3433 this[_zone].runGuarded(this[_onDone]);
3435 } 3434 }
3436 } 3435 }
3437 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)]; 3436 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)];
3438 _DoneStreamSubscription._DONE_SENT = 1; 3437 _DoneStreamSubscription._DONE_SENT = 1;
3439 _DoneStreamSubscription._SCHEDULED = 2; 3438 _DoneStreamSubscription._SCHEDULED = 2;
3440 _DoneStreamSubscription._PAUSED = 4; 3439 _DoneStreamSubscription._PAUSED = 4;
3441 return _DoneStreamSubscription; 3440 return _DoneStreamSubscription;
3442 }); 3441 });
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
3952 class _TakeStream extends _ForwardingStream$(T, T) { 3951 class _TakeStream extends _ForwardingStream$(T, T) {
3953 _TakeStream(source, count) { 3952 _TakeStream(source, count) {
3954 this[_remaining] = count; 3953 this[_remaining] = count;
3955 super._ForwardingStream(source); 3954 super._ForwardingStream(source);
3956 if (!(typeof count == 'number')) 3955 if (!(typeof count == 'number'))
3957 throw new core.ArgumentError(count); 3956 throw new core.ArgumentError(count);
3958 } 3957 }
3959 [_handleData](inputEvent, sink) { 3958 [_handleData](inputEvent, sink) {
3960 if (dart.notNull(this[_remaining]) > 0) { 3959 if (dart.notNull(this[_remaining]) > 0) {
3961 sink[_add](inputEvent); 3960 sink[_add](inputEvent);
3962 this[_remaining] = 1; 3961 this[_remaining] = dart.notNull(this[_remaining]) - 1;
3963 if (this[_remaining] == 0) { 3962 if (this[_remaining] == 0) {
3964 sink[_close](); 3963 sink[_close]();
3965 } 3964 }
3966 } 3965 }
3967 } 3966 }
3968 } 3967 }
3969 return _TakeStream; 3968 return _TakeStream;
3970 }); 3969 });
3971 let _TakeStream = _TakeStream$(); 3970 let _TakeStream = _TakeStream$();
3972 let _TakeWhileStream$ = dart.generic(function(T) { 3971 let _TakeWhileStream$ = dart.generic(function(T) {
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
5193 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5192 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5194 exports.CreateTimerHandler = CreateTimerHandler; 5193 exports.CreateTimerHandler = CreateTimerHandler;
5195 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5194 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5196 exports.PrintHandler = PrintHandler; 5195 exports.PrintHandler = PrintHandler;
5197 exports.ForkHandler = ForkHandler; 5196 exports.ForkHandler = ForkHandler;
5198 exports.ZoneSpecification = ZoneSpecification; 5197 exports.ZoneSpecification = ZoneSpecification;
5199 exports.ZoneDelegate = ZoneDelegate; 5198 exports.ZoneDelegate = ZoneDelegate;
5200 exports.Zone = Zone; 5199 exports.Zone = Zone;
5201 exports.runZoned = runZoned; 5200 exports.runZoned = runZoned;
5202 })(async || (async = {})); 5201 })(async || (async = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698