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

Side by Side Diff: test/codegen/expect/async/async.js

Issue 963343002: implement private members, fixes #74 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
OLDNEW
1 var async; 1 var async;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 dart.copyProperties(exports, { 4 dart.copyProperties(exports, {
5 get _hasDocument() { 5 get _hasDocument() {
6 return dart.equals(typeof document, 'object'); 6 return dart.equals(typeof document, 'object');
7 } 7 }
8 }); 8 });
9 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic 9 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic
10 function _invokeErrorHandler(errorHandler, error, stackTrace) { 10 function _invokeErrorHandler(errorHandler, error, stackTrace) {
11 if (dart.is(errorHandler, ZoneBinaryCallback)) { 11 if (dart.is(errorHandler, ZoneBinaryCallback)) {
12 return dart.dinvokef(errorHandler, error, stackTrace); 12 return dart.dinvokef(errorHandler, error, stackTrace);
13 } else { 13 } else {
14 return dart.dinvokef(errorHandler, error); 14 return dart.dinvokef(errorHandler, error);
15 } 15 }
16 } 16 }
17 // Function _registerErrorHandler: (Function, Zone) → Function 17 // Function _registerErrorHandler: (Function, Zone) → Function
18 function _registerErrorHandler(errorHandler, zone) { 18 function _registerErrorHandler(errorHandler, zone) {
19 if (dart.is(errorHandler, ZoneBinaryCallback)) { 19 if (dart.is(errorHandler, ZoneBinaryCallback)) {
20 return zone.registerBinaryCallback(errorHandler); 20 return zone.registerBinaryCallback(errorHandler);
21 } else { 21 } else {
22 return zone.registerUnaryCallback(dart.as(errorHandler, dart.throw_("Unimp lemented type (dynamic) → dynamic"))); 22 return zone.registerUnaryCallback(dart.as(errorHandler, dart.throw_("Unimp lemented type (dynamic) → dynamic")));
23 } 23 }
24 } 24 }
25 let _getBestStackTrace = Symbol('_getBestStackTrace');
25 class _UncaughtAsyncError extends AsyncError { 26 class _UncaughtAsyncError extends AsyncError {
26 _UncaughtAsyncError(error, stackTrace) { 27 _UncaughtAsyncError(error, stackTrace) {
27 super.AsyncError(error, _getBestStackTrace(error, stackTrace)); 28 super.AsyncError(error, _getBestStackTrace(error, stackTrace));
28 } 29 }
29 static _getBestStackTrace(error, stackTrace) { 30 static [_getBestStackTrace](error, stackTrace) {
30 if (stackTrace !== null) 31 if (stackTrace !== null)
31 return stackTrace; 32 return stackTrace;
32 if (dart.is(error, core.Error)) { 33 if (dart.is(error, core.Error)) {
33 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace); 34 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace);
34 } 35 }
35 return null; 36 return null;
36 } 37 }
37 toString() { 38 toString() {
38 let result = `Uncaught Error: ${this.error}`; 39 let result = `Uncaught Error: ${this.error}`;
39 if (this.stackTrace !== null) { 40 if (this.stackTrace !== null) {
40 result = `\nStack Trace:\n${this.stackTrace}`; 41 result = `\nStack Trace:\n${this.stackTrace}`;
41 } 42 }
42 return result; 43 return result;
43 } 44 }
44 } 45 }
45 let _BroadcastStream$ = dart.generic(function(T) { 46 let _BroadcastStream$ = dart.generic(function(T) {
46 class _BroadcastStream extends _ControllerStream$(T) { 47 class _BroadcastStream extends _ControllerStream$(T) {
47 _BroadcastStream(controller) { 48 _BroadcastStream(controller) {
48 super._ControllerStream(dart.as(controller, _StreamControllerLifecycle$( T))); 49 super._ControllerStream(dart.as(controller, _StreamControllerLifecycle$( T)));
49 } 50 }
50 get isBroadcast() { 51 get isBroadcast() {
51 return true; 52 return true;
52 } 53 }
53 } 54 }
54 return _BroadcastStream; 55 return _BroadcastStream;
55 }); 56 });
56 let _BroadcastStream = _BroadcastStream$(dynamic); 57 let _BroadcastStream = _BroadcastStream$(dynamic);
58 let _next = Symbol('_next');
59 let _previous = Symbol('_previous');
57 class _BroadcastSubscriptionLink extends dart.Object { 60 class _BroadcastSubscriptionLink extends dart.Object {
58 _BroadcastSubscriptionLink() { 61 _BroadcastSubscriptionLink() {
59 this._next = null; 62 this[_next] = null;
60 this._previous = null; 63 this[_previous] = null;
61 } 64 }
62 } 65 }
66 let _eventState = Symbol('_eventState');
67 let _controller = Symbol('_controller');
68 let _expectsEvent = Symbol('_expectsEvent');
69 let _toggleEventId = Symbol('_toggleEventId');
70 let _isFiring = Symbol('_isFiring');
71 let _setRemoveAfterFiring = Symbol('_setRemoveAfterFiring');
72 let _removeAfterFiring = Symbol('_removeAfterFiring');
73 let _onPause = Symbol('_onPause');
74 let _onResume = Symbol('_onResume');
63 let _BroadcastSubscription$ = dart.generic(function(T) { 75 let _BroadcastSubscription$ = dart.generic(function(T) {
64 class _BroadcastSubscription extends _ControllerSubscription$(T) { 76 class _BroadcastSubscription extends _ControllerSubscription$(T) {
65 _BroadcastSubscription(controller, onData, onError, onDone, cancelOnError) { 77 _BroadcastSubscription(controller, onData, onError, onDone, cancelOnError) {
66 this._eventState = dart.as(null, core.int); 78 this[_eventState] = dart.as(null, core.int);
67 this._next = null; 79 this[_next] = null;
68 this._previous = null; 80 this[_previous] = null;
69 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError); 81 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError);
70 this._next = this._previous = this; 82 this[_next] = this[_previous] = this;
71 } 83 }
72 get _controller() { 84 get [_controller]() {
73 return dart.as(super._controller, _BroadcastStreamController); 85 return dart.as(super[_controller], _BroadcastStreamController);
74 } 86 }
75 _expectsEvent(eventId) { 87 [_expectsEvent](eventId) {
76 return (this._eventState & _STATE_EVENT_ID) === eventId; 88 return (this[_eventState] & _STATE_EVENT_ID) === eventId;
77 } 89 }
78 _toggleEventId() { 90 [_toggleEventId]() {
79 this._eventState = _STATE_EVENT_ID; 91 this[_eventState] = _STATE_EVENT_ID;
80 } 92 }
81 get _isFiring() { 93 get [_isFiring]() {
82 return (this._eventState & _STATE_FIRING) !== 0; 94 return (this[_eventState] & _STATE_FIRING) !== 0;
83 } 95 }
84 _setRemoveAfterFiring() { 96 [_setRemoveAfterFiring]() {
85 dart.assert(this._isFiring); 97 dart.assert(this[_isFiring]);
86 this._eventState = _STATE_REMOVE_AFTER_FIRING; 98 this[_eventState] = _STATE_REMOVE_AFTER_FIRING;
87 } 99 }
88 get _removeAfterFiring() { 100 get [_removeAfterFiring]() {
89 return (this._eventState & _STATE_REMOVE_AFTER_FIRING) !== 0; 101 return (this[_eventState] & _STATE_REMOVE_AFTER_FIRING) !== 0;
90 } 102 }
91 _onPause() {} 103 [_onPause]() {}
92 _onResume() {} 104 [_onResume]() {}
93 } 105 }
94 _BroadcastSubscription._STATE_EVENT_ID = 1; 106 _BroadcastSubscription._STATE_EVENT_ID = 1;
95 _BroadcastSubscription._STATE_FIRING = 2; 107 _BroadcastSubscription._STATE_FIRING = 2;
96 _BroadcastSubscription._STATE_REMOVE_AFTER_FIRING = 4; 108 _BroadcastSubscription._STATE_REMOVE_AFTER_FIRING = 4;
97 return _BroadcastSubscription; 109 return _BroadcastSubscription;
98 }); 110 });
99 let _BroadcastSubscription = _BroadcastSubscription$(dynamic); 111 let _BroadcastSubscription = _BroadcastSubscription$(dynamic);
112 let _onListen = Symbol('_onListen');
113 let _onCancel = Symbol('_onCancel');
114 let _state = Symbol('_state');
115 let _addStreamState = Symbol('_addStreamState');
116 let _doneFuture = Symbol('_doneFuture');
117 let _isEmpty = Symbol('_isEmpty');
118 let _hasOneListener = Symbol('_hasOneListener');
119 let _isAddingStream = Symbol('_isAddingStream');
120 let _mayAddEvent = Symbol('_mayAddEvent');
121 let _ensureDoneFuture = Symbol('_ensureDoneFuture');
122 let _addListener = Symbol('_addListener');
123 let _removeListener = Symbol('_removeListener');
124 let _subscribe = Symbol('_subscribe');
125 let _recordCancel = Symbol('_recordCancel');
126 let _callOnCancel = Symbol('_callOnCancel');
127 let _recordPause = Symbol('_recordPause');
128 let _recordResume = Symbol('_recordResume');
129 let _addEventError = Symbol('_addEventError');
130 let _sendData = Symbol('_sendData');
131 let _sendError = Symbol('_sendError');
132 let _sendDone = Symbol('_sendDone');
133 let _add = Symbol('_add');
134 let _addError = Symbol('_addError');
135 let _close = Symbol('_close');
136 let _forEachListener = Symbol('_forEachListener');
137 let _STATE_FIRING = Symbol('_STATE_FIRING');
138 let _mayComplete = Symbol('_mayComplete');
100 let _BroadcastStreamController$ = dart.generic(function(T) { 139 let _BroadcastStreamController$ = dart.generic(function(T) {
101 class _BroadcastStreamController extends dart.Object { 140 class _BroadcastStreamController extends dart.Object {
102 _BroadcastStreamController(_onListen, _onCancel) { 141 _BroadcastStreamController($_onListen, $_onCancel) {
103 this._onListen = _onListen; 142 this[_onListen] = $_onListen;
104 this._onCancel = _onCancel; 143 this[_onCancel] = $_onCancel;
105 this._state = _STATE_INITIAL; 144 this[_state] = _STATE_INITIAL;
106 this._next = null; 145 this[_next] = null;
107 this._previous = null; 146 this[_previous] = null;
108 this._addStreamState = null; 147 this[_addStreamState] = null;
109 this._doneFuture = null; 148 this[_doneFuture] = null;
110 this._next = this._previous = this; 149 this[_next] = this[_previous] = this;
111 } 150 }
112 get stream() { 151 get stream() {
113 return new _BroadcastStream(this); 152 return new _BroadcastStream(this);
114 } 153 }
115 get sink() { 154 get sink() {
116 return new _StreamSinkWrapper(this); 155 return new _StreamSinkWrapper(this);
117 } 156 }
118 get isClosed() { 157 get isClosed() {
119 return (this._state & _STATE_CLOSED) !== 0; 158 return (this[_state] & _STATE_CLOSED) !== 0;
120 } 159 }
121 get isPaused() { 160 get isPaused() {
122 return false; 161 return false;
123 } 162 }
124 get hasListener() { 163 get hasListener() {
125 return !dart.notNull(this._isEmpty); 164 return !dart.notNull(this[_isEmpty]);
126 } 165 }
127 get _hasOneListener() { 166 get [_hasOneListener]() {
128 dart.assert(!dart.notNull(this._isEmpty)); 167 dart.assert(!dart.notNull(this[_isEmpty]));
129 return core.identical(this._next._next, this); 168 return core.identical(this[_next][_next], this);
130 } 169 }
131 get _isFiring() { 170 get [_isFiring]() {
132 return (this._state & _STATE_FIRING) !== 0; 171 return (this[_state] & _STATE_FIRING) !== 0;
133 } 172 }
134 get _isAddingStream() { 173 get [_isAddingStream]() {
135 return (this._state & _STATE_ADDSTREAM) !== 0; 174 return (this[_state] & _STATE_ADDSTREAM) !== 0;
136 } 175 }
137 get _mayAddEvent() { 176 get [_mayAddEvent]() {
138 return this._state < _STATE_CLOSED; 177 return this[_state] < _STATE_CLOSED;
139 } 178 }
140 _ensureDoneFuture() { 179 [_ensureDoneFuture]() {
141 if (this._doneFuture !== null) 180 if (this[_doneFuture] !== null)
142 return this._doneFuture; 181 return this[_doneFuture];
143 return this._doneFuture = new _Future(); 182 return this[_doneFuture] = new _Future();
144 } 183 }
145 get _isEmpty() { 184 get [_isEmpty]() {
146 return core.identical(this._next, this); 185 return core.identical(this[_next], this);
147 } 186 }
148 _addListener(subscription) { 187 [_addListener](subscription) {
149 dart.assert(core.identical(subscription._next, subscription)); 188 dart.assert(core.identical(subscription[_next], subscription));
150 subscription._previous = this._previous; 189 subscription[_previous] = this[_previous];
151 subscription._next = this; 190 subscription[_next] = this;
152 this._previous._next = subscription; 191 this[_previous][_next] = subscription;
153 this._previous = subscription; 192 this[_previous] = subscription;
154 subscription._eventState = this._state & _STATE_EVENT_ID; 193 subscription[_eventState] = this[_state] & _STATE_EVENT_ID;
155 } 194 }
156 _removeListener(subscription) { 195 [_removeListener](subscription) {
157 dart.assert(core.identical(subscription._controller, this)); 196 dart.assert(core.identical(subscription[_controller], this));
158 dart.assert(!dart.notNull(core.identical(subscription._next, subscriptio n))); 197 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti on)));
159 let previous = subscription._previous; 198 let previous = subscription[_previous];
160 let next = subscription._next; 199 let next = subscription[_next];
161 previous._next = next; 200 previous[_next] = next;
162 next._previous = previous; 201 next[_previous] = previous;
163 subscription._next = subscription._previous = subscription; 202 subscription[_next] = subscription[_previous] = subscription;
164 } 203 }
165 _subscribe(onData, onError, onDone, cancelOnError) { 204 [_subscribe](onData, onError, onDone, cancelOnError) {
166 if (this.isClosed) { 205 if (this.isClosed) {
167 if (onDone === null) 206 if (onDone === null)
168 onDone = _nullDoneHandler; 207 onDone = _nullDoneHandler;
169 return new _DoneStreamSubscription(onDone); 208 return new _DoneStreamSubscription(onDone);
170 } 209 }
171 let subscription = new _BroadcastSubscription(this, onData, onError, onD one, cancelOnError); 210 let subscription = new _BroadcastSubscription(this, onData, onError, onD one, cancelOnError);
172 this._addListener(dart.as(subscription, _BroadcastSubscription$(T))); 211 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T)));
173 if (core.identical(this._next, this._previous)) { 212 if (core.identical(this[_next], this[_previous])) {
174 _runGuarded(this._onListen); 213 _runGuarded(this[_onListen]);
175 } 214 }
176 return dart.as(subscription, StreamSubscription$(T)); 215 return dart.as(subscription, StreamSubscription$(T));
177 } 216 }
178 _recordCancel(subscription) { 217 [_recordCancel](subscription) {
179 if (core.identical(subscription._next, subscription)) 218 if (core.identical(subscription[_next], subscription))
180 return null; 219 return null;
181 dart.assert(!dart.notNull(core.identical(subscription._next, subscriptio n))); 220 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti on)));
182 if (subscription._isFiring) { 221 if (subscription[_isFiring]) {
183 subscription._setRemoveAfterFiring(); 222 subscription._setRemoveAfterFiring();
184 } else { 223 } else {
185 dart.assert(!dart.notNull(core.identical(subscription._next, subscript ion))); 224 dart.assert(!dart.notNull(core.identical(subscription[_next], subscrip tion)));
186 this._removeListener(subscription); 225 this[_removeListener](subscription);
187 if (dart.notNull(!dart.notNull(this._isFiring)) && dart.notNull(this._ isEmpty)) { 226 if (dart.notNull(!dart.notNull(this[_isFiring])) && dart.notNull(this[ _isEmpty])) {
188 this._callOnCancel(); 227 this[_callOnCancel]();
189 } 228 }
190 } 229 }
191 return null; 230 return null;
192 } 231 }
193 _recordPause(subscription) {} 232 [_recordPause](subscription) {}
194 _recordResume(subscription) {} 233 [_recordResume](subscription) {}
195 _addEventError() { 234 [_addEventError]() {
196 if (this.isClosed) { 235 if (this.isClosed) {
197 return new core.StateError("Cannot add new events after calling close" ); 236 return new core.StateError("Cannot add new events after calling close" );
198 } 237 }
199 dart.assert(this._isAddingStream); 238 dart.assert(this[_isAddingStream]);
200 return new core.StateError("Cannot add new events while doing an addStre am"); 239 return new core.StateError("Cannot add new events while doing an addStre am");
201 } 240 }
202 add(data) { 241 add(data) {
203 if (!dart.notNull(this._mayAddEvent)) 242 if (!dart.notNull(this[_mayAddEvent]))
204 throw this._addEventError(); 243 throw this[_addEventError]();
205 this._sendData(data); 244 this[_sendData](data);
206 } 245 }
207 addError(error, stackTrace) { 246 addError(error, stackTrace) {
208 if (stackTrace === void 0) 247 if (stackTrace === void 0)
209 stackTrace = null; 248 stackTrace = null;
210 error = _nonNullError(error); 249 error = _nonNullError(error);
211 if (!dart.notNull(this._mayAddEvent)) 250 if (!dart.notNull(this[_mayAddEvent]))
212 throw this._addEventError(); 251 throw this[_addEventError]();
213 let replacement = Zone.current.errorCallback(error, stackTrace); 252 let replacement = Zone.current.errorCallback(error, stackTrace);
214 if (replacement !== null) { 253 if (replacement !== null) {
215 error = _nonNullError(replacement.error); 254 error = _nonNullError(replacement.error);
216 stackTrace = replacement.stackTrace; 255 stackTrace = replacement.stackTrace;
217 } 256 }
218 this._sendError(error, stackTrace); 257 this[_sendError](error, stackTrace);
219 } 258 }
220 close() { 259 close() {
221 if (this.isClosed) { 260 if (this.isClosed) {
222 dart.assert(this._doneFuture !== null); 261 dart.assert(this[_doneFuture] !== null);
223 return this._doneFuture; 262 return this[_doneFuture];
224 } 263 }
225 if (!dart.notNull(this._mayAddEvent)) 264 if (!dart.notNull(this[_mayAddEvent]))
226 throw this._addEventError(); 265 throw this[_addEventError]();
227 this._state = _STATE_CLOSED; 266 this[_state] = _STATE_CLOSED;
228 let doneFuture = this._ensureDoneFuture(); 267 let doneFuture = this[_ensureDoneFuture]();
229 this._sendDone(); 268 this[_sendDone]();
230 return doneFuture; 269 return doneFuture;
231 } 270 }
232 get done() { 271 get done() {
233 return this._ensureDoneFuture(); 272 return this[_ensureDoneFuture]();
234 } 273 }
235 addStream(stream, opt$) { 274 addStream(stream, opt$) {
236 let cancelOnError = opt$.cancelOnError === void 0 ? true : opt$.cancelOn Error; 275 let cancelOnError = opt$.cancelOnError === void 0 ? true : opt$.cancelOn Error;
237 if (!dart.notNull(this._mayAddEvent)) 276 if (!dart.notNull(this[_mayAddEvent]))
238 throw this._addEventError(); 277 throw this[_addEventError]();
239 this._state = _STATE_ADDSTREAM; 278 this[_state] = _STATE_ADDSTREAM;
240 this._addStreamState = dart.as(new _AddStreamState(this, stream, cancelO nError), _AddStreamState$(T)); 279 this[_addStreamState] = dart.as(new _AddStreamState(this, stream, cancel OnError), _AddStreamState$(T));
241 return this._addStreamState.addStreamFuture; 280 return this[_addStreamState].addStreamFuture;
242 } 281 }
243 _add(data) { 282 [_add](data) {
244 this._sendData(data); 283 this[_sendData](data);
245 } 284 }
246 _addError(error, stackTrace) { 285 [_addError](error, stackTrace) {
247 this._sendError(error, stackTrace); 286 this[_sendError](error, stackTrace);
248 } 287 }
249 _close() { 288 [_close]() {
250 dart.assert(this._isAddingStream); 289 dart.assert(this[_isAddingStream]);
251 let addState = this._addStreamState; 290 let addState = this[_addStreamState];
252 this._addStreamState = null; 291 this[_addStreamState] = null;
253 this._state = ~_STATE_ADDSTREAM; 292 this[_state] = ~_STATE_ADDSTREAM;
254 addState.complete(); 293 addState.complete();
255 } 294 }
256 _forEachListener(action) { 295 [_forEachListener](action) {
257 if (this._isFiring) { 296 if (this[_isFiring]) {
258 throw new core.StateError("Cannot fire new event. Controller is alread y firing an event"); 297 throw new core.StateError("Cannot fire new event. Controller is alread y firing an event");
259 } 298 }
260 if (this._isEmpty) 299 if (this[_isEmpty])
261 return; 300 return;
262 let id = this._state & _STATE_EVENT_ID; 301 let id = this[_state] & _STATE_EVENT_ID;
263 this._state = _STATE_EVENT_ID | _STATE_FIRING; 302 this[_state] = _STATE_EVENT_ID | _STATE_FIRING;
264 let link = this._next; 303 let link = this[_next];
265 while (!dart.notNull(core.identical(link, this))) { 304 while (!dart.notNull(core.identical(link, this))) {
266 let subscription = dart.as(link, _BroadcastSubscription$(T)); 305 let subscription = dart.as(link, _BroadcastSubscription$(T));
267 if (subscription._expectsEvent(id)) { 306 if (subscription._expectsEvent(id)) {
268 subscription._eventState = _BroadcastSubscription._STATE_FIRING; 307 subscription[_eventState] = _BroadcastSubscription[_STATE_FIRING];
269 action(subscription); 308 action(subscription);
270 subscription._toggleEventId(); 309 subscription._toggleEventId();
271 link = subscription._next; 310 link = subscription[_next];
272 if (subscription._removeAfterFiring) { 311 if (subscription[_removeAfterFiring]) {
273 this._removeListener(subscription); 312 this[_removeListener](subscription);
274 } 313 }
275 subscription._eventState = ~_BroadcastSubscription._STATE_FIRING; 314 subscription[_eventState] = ~_BroadcastSubscription[_STATE_FIRING];
276 } else { 315 } else {
277 link = subscription._next; 316 link = subscription[_next];
278 } 317 }
279 } 318 }
280 this._state = ~_STATE_FIRING; 319 this[_state] = ~_STATE_FIRING;
281 if (this._isEmpty) { 320 if (this[_isEmpty]) {
282 this._callOnCancel(); 321 this[_callOnCancel]();
283 } 322 }
284 } 323 }
285 _callOnCancel() { 324 [_callOnCancel]() {
286 dart.assert(this._isEmpty); 325 dart.assert(this[_isEmpty]);
287 if (dart.notNull(this.isClosed) && dart.notNull(this._doneFuture._mayCom plete)) { 326 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo mplete])) {
288 this._doneFuture._asyncComplete(null); 327 this[_doneFuture]._asyncComplete(null);
289 } 328 }
290 _runGuarded(this._onCancel); 329 _runGuarded(this[_onCancel]);
291 } 330 }
292 } 331 }
293 _BroadcastStreamController._STATE_INITIAL = 0; 332 _BroadcastStreamController._STATE_INITIAL = 0;
294 _BroadcastStreamController._STATE_EVENT_ID = 1; 333 _BroadcastStreamController._STATE_EVENT_ID = 1;
295 _BroadcastStreamController._STATE_FIRING = 2; 334 _BroadcastStreamController._STATE_FIRING = 2;
296 _BroadcastStreamController._STATE_CLOSED = 4; 335 _BroadcastStreamController._STATE_CLOSED = 4;
297 _BroadcastStreamController._STATE_ADDSTREAM = 8; 336 _BroadcastStreamController._STATE_ADDSTREAM = 8;
298 return _BroadcastStreamController; 337 return _BroadcastStreamController;
299 }); 338 });
300 let _BroadcastStreamController = _BroadcastStreamController$(dynamic); 339 let _BroadcastStreamController = _BroadcastStreamController$(dynamic);
301 let _SyncBroadcastStreamController$ = dart.generic(function(T) { 340 let _SyncBroadcastStreamController$ = dart.generic(function(T) {
302 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) { 341 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) {
303 _SyncBroadcastStreamController(onListen, onCancel) { 342 _SyncBroadcastStreamController(onListen, onCancel) {
304 super._BroadcastStreamController(onListen, onCancel); 343 super._BroadcastStreamController(onListen, onCancel);
305 } 344 }
306 _sendData(data) { 345 [_sendData](data) {
307 if (this._isEmpty) 346 if (this[_isEmpty])
308 return; 347 return;
309 if (this._hasOneListener) { 348 if (this[_hasOneListener]) {
310 this._state = _BroadcastStreamController._STATE_FIRING; 349 this[_state] = _BroadcastStreamController[_STATE_FIRING];
311 let subscription = dart.as(this._next, _BroadcastSubscription); 350 let subscription = dart.as(this[_next], _BroadcastSubscription);
312 subscription._add(data); 351 subscription._add(data);
313 this._state = ~_BroadcastStreamController._STATE_FIRING; 352 this[_state] = ~_BroadcastStreamController[_STATE_FIRING];
314 if (this._isEmpty) { 353 if (this[_isEmpty]) {
315 this._callOnCancel(); 354 this[_callOnCancel]();
316 } 355 }
317 return; 356 return;
318 } 357 }
319 this._forEachListener(((subscription) => { 358 this[_forEachListener](((subscription) => {
320 subscription._add(data); 359 subscription._add(data);
321 }).bind(this)); 360 }).bind(this));
322 } 361 }
323 _sendError(error, stackTrace) { 362 [_sendError](error, stackTrace) {
324 if (this._isEmpty) 363 if (this[_isEmpty])
325 return; 364 return;
326 this._forEachListener(((subscription) => { 365 this[_forEachListener](((subscription) => {
327 subscription._addError(error, stackTrace); 366 subscription._addError(error, stackTrace);
328 }).bind(this)); 367 }).bind(this));
329 } 368 }
330 _sendDone() { 369 [_sendDone]() {
331 if (!dart.notNull(this._isEmpty)) { 370 if (!dart.notNull(this[_isEmpty])) {
332 this._forEachListener(dart.as(((subscription) => { 371 this[_forEachListener](dart.as(((subscription) => {
333 subscription._close(); 372 subscription._close();
334 }).bind(this), dart.throw_("Unimplemented type (_BufferingStreamSubscr iption<T>) → void"))); 373 }).bind(this), dart.throw_("Unimplemented type (_BufferingStreamSubscr iption<T>) → void")));
335 } else { 374 } else {
336 dart.assert(this._doneFuture !== null); 375 dart.assert(this[_doneFuture] !== null);
337 dart.assert(this._doneFuture._mayComplete); 376 dart.assert(this[_doneFuture][_mayComplete]);
338 this._doneFuture._asyncComplete(null); 377 this[_doneFuture]._asyncComplete(null);
339 } 378 }
340 } 379 }
341 } 380 }
342 return _SyncBroadcastStreamController; 381 return _SyncBroadcastStreamController;
343 }); 382 });
344 let _SyncBroadcastStreamController = _SyncBroadcastStreamController$(dynamic); 383 let _SyncBroadcastStreamController = _SyncBroadcastStreamController$(dynamic);
345 let _AsyncBroadcastStreamController$ = dart.generic(function(T) { 384 let _AsyncBroadcastStreamController$ = dart.generic(function(T) {
346 class _AsyncBroadcastStreamController extends _BroadcastStreamController$(T) { 385 class _AsyncBroadcastStreamController extends _BroadcastStreamController$(T) {
347 _AsyncBroadcastStreamController(onListen, onCancel) { 386 _AsyncBroadcastStreamController(onListen, onCancel) {
348 super._BroadcastStreamController(onListen, onCancel); 387 super._BroadcastStreamController(onListen, onCancel);
349 } 388 }
350 _sendData(data) { 389 [_sendData](data) {
351 for (let link = this._next; !dart.notNull(core.identical(link, this)); l ink = link._next) { 390 for (let link = this[_next]; !dart.notNull(core.identical(link, this)); link = link[_next]) {
352 let subscription = dart.as(link, _BroadcastSubscription$(T)); 391 let subscription = dart.as(link, _BroadcastSubscription$(T));
353 subscription._addPending(new _DelayedData(data)); 392 subscription._addPending(new _DelayedData(data));
354 } 393 }
355 } 394 }
356 _sendError(error, stackTrace) { 395 [_sendError](error, stackTrace) {
357 for (let link = this._next; !dart.notNull(core.identical(link, this)); l ink = link._next) { 396 for (let link = this[_next]; !dart.notNull(core.identical(link, this)); link = link[_next]) {
358 let subscription = dart.as(link, _BroadcastSubscription$(T)); 397 let subscription = dart.as(link, _BroadcastSubscription$(T));
359 subscription._addPending(new _DelayedError(error, stackTrace)); 398 subscription._addPending(new _DelayedError(error, stackTrace));
360 } 399 }
361 } 400 }
362 _sendDone() { 401 [_sendDone]() {
363 if (!dart.notNull(this._isEmpty)) { 402 if (!dart.notNull(this[_isEmpty])) {
364 for (let link = this._next; !dart.notNull(core.identical(link, this)); link = link._next) { 403 for (let link = this[_next]; !dart.notNull(core.identical(link, this)) ; link = link[_next]) {
365 let subscription = dart.as(link, _BroadcastSubscription$(T)); 404 let subscription = dart.as(link, _BroadcastSubscription$(T));
366 subscription._addPending(new _DelayedDone()); 405 subscription._addPending(new _DelayedDone());
367 } 406 }
368 } else { 407 } else {
369 dart.assert(this._doneFuture !== null); 408 dart.assert(this[_doneFuture] !== null);
370 dart.assert(this._doneFuture._mayComplete); 409 dart.assert(this[_doneFuture][_mayComplete]);
371 this._doneFuture._asyncComplete(null); 410 this[_doneFuture]._asyncComplete(null);
372 } 411 }
373 } 412 }
374 } 413 }
375 return _AsyncBroadcastStreamController; 414 return _AsyncBroadcastStreamController;
376 }); 415 });
377 let _AsyncBroadcastStreamController = _AsyncBroadcastStreamController$(dynamic ); 416 let _AsyncBroadcastStreamController = _AsyncBroadcastStreamController$(dynamic );
417 let _pending = Symbol('_pending');
418 let _hasPending = Symbol('_hasPending');
419 let _addPendingEvent = Symbol('_addPendingEvent');
420 let _STATE_CLOSED = Symbol('_STATE_CLOSED');
378 let _AsBroadcastStreamController$ = dart.generic(function(T) { 421 let _AsBroadcastStreamController$ = dart.generic(function(T) {
379 class _AsBroadcastStreamController extends _SyncBroadcastStreamController$(T ) { 422 class _AsBroadcastStreamController extends _SyncBroadcastStreamController$(T ) {
380 _AsBroadcastStreamController(onListen, onCancel) { 423 _AsBroadcastStreamController(onListen, onCancel) {
381 this._pending = null; 424 this[_pending] = null;
382 super._SyncBroadcastStreamController(onListen, onCancel); 425 super._SyncBroadcastStreamController(onListen, onCancel);
383 } 426 }
384 get _hasPending() { 427 get [_hasPending]() {
385 return dart.notNull(this._pending !== null) && dart.notNull(!dart.notNul l(this._pending.isEmpty)); 428 return dart.notNull(this[_pending] !== null) && dart.notNull(!dart.notNu ll(this[_pending].isEmpty));
386 } 429 }
387 _addPendingEvent(event) { 430 [_addPendingEvent](event) {
388 if (this._pending === null) { 431 if (this[_pending] === null) {
389 this._pending = new _StreamImplEvents(); 432 this[_pending] = new _StreamImplEvents();
390 } 433 }
391 this._pending.add(event); 434 this[_pending].add(event);
392 } 435 }
393 add(data) { 436 add(data) {
394 if (dart.notNull(!dart.notNull(this.isClosed)) && dart.notNull(this._isF iring)) { 437 if (dart.notNull(!dart.notNull(this.isClosed)) && dart.notNull(this[_isF iring])) {
395 this._addPendingEvent(new _DelayedData(data)); 438 this[_addPendingEvent](new _DelayedData(data));
396 return; 439 return;
397 } 440 }
398 super.add(data); 441 super.add(data);
399 while (this._hasPending) { 442 while (this[_hasPending]) {
400 this._pending.handleNext(this); 443 this[_pending].handleNext(this);
401 } 444 }
402 } 445 }
403 addError(error, stackTrace) { 446 addError(error, stackTrace) {
404 if (stackTrace === void 0) 447 if (stackTrace === void 0)
405 stackTrace = null; 448 stackTrace = null;
406 if (dart.notNull(!dart.notNull(this.isClosed)) && dart.notNull(this._isF iring)) { 449 if (dart.notNull(!dart.notNull(this.isClosed)) && dart.notNull(this[_isF iring])) {
407 this._addPendingEvent(new _DelayedError(error, stackTrace)); 450 this[_addPendingEvent](new _DelayedError(error, stackTrace));
408 return; 451 return;
409 } 452 }
410 if (!dart.notNull(this._mayAddEvent)) 453 if (!dart.notNull(this[_mayAddEvent]))
411 throw this._addEventError(); 454 throw this[_addEventError]();
412 this._sendError(error, stackTrace); 455 this[_sendError](error, stackTrace);
413 while (this._hasPending) { 456 while (this[_hasPending]) {
414 this._pending.handleNext(this); 457 this[_pending].handleNext(this);
415 } 458 }
416 } 459 }
417 close() { 460 close() {
418 if (dart.notNull(!dart.notNull(this.isClosed)) && dart.notNull(this._isF iring)) { 461 if (dart.notNull(!dart.notNull(this.isClosed)) && dart.notNull(this[_isF iring])) {
419 this._addPendingEvent(new _DelayedDone()); 462 this[_addPendingEvent](new _DelayedDone());
420 this._state = _BroadcastStreamController._STATE_CLOSED; 463 this[_state] = _BroadcastStreamController[_STATE_CLOSED];
421 return super.done; 464 return super.done;
422 } 465 }
423 let result = super.close(); 466 let result = super.close();
424 dart.assert(!dart.notNull(this._hasPending)); 467 dart.assert(!dart.notNull(this[_hasPending]));
425 return result; 468 return result;
426 } 469 }
427 _callOnCancel() { 470 [_callOnCancel]() {
428 if (this._hasPending) { 471 if (this[_hasPending]) {
429 this._pending.clear(); 472 this[_pending].clear();
430 this._pending = null; 473 this[_pending] = null;
431 } 474 }
432 super._callOnCancel(); 475 super._callOnCancel();
433 } 476 }
434 } 477 }
435 return _AsBroadcastStreamController; 478 return _AsBroadcastStreamController;
436 }); 479 });
437 let _AsBroadcastStreamController = _AsBroadcastStreamController$(dynamic); 480 let _AsBroadcastStreamController = _AsBroadcastStreamController$(dynamic);
481 let _pauseCount = Symbol('_pauseCount');
482 let _resume = Symbol('_resume');
438 let _DoneSubscription$ = dart.generic(function(T) { 483 let _DoneSubscription$ = dart.generic(function(T) {
439 class _DoneSubscription extends dart.Object { 484 class _DoneSubscription extends dart.Object {
440 _DoneSubscription() { 485 _DoneSubscription() {
441 this._pauseCount = 0; 486 this[_pauseCount] = 0;
442 } 487 }
443 onData(handleData) {} 488 onData(handleData) {}
444 onError(handleError) {} 489 onError(handleError) {}
445 onDone(handleDone) {} 490 onDone(handleDone) {}
446 pause(resumeSignal) { 491 pause(resumeSignal) {
447 if (resumeSignal === void 0) 492 if (resumeSignal === void 0)
448 resumeSignal = null; 493 resumeSignal = null;
449 if (resumeSignal !== null) 494 if (resumeSignal !== null)
450 resumeSignal.then(this._resume); 495 resumeSignal.then(this[_resume]);
451 this._pauseCount++; 496 this[_pauseCount]++;
452 } 497 }
453 resume() { 498 resume() {
454 this._resume(null); 499 this[_resume](null);
455 } 500 }
456 _resume(_) { 501 [_resume](_) {
457 if (this._pauseCount > 0) 502 if (this[_pauseCount] > 0)
458 this._pauseCount--; 503 this[_pauseCount]--;
459 } 504 }
460 cancel() { 505 cancel() {
461 return new _Future.immediate(null); 506 return new _Future.immediate(null);
462 } 507 }
463 get isPaused() { 508 get isPaused() {
464 return this._pauseCount > 0; 509 return this[_pauseCount] > 0;
465 } 510 }
466 asFuture(value) { 511 asFuture(value) {
467 if (value === void 0) 512 if (value === void 0)
468 value = null; 513 value = null;
469 return new _Future(); 514 return new _Future();
470 } 515 }
471 } 516 }
472 return _DoneSubscription; 517 return _DoneSubscription;
473 }); 518 });
474 let _DoneSubscription = _DoneSubscription$(dynamic); 519 let _DoneSubscription = _DoneSubscription$(dynamic);
475 class DeferredLibrary extends dart.Object { 520 class DeferredLibrary extends dart.Object {
476 DeferredLibrary(libraryName, opt$) { 521 DeferredLibrary(libraryName, opt$) {
477 let uri = opt$.uri === void 0 ? null : opt$.uri; 522 let uri = opt$.uri === void 0 ? null : opt$.uri;
478 this.libraryName = libraryName; 523 this.libraryName = libraryName;
479 this.uri = uri; 524 this.uri = uri;
480 } 525 }
481 load() { 526 load() {
482 throw 'DeferredLibrary not supported. ' + 'please use the `import "lib.dar t" deferred as lib` syntax.'; 527 throw 'DeferredLibrary not supported. ' + 'please use the `import "lib.dar t" deferred as lib` syntax.';
483 } 528 }
484 } 529 }
530 let _s = Symbol('_s');
485 class DeferredLoadException extends dart.Object { 531 class DeferredLoadException extends dart.Object {
486 DeferredLoadException(_s) { 532 DeferredLoadException($_s) {
487 this._s = _s; 533 this[_s] = $_s;
488 } 534 }
489 toString() { 535 toString() {
490 return `DeferredLoadException: '${this._s}'`; 536 return `DeferredLoadException: '${this[_s]}'`;
491 } 537 }
492 } 538 }
539 let _completeError = Symbol('_completeError');
493 let Future$ = dart.generic(function(T) { 540 let Future$ = dart.generic(function(T) {
494 class Future extends dart.Object { 541 class Future extends dart.Object {
495 Future(computation) { 542 Future(computation) {
496 let result = new _Future(); 543 let result = new _Future();
497 Timer.run((() => { 544 Timer.run((() => {
498 try { 545 try {
499 result._complete(computation()); 546 result._complete(computation());
500 } catch (e) { 547 } catch (e) {
501 let s = dart.stackTrace(e); 548 let s = dart.stackTrace(e);
502 _completeWithErrorCallback(result, e, s); 549 _completeWithErrorCallback(result, e, s);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 if (!dart.notNull(iterator.moveNext())) 673 if (!dart.notNull(iterator.moveNext()))
627 return false; 674 return false;
628 return new Future.sync((() => f(iterator.current)).bind(this)).then((_ ) => true); 675 return new Future.sync((() => f(iterator.current)).bind(this)).then((_ ) => true);
629 }).bind(this)); 676 }).bind(this));
630 } 677 }
631 static doWhile(f) { 678 static doWhile(f) {
632 let doneSignal = new _Future(); 679 let doneSignal = new _Future();
633 let nextIteration = null; 680 let nextIteration = null;
634 nextIteration = Zone.current.bindUnaryCallback(dart.as(((keepGoing) => { 681 nextIteration = Zone.current.bindUnaryCallback(dart.as(((keepGoing) => {
635 if (keepGoing) { 682 if (keepGoing) {
636 new Future.sync(f).then(dart.as(nextIteration, dart.throw_("Unimplem ented type (dynamic) → dynamic")), {onError: doneSignal._completeError}); 683 new Future.sync(f).then(dart.as(nextIteration, dart.throw_("Unimplem ented type (dynamic) → dynamic")), {onError: doneSignal[_completeError]});
637 } else { 684 } else {
638 doneSignal._complete(null); 685 doneSignal._complete(null);
639 } 686 }
640 }).bind(this), dart.throw_("Unimplemented type (dynamic) → dynamic")), { runGuarded: true}); 687 }).bind(this), dart.throw_("Unimplemented type (dynamic) → dynamic")), { runGuarded: true});
641 dart.dinvokef(nextIteration, true); 688 dart.dinvokef(nextIteration, true);
642 return doneSignal; 689 return doneSignal;
643 } 690 }
644 } 691 }
645 dart.defineNamedConstructor(Future, 'microtask'); 692 dart.defineNamedConstructor(Future, 'microtask');
646 dart.defineNamedConstructor(Future, 'sync'); 693 dart.defineNamedConstructor(Future, 'sync');
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 746 }
700 let _Completer$ = dart.generic(function(T) { 747 let _Completer$ = dart.generic(function(T) {
701 class _Completer extends dart.Object { 748 class _Completer extends dart.Object {
702 _Completer() { 749 _Completer() {
703 this.future = new _Future(); 750 this.future = new _Future();
704 } 751 }
705 completeError(error, stackTrace) { 752 completeError(error, stackTrace) {
706 if (stackTrace === void 0) 753 if (stackTrace === void 0)
707 stackTrace = null; 754 stackTrace = null;
708 error = _nonNullError(error); 755 error = _nonNullError(error);
709 if (!dart.notNull(this.future._mayComplete)) 756 if (!dart.notNull(this.future[_mayComplete]))
710 throw new core.StateError("Future already completed"); 757 throw new core.StateError("Future already completed");
711 let replacement = Zone.current.errorCallback(error, stackTrace); 758 let replacement = Zone.current.errorCallback(error, stackTrace);
712 if (replacement !== null) { 759 if (replacement !== null) {
713 error = _nonNullError(replacement.error); 760 error = _nonNullError(replacement.error);
714 stackTrace = replacement.stackTrace; 761 stackTrace = replacement.stackTrace;
715 } 762 }
716 this._completeError(error, stackTrace); 763 this[_completeError](error, stackTrace);
717 } 764 }
718 get isCompleted() { 765 get isCompleted() {
719 return !dart.notNull(this.future._mayComplete); 766 return !dart.notNull(this.future[_mayComplete]);
720 } 767 }
721 } 768 }
722 return _Completer; 769 return _Completer;
723 }); 770 });
724 let _Completer = _Completer$(dynamic); 771 let _Completer = _Completer$(dynamic);
725 let _AsyncCompleter$ = dart.generic(function(T) { 772 let _AsyncCompleter$ = dart.generic(function(T) {
726 class _AsyncCompleter extends _Completer$(T) { 773 class _AsyncCompleter extends _Completer$(T) {
727 complete(value) { 774 complete(value) {
728 if (value === void 0) 775 if (value === void 0)
729 value = null; 776 value = null;
730 if (!dart.notNull(this.future._mayComplete)) 777 if (!dart.notNull(this.future[_mayComplete]))
731 throw new core.StateError("Future already completed"); 778 throw new core.StateError("Future already completed");
732 this.future._asyncComplete(value); 779 this.future._asyncComplete(value);
733 } 780 }
734 _completeError(error, stackTrace) { 781 [_completeError](error, stackTrace) {
735 this.future._asyncCompleteError(error, stackTrace); 782 this.future._asyncCompleteError(error, stackTrace);
736 } 783 }
737 } 784 }
738 return _AsyncCompleter; 785 return _AsyncCompleter;
739 }); 786 });
740 let _AsyncCompleter = _AsyncCompleter$(dynamic); 787 let _AsyncCompleter = _AsyncCompleter$(dynamic);
741 let _SyncCompleter$ = dart.generic(function(T) { 788 let _SyncCompleter$ = dart.generic(function(T) {
742 class _SyncCompleter extends _Completer$(T) { 789 class _SyncCompleter extends _Completer$(T) {
743 complete(value) { 790 complete(value) {
744 if (value === void 0) 791 if (value === void 0)
745 value = null; 792 value = null;
746 if (!dart.notNull(this.future._mayComplete)) 793 if (!dart.notNull(this.future[_mayComplete]))
747 throw new core.StateError("Future already completed"); 794 throw new core.StateError("Future already completed");
748 this.future._complete(value); 795 this.future._complete(value);
749 } 796 }
750 _completeError(error, stackTrace) { 797 [_completeError](error, stackTrace) {
751 this.future._completeError(error, stackTrace); 798 this.future._completeError(error, stackTrace);
752 } 799 }
753 } 800 }
754 return _SyncCompleter; 801 return _SyncCompleter;
755 }); 802 });
756 let _SyncCompleter = _SyncCompleter$(dynamic); 803 let _SyncCompleter = _SyncCompleter$(dynamic);
804 let _nextListener = Symbol('_nextListener');
805 let _zone = Symbol('_zone');
806 let _onValue = Symbol('_onValue');
807 let _onError = Symbol('_onError');
808 let _errorTest = Symbol('_errorTest');
809 let _whenCompleteAction = Symbol('_whenCompleteAction');
757 class _FutureListener extends dart.Object { 810 class _FutureListener extends dart.Object {
758 _FutureListener$then(result, onValue, errorCallback) { 811 _FutureListener$then(result, onValue, errorCallback) {
759 this.result = result; 812 this.result = result;
760 this.callback = onValue; 813 this.callback = onValue;
761 this.errorCallback = errorCallback; 814 this.errorCallback = errorCallback;
762 this.state = errorCallback === null ? STATE_THEN : STATE_THEN_ONERROR; 815 this.state = errorCallback === null ? STATE_THEN : STATE_THEN_ONERROR;
763 this._nextListener = null; 816 this[_nextListener] = null;
764 } 817 }
765 _FutureListener$catchError(result, errorCallback, test) { 818 _FutureListener$catchError(result, errorCallback, test) {
766 this.result = result; 819 this.result = result;
767 this.errorCallback = errorCallback; 820 this.errorCallback = errorCallback;
768 this.callback = test; 821 this.callback = test;
769 this.state = test === null ? STATE_CATCHERROR : STATE_CATCHERROR_TEST; 822 this.state = test === null ? STATE_CATCHERROR : STATE_CATCHERROR_TEST;
770 this._nextListener = null; 823 this[_nextListener] = null;
771 } 824 }
772 _FutureListener$whenComplete(result, onComplete) { 825 _FutureListener$whenComplete(result, onComplete) {
773 this.result = result; 826 this.result = result;
774 this.callback = onComplete; 827 this.callback = onComplete;
775 this.errorCallback = null; 828 this.errorCallback = null;
776 this.state = STATE_WHENCOMPLETE; 829 this.state = STATE_WHENCOMPLETE;
777 this._nextListener = null; 830 this[_nextListener] = null;
778 } 831 }
779 _FutureListener$chain(result) { 832 _FutureListener$chain(result) {
780 this.result = result; 833 this.result = result;
781 this.callback = null; 834 this.callback = null;
782 this.errorCallback = null; 835 this.errorCallback = null;
783 this.state = STATE_CHAIN; 836 this.state = STATE_CHAIN;
784 this._nextListener = null; 837 this[_nextListener] = null;
785 } 838 }
786 get _zone() { 839 get [_zone]() {
787 return this.result._zone; 840 return this.result[_zone];
788 } 841 }
789 get handlesValue() { 842 get handlesValue() {
790 return (this.state & MASK_VALUE) !== 0; 843 return (this.state & MASK_VALUE) !== 0;
791 } 844 }
792 get handlesError() { 845 get handlesError() {
793 return (this.state & MASK_ERROR) !== 0; 846 return (this.state & MASK_ERROR) !== 0;
794 } 847 }
795 get hasErrorTest() { 848 get hasErrorTest() {
796 return this.state === STATE_CATCHERROR_TEST; 849 return this.state === STATE_CATCHERROR_TEST;
797 } 850 }
798 get handlesComplete() { 851 get handlesComplete() {
799 return this.state === STATE_WHENCOMPLETE; 852 return this.state === STATE_WHENCOMPLETE;
800 } 853 }
801 get _onValue() { 854 get [_onValue]() {
802 dart.assert(this.handlesValue); 855 dart.assert(this.handlesValue);
803 return dart.as(this.callback, _FutureOnValue); 856 return dart.as(this.callback, _FutureOnValue);
804 } 857 }
805 get _onError() { 858 get [_onError]() {
806 return this.errorCallback; 859 return this.errorCallback;
807 } 860 }
808 get _errorTest() { 861 get [_errorTest]() {
809 dart.assert(this.hasErrorTest); 862 dart.assert(this.hasErrorTest);
810 return dart.as(this.callback, _FutureErrorTest); 863 return dart.as(this.callback, _FutureErrorTest);
811 } 864 }
812 get _whenCompleteAction() { 865 get [_whenCompleteAction]() {
813 dart.assert(this.handlesComplete); 866 dart.assert(this.handlesComplete);
814 return dart.as(this.callback, _FutureAction); 867 return dart.as(this.callback, _FutureAction);
815 } 868 }
816 } 869 }
817 dart.defineNamedConstructor(_FutureListener, 'then'); 870 dart.defineNamedConstructor(_FutureListener, 'then');
818 dart.defineNamedConstructor(_FutureListener, 'catchError'); 871 dart.defineNamedConstructor(_FutureListener, 'catchError');
819 dart.defineNamedConstructor(_FutureListener, 'whenComplete'); 872 dart.defineNamedConstructor(_FutureListener, 'whenComplete');
820 dart.defineNamedConstructor(_FutureListener, 'chain'); 873 dart.defineNamedConstructor(_FutureListener, 'chain');
821 _FutureListener.MASK_VALUE = 1; 874 _FutureListener.MASK_VALUE = 1;
822 _FutureListener.MASK_ERROR = 2; 875 _FutureListener.MASK_ERROR = 2;
823 _FutureListener.MASK_TEST_ERROR = 4; 876 _FutureListener.MASK_TEST_ERROR = 4;
824 _FutureListener.MASK_WHENCOMPLETE = 8; 877 _FutureListener.MASK_WHENCOMPLETE = 8;
825 _FutureListener.STATE_CHAIN = 0; 878 _FutureListener.STATE_CHAIN = 0;
826 _FutureListener.STATE_THEN = MASK_VALUE; 879 _FutureListener.STATE_THEN = MASK_VALUE;
827 _FutureListener.STATE_THEN_ONERROR = MASK_VALUE | MASK_ERROR; 880 _FutureListener.STATE_THEN_ONERROR = MASK_VALUE | MASK_ERROR;
828 _FutureListener.STATE_CATCHERROR = MASK_ERROR; 881 _FutureListener.STATE_CATCHERROR = MASK_ERROR;
829 _FutureListener.STATE_CATCHERROR_TEST = MASK_ERROR | MASK_TEST_ERROR; 882 _FutureListener.STATE_CATCHERROR_TEST = MASK_ERROR | MASK_TEST_ERROR;
830 _FutureListener.STATE_WHENCOMPLETE = MASK_WHENCOMPLETE; 883 _FutureListener.STATE_WHENCOMPLETE = MASK_WHENCOMPLETE;
884 let _resultOrListeners = Symbol('_resultOrListeners');
885 let _asyncComplete = Symbol('_asyncComplete');
886 let _asyncCompleteError = Symbol('_asyncCompleteError');
887 let _isChained = Symbol('_isChained');
888 let _isComplete = Symbol('_isComplete');
889 let _hasValue = Symbol('_hasValue');
890 let _hasError = Symbol('_hasError');
891 let _markPendingCompletion = Symbol('_markPendingCompletion');
892 let _value = Symbol('_value');
893 let _error = Symbol('_error');
894 let _setValue = Symbol('_setValue');
895 let _setErrorObject = Symbol('_setErrorObject');
896 let _setError = Symbol('_setError');
897 let _removeListeners = Symbol('_removeListeners');
898 let _chainForeignFuture = Symbol('_chainForeignFuture');
899 let _chainCoreFuture = Symbol('_chainCoreFuture');
900 let _complete = Symbol('_complete');
901 let _completeWithValue = Symbol('_completeWithValue');
902 let _propagateToListeners = Symbol('_propagateToListeners');
831 let _Future$ = dart.generic(function(T) { 903 let _Future$ = dart.generic(function(T) {
832 class _Future extends dart.Object { 904 class _Future extends dart.Object {
833 _Future() { 905 _Future() {
834 this._zone = Zone.current; 906 this[_zone] = Zone.current;
835 this._state = _INCOMPLETE; 907 this[_state] = _INCOMPLETE;
836 this._resultOrListeners = null; 908 this[_resultOrListeners] = null;
837 } 909 }
838 _Future$immediate(value) { 910 _Future$immediate(value) {
839 this._zone = Zone.current; 911 this[_zone] = Zone.current;
840 this._state = _INCOMPLETE; 912 this[_state] = _INCOMPLETE;
841 this._resultOrListeners = null; 913 this[_resultOrListeners] = null;
842 this._asyncComplete(value); 914 this[_asyncComplete](value);
843 } 915 }
844 _Future$immediateError(error, stackTrace) { 916 _Future$immediateError(error, stackTrace) {
845 if (stackTrace === void 0) 917 if (stackTrace === void 0)
846 stackTrace = null; 918 stackTrace = null;
847 this._zone = Zone.current; 919 this[_zone] = Zone.current;
848 this._state = _INCOMPLETE; 920 this[_state] = _INCOMPLETE;
849 this._resultOrListeners = null; 921 this[_resultOrListeners] = null;
850 this._asyncCompleteError(error, stackTrace); 922 this[_asyncCompleteError](error, stackTrace);
851 } 923 }
852 get _mayComplete() { 924 get [_mayComplete]() {
853 return this._state === _INCOMPLETE; 925 return this[_state] === _INCOMPLETE;
854 } 926 }
855 get _isChained() { 927 get [_isChained]() {
856 return this._state === _CHAINED; 928 return this[_state] === _CHAINED;
857 } 929 }
858 get _isComplete() { 930 get [_isComplete]() {
859 return this._state >= _VALUE; 931 return this[_state] >= _VALUE;
860 } 932 }
861 get _hasValue() { 933 get [_hasValue]() {
862 return this._state === _VALUE; 934 return this[_state] === _VALUE;
863 } 935 }
864 get _hasError() { 936 get [_hasError]() {
865 return this._state === _ERROR; 937 return this[_state] === _ERROR;
866 } 938 }
867 set _isChained(value) { 939 set [_isChained](value) {
868 if (value) { 940 if (value) {
869 dart.assert(!dart.notNull(this._isComplete)); 941 dart.assert(!dart.notNull(this[_isComplete]));
870 this._state = _CHAINED; 942 this[_state] = _CHAINED;
871 } else { 943 } else {
872 dart.assert(this._isChained); 944 dart.assert(this[_isChained]);
873 this._state = _INCOMPLETE; 945 this[_state] = _INCOMPLETE;
874 } 946 }
875 } 947 }
876 then(f, opt$) { 948 then(f, opt$) {
877 let onError = opt$.onError === void 0 ? null : opt$.onError; 949 let onError = opt$.onError === void 0 ? null : opt$.onError;
878 let result = new _Future(); 950 let result = new _Future();
879 if (!dart.notNull(core.identical(result._zone, _ROOT_ZONE))) { 951 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
880 f = result._zone.registerUnaryCallback(dart.as(f, dart.throw_("Unimple mented type (dynamic) → dynamic"))); 952 f = result[_zone].registerUnaryCallback(dart.as(f, dart.throw_("Unimpl emented type (dynamic) → dynamic")));
881 if (onError !== null) { 953 if (onError !== null) {
882 onError = _registerErrorHandler(onError, result._zone); 954 onError = _registerErrorHandler(onError, result[_zone]);
883 } 955 }
884 } 956 }
885 this._addListener(new _FutureListener.then(result, dart.as(f, _FutureOnV alue), onError)); 957 this[_addListener](new _FutureListener.then(result, dart.as(f, _FutureOn Value), onError));
886 return result; 958 return result;
887 } 959 }
888 catchError(onError, opt$) { 960 catchError(onError, opt$) {
889 let test = opt$.test === void 0 ? null : opt$.test; 961 let test = opt$.test === void 0 ? null : opt$.test;
890 let result = new _Future(); 962 let result = new _Future();
891 if (!dart.notNull(core.identical(result._zone, _ROOT_ZONE))) { 963 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
892 onError = _registerErrorHandler(onError, result._zone); 964 onError = _registerErrorHandler(onError, result[_zone]);
893 if (test !== null) 965 if (test !== null)
894 test = dart.as(result._zone.registerUnaryCallback(test), dart.throw_ ("Unimplemented type (dynamic) → bool")); 966 test = dart.as(result[_zone].registerUnaryCallback(test), dart.throw _("Unimplemented type (dynamic) → bool"));
895 } 967 }
896 this._addListener(new _FutureListener.catchError(result, onError, test)) ; 968 this[_addListener](new _FutureListener.catchError(result, onError, test) );
897 return result; 969 return result;
898 } 970 }
899 whenComplete(action) { 971 whenComplete(action) {
900 let result = new _Future(); 972 let result = new _Future();
901 if (!dart.notNull(core.identical(result._zone, _ROOT_ZONE))) { 973 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
902 action = result._zone.registerCallback(action); 974 action = result[_zone].registerCallback(action);
903 } 975 }
904 this._addListener(new _FutureListener.whenComplete(result, action)); 976 this[_addListener](new _FutureListener.whenComplete(result, action));
905 return dart.as(result, Future$(T)); 977 return dart.as(result, Future$(T));
906 } 978 }
907 asStream() { 979 asStream() {
908 return dart.as(new Stream.fromFuture(this), Stream$(T)); 980 return dart.as(new Stream.fromFuture(this), Stream$(T));
909 } 981 }
910 _markPendingCompletion() { 982 [_markPendingCompletion]() {
911 if (!dart.notNull(this._mayComplete)) 983 if (!dart.notNull(this[_mayComplete]))
912 throw new core.StateError("Future already completed"); 984 throw new core.StateError("Future already completed");
913 this._state = _PENDING_COMPLETE; 985 this[_state] = _PENDING_COMPLETE;
914 } 986 }
915 get _value() { 987 get [_value]() {
916 dart.assert(dart.notNull(this._isComplete) && dart.notNull(this._hasValu e)); 988 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasVal ue]));
917 return dart.as(this._resultOrListeners, T); 989 return dart.as(this[_resultOrListeners], T);
918 } 990 }
919 get _error() { 991 get [_error]() {
920 dart.assert(dart.notNull(this._isComplete) && dart.notNull(this._hasErro r)); 992 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasErr or]));
921 return dart.as(this._resultOrListeners, AsyncError); 993 return dart.as(this[_resultOrListeners], AsyncError);
922 } 994 }
923 _setValue(value) { 995 [_setValue](value) {
924 dart.assert(!dart.notNull(this._isComplete)); 996 dart.assert(!dart.notNull(this[_isComplete]));
925 this._state = _VALUE; 997 this[_state] = _VALUE;
926 this._resultOrListeners = value; 998 this[_resultOrListeners] = value;
927 } 999 }
928 _setErrorObject(error) { 1000 [_setErrorObject](error) {
929 dart.assert(!dart.notNull(this._isComplete)); 1001 dart.assert(!dart.notNull(this[_isComplete]));
930 this._state = _ERROR; 1002 this[_state] = _ERROR;
931 this._resultOrListeners = error; 1003 this[_resultOrListeners] = error;
932 } 1004 }
933 _setError(error, stackTrace) { 1005 [_setError](error, stackTrace) {
934 this._setErrorObject(new AsyncError(error, stackTrace)); 1006 this[_setErrorObject](new AsyncError(error, stackTrace));
935 } 1007 }
936 _addListener(listener) { 1008 [_addListener](listener) {
937 dart.assert(listener._nextListener === null); 1009 dart.assert(listener[_nextListener] === null);
938 if (this._isComplete) { 1010 if (this[_isComplete]) {
939 this._zone.scheduleMicrotask((() => { 1011 this[_zone].scheduleMicrotask((() => {
940 _propagateToListeners(this, listener); 1012 _propagateToListeners(this, listener);
941 }).bind(this)); 1013 }).bind(this));
942 } else { 1014 } else {
943 listener._nextListener = dart.as(this._resultOrListeners, _FutureListe ner); 1015 listener[_nextListener] = dart.as(this[_resultOrListeners], _FutureLis tener);
944 this._resultOrListeners = listener; 1016 this[_resultOrListeners] = listener;
945 } 1017 }
946 } 1018 }
947 _removeListeners() { 1019 [_removeListeners]() {
948 dart.assert(!dart.notNull(this._isComplete)); 1020 dart.assert(!dart.notNull(this[_isComplete]));
949 let current = dart.as(this._resultOrListeners, _FutureListener); 1021 let current = dart.as(this[_resultOrListeners], _FutureListener);
950 this._resultOrListeners = null; 1022 this[_resultOrListeners] = null;
951 let prev = null; 1023 let prev = null;
952 while (current !== null) { 1024 while (current !== null) {
953 let next = current._nextListener; 1025 let next = current[_nextListener];
954 current._nextListener = prev; 1026 current[_nextListener] = prev;
955 prev = current; 1027 prev = current;
956 current = next; 1028 current = next;
957 } 1029 }
958 return prev; 1030 return prev;
959 } 1031 }
960 static _chainForeignFuture(source, target) { 1032 static [_chainForeignFuture](source, target) {
961 dart.assert(!dart.notNull(target._isComplete)); 1033 dart.assert(!dart.notNull(target[_isComplete]));
962 dart.assert(!dart.is(source, _Future)); 1034 dart.assert(!dart.is(source, _Future));
963 target._isChained = true; 1035 target[_isChained] = true;
964 source.then(((value) => { 1036 source.then(((value) => {
965 dart.assert(target._isChained); 1037 dart.assert(target[_isChained]);
966 target._completeWithValue(value); 1038 target._completeWithValue(value);
967 }).bind(this), {onError: ((error, stackTrace) => { 1039 }).bind(this), {onError: ((error, stackTrace) => {
968 if (stackTrace === void 0) 1040 if (stackTrace === void 0)
969 stackTrace = null; 1041 stackTrace = null;
970 dart.assert(target._isChained); 1042 dart.assert(target[_isChained]);
971 target._completeError(error, dart.as(stackTrace, core.StackTrace)); 1043 target._completeError(error, dart.as(stackTrace, core.StackTrace));
972 }).bind(this)}); 1044 }).bind(this)});
973 } 1045 }
974 static _chainCoreFuture(source, target) { 1046 static [_chainCoreFuture](source, target) {
975 dart.assert(!dart.notNull(target._isComplete)); 1047 dart.assert(!dart.notNull(target[_isComplete]));
976 dart.assert(dart.is(source, _Future)); 1048 dart.assert(dart.is(source, _Future));
977 target._isChained = true; 1049 target[_isChained] = true;
978 let listener = new _FutureListener.chain(target); 1050 let listener = new _FutureListener.chain(target);
979 if (source._isComplete) { 1051 if (source[_isComplete]) {
980 _propagateToListeners(source, listener); 1052 _propagateToListeners(source, listener);
981 } else { 1053 } else {
982 source._addListener(listener); 1054 source._addListener(listener);
983 } 1055 }
984 } 1056 }
985 _complete(value) { 1057 [_complete](value) {
986 dart.assert(!dart.notNull(this._isComplete)); 1058 dart.assert(!dart.notNull(this[_isComplete]));
987 if (dart.is(value, Future)) { 1059 if (dart.is(value, Future)) {
988 if (dart.is(value, _Future)) { 1060 if (dart.is(value, _Future)) {
989 _chainCoreFuture(dart.as(value, _Future), this); 1061 _chainCoreFuture(dart.as(value, _Future), this);
990 } else { 1062 } else {
991 _chainForeignFuture(dart.as(value, Future), this); 1063 _chainForeignFuture(dart.as(value, Future), this);
992 } 1064 }
993 } else { 1065 } else {
994 let listeners = this._removeListeners(); 1066 let listeners = this[_removeListeners]();
995 this._setValue(dart.as(value, T)); 1067 this[_setValue](dart.as(value, T));
996 _propagateToListeners(this, listeners); 1068 _propagateToListeners(this, listeners);
997 } 1069 }
998 } 1070 }
999 _completeWithValue(value) { 1071 [_completeWithValue](value) {
1000 dart.assert(!dart.notNull(this._isComplete)); 1072 dart.assert(!dart.notNull(this[_isComplete]));
1001 dart.assert(!dart.is(value, Future)); 1073 dart.assert(!dart.is(value, Future));
1002 let listeners = this._removeListeners(); 1074 let listeners = this[_removeListeners]();
1003 this._setValue(dart.as(value, T)); 1075 this[_setValue](dart.as(value, T));
1004 _propagateToListeners(this, listeners); 1076 _propagateToListeners(this, listeners);
1005 } 1077 }
1006 _completeError(error, stackTrace) { 1078 [_completeError](error, stackTrace) {
1007 if (stackTrace === void 0) 1079 if (stackTrace === void 0)
1008 stackTrace = null; 1080 stackTrace = null;
1009 dart.assert(!dart.notNull(this._isComplete)); 1081 dart.assert(!dart.notNull(this[_isComplete]));
1010 let listeners = this._removeListeners(); 1082 let listeners = this[_removeListeners]();
1011 this._setError(error, stackTrace); 1083 this[_setError](error, stackTrace);
1012 _propagateToListeners(this, listeners); 1084 _propagateToListeners(this, listeners);
1013 } 1085 }
1014 _asyncComplete(value) { 1086 [_asyncComplete](value) {
1015 dart.assert(!dart.notNull(this._isComplete)); 1087 dart.assert(!dart.notNull(this[_isComplete]));
1016 if (value === null) { 1088 if (value === null) {
1017 } else if (dart.is(value, Future)) { 1089 } else if (dart.is(value, Future)) {
1018 let typedFuture = dart.as(value, Future$(T)); 1090 let typedFuture = dart.as(value, Future$(T));
1019 if (dart.is(typedFuture, _Future)) { 1091 if (dart.is(typedFuture, _Future)) {
1020 let coreFuture = dart.as(typedFuture, _Future$(T)); 1092 let coreFuture = dart.as(typedFuture, _Future$(T));
1021 if (dart.notNull(coreFuture._isComplete) && dart.notNull(coreFuture. _hasError)) { 1093 if (dart.notNull(coreFuture[_isComplete]) && dart.notNull(coreFuture [_hasError])) {
1022 this._markPendingCompletion(); 1094 this[_markPendingCompletion]();
1023 this._zone.scheduleMicrotask((() => { 1095 this[_zone].scheduleMicrotask((() => {
1024 _chainCoreFuture(coreFuture, this); 1096 _chainCoreFuture(coreFuture, this);
1025 }).bind(this)); 1097 }).bind(this));
1026 } else { 1098 } else {
1027 _chainCoreFuture(coreFuture, this); 1099 _chainCoreFuture(coreFuture, this);
1028 } 1100 }
1029 } else { 1101 } else {
1030 _chainForeignFuture(typedFuture, this); 1102 _chainForeignFuture(typedFuture, this);
1031 } 1103 }
1032 return; 1104 return;
1033 } else { 1105 } else {
1034 let typedValue = dart.as(value, T); 1106 let typedValue = dart.as(value, T);
1035 } 1107 }
1036 this._markPendingCompletion(); 1108 this[_markPendingCompletion]();
1037 this._zone.scheduleMicrotask((() => { 1109 this[_zone].scheduleMicrotask((() => {
1038 this._completeWithValue(value); 1110 this[_completeWithValue](value);
1039 }).bind(this)); 1111 }).bind(this));
1040 } 1112 }
1041 _asyncCompleteError(error, stackTrace) { 1113 [_asyncCompleteError](error, stackTrace) {
1042 dart.assert(!dart.notNull(this._isComplete)); 1114 dart.assert(!dart.notNull(this[_isComplete]));
1043 this._markPendingCompletion(); 1115 this[_markPendingCompletion]();
1044 this._zone.scheduleMicrotask((() => { 1116 this[_zone].scheduleMicrotask((() => {
1045 this._completeError(error, stackTrace); 1117 this[_completeError](error, stackTrace);
1046 }).bind(this)); 1118 }).bind(this));
1047 } 1119 }
1048 static _propagateToListeners(source, listeners) { 1120 static [_propagateToListeners](source, listeners) {
1049 while (true) { 1121 while (true) {
1050 dart.assert(source._isComplete); 1122 dart.assert(source[_isComplete]);
1051 let hasError = source._hasError; 1123 let hasError = source[_hasError];
1052 if (listeners === null) { 1124 if (listeners === null) {
1053 if (hasError) { 1125 if (hasError) {
1054 let asyncError = source._error; 1126 let asyncError = source[_error];
1055 source._zone.handleUncaughtError(asyncError.error, asyncError.stac kTrace); 1127 source[_zone].handleUncaughtError(asyncError.error, asyncError.sta ckTrace);
1056 } 1128 }
1057 return; 1129 return;
1058 } 1130 }
1059 while (listeners._nextListener !== null) { 1131 while (listeners[_nextListener] !== null) {
1060 let listener = listeners; 1132 let listener = listeners;
1061 listeners = listener._nextListener; 1133 listeners = listener[_nextListener];
1062 listener._nextListener = null; 1134 listener[_nextListener] = null;
1063 _propagateToListeners(source, listener); 1135 _propagateToListeners(source, listener);
1064 } 1136 }
1065 let listener = listeners; 1137 let listener = listeners;
1066 let listenerHasValue = true; 1138 let listenerHasValue = true;
1067 let sourceValue = hasError ? null : source._value; 1139 let sourceValue = hasError ? null : source[_value];
1068 let listenerValueOrError = sourceValue; 1140 let listenerValueOrError = sourceValue;
1069 let isPropagationAborted = false; 1141 let isPropagationAborted = false;
1070 if (dart.notNull(hasError) || dart.notNull(dart.notNull(listener.handl esValue) || dart.notNull(listener.handlesComplete))) { 1142 if (dart.notNull(hasError) || dart.notNull(dart.notNull(listener.handl esValue) || dart.notNull(listener.handlesComplete))) {
1071 let zone = listener._zone; 1143 let zone = listener[_zone];
1072 if (dart.notNull(hasError) && dart.notNull(!dart.notNull(source._zon e.inSameErrorZone(zone)))) { 1144 if (dart.notNull(hasError) && dart.notNull(!dart.notNull(source[_zon e].inSameErrorZone(zone)))) {
1073 let asyncError = source._error; 1145 let asyncError = source[_error];
1074 source._zone.handleUncaughtError(asyncError.error, asyncError.stac kTrace); 1146 source[_zone].handleUncaughtError(asyncError.error, asyncError.sta ckTrace);
1075 return; 1147 return;
1076 } 1148 }
1077 let oldZone = null; 1149 let oldZone = null;
1078 if (!dart.notNull(core.identical(Zone.current, zone))) { 1150 if (!dart.notNull(core.identical(Zone.current, zone))) {
1079 oldZone = Zone._enter(zone); 1151 oldZone = Zone._enter(zone);
1080 } 1152 }
1081 // Function handleValueCallback: () → bool 1153 // Function handleValueCallback: () → bool
1082 function handleValueCallback() { 1154 function handleValueCallback() {
1083 try { 1155 try {
1084 listenerValueOrError = zone.runUnary(listener._onValue, sourceVa lue); 1156 listenerValueOrError = zone.runUnary(listener[_onValue], sourceV alue);
1085 return true; 1157 return true;
1086 } catch (e) { 1158 } catch (e) {
1087 let s = dart.stackTrace(e); 1159 let s = dart.stackTrace(e);
1088 listenerValueOrError = new AsyncError(e, s); 1160 listenerValueOrError = new AsyncError(e, s);
1089 return false; 1161 return false;
1090 } 1162 }
1091 1163
1092 } 1164 }
1093 // Function handleError: () → void 1165 // Function handleError: () → void
1094 function handleError() { 1166 function handleError() {
1095 let asyncError = source._error; 1167 let asyncError = source[_error];
1096 let matchesTest = true; 1168 let matchesTest = true;
1097 if (listener.hasErrorTest) { 1169 if (listener.hasErrorTest) {
1098 let test = listener._errorTest; 1170 let test = listener[_errorTest];
1099 try { 1171 try {
1100 matchesTest = dart.as(zone.runUnary(test, asyncError.error), c ore.bool); 1172 matchesTest = dart.as(zone.runUnary(test, asyncError.error), c ore.bool);
1101 } catch (e) { 1173 } catch (e) {
1102 let s = dart.stackTrace(e); 1174 let s = dart.stackTrace(e);
1103 listenerValueOrError = core.identical(asyncError.error, e) ? a syncError : new AsyncError(e, s); 1175 listenerValueOrError = core.identical(asyncError.error, e) ? a syncError : new AsyncError(e, s);
1104 listenerHasValue = false; 1176 listenerHasValue = false;
1105 return; 1177 return;
1106 } 1178 }
1107 1179
1108 } 1180 }
1109 let errorCallback = listener._onError; 1181 let errorCallback = listener[_onError];
1110 if (dart.notNull(matchesTest) && dart.notNull(errorCallback !== nu ll)) { 1182 if (dart.notNull(matchesTest) && dart.notNull(errorCallback !== nu ll)) {
1111 try { 1183 try {
1112 if (dart.is(errorCallback, ZoneBinaryCallback)) { 1184 if (dart.is(errorCallback, ZoneBinaryCallback)) {
1113 listenerValueOrError = zone.runBinary(errorCallback, asyncEr ror.error, asyncError.stackTrace); 1185 listenerValueOrError = zone.runBinary(errorCallback, asyncEr ror.error, asyncError.stackTrace);
1114 } else { 1186 } else {
1115 listenerValueOrError = zone.runUnary(dart.as(errorCallback, dart.throw_("Unimplemented type (dynamic) → dynamic")), asyncError.error); 1187 listenerValueOrError = zone.runUnary(dart.as(errorCallback, dart.throw_("Unimplemented type (dynamic) → dynamic")), asyncError.error);
1116 } 1188 }
1117 } catch (e) { 1189 } catch (e) {
1118 let s = dart.stackTrace(e); 1190 let s = dart.stackTrace(e);
1119 listenerValueOrError = core.identical(asyncError.error, e) ? a syncError : new AsyncError(e, s); 1191 listenerValueOrError = core.identical(asyncError.error, e) ? a syncError : new AsyncError(e, s);
1120 listenerHasValue = false; 1192 listenerHasValue = false;
1121 return; 1193 return;
1122 } 1194 }
1123 1195
1124 listenerHasValue = true; 1196 listenerHasValue = true;
1125 } else { 1197 } else {
1126 listenerValueOrError = asyncError; 1198 listenerValueOrError = asyncError;
1127 listenerHasValue = false; 1199 listenerHasValue = false;
1128 } 1200 }
1129 } 1201 }
1130 // Function handleWhenCompleteCallback: () → void 1202 // Function handleWhenCompleteCallback: () → void
1131 function handleWhenCompleteCallback() { 1203 function handleWhenCompleteCallback() {
1132 let completeResult = null; 1204 let completeResult = null;
1133 try { 1205 try {
1134 completeResult = zone.run(listener._whenCompleteAction); 1206 completeResult = zone.run(listener[_whenCompleteAction]);
1135 } catch (e) { 1207 } catch (e) {
1136 let s = dart.stackTrace(e); 1208 let s = dart.stackTrace(e);
1137 if (dart.notNull(hasError) && dart.notNull(core.identical(source ._error.error, e))) { 1209 if (dart.notNull(hasError) && dart.notNull(core.identical(source [_error].error, e))) {
1138 listenerValueOrError = source._error; 1210 listenerValueOrError = source[_error];
1139 } else { 1211 } else {
1140 listenerValueOrError = new AsyncError(e, s); 1212 listenerValueOrError = new AsyncError(e, s);
1141 } 1213 }
1142 listenerHasValue = false; 1214 listenerHasValue = false;
1143 return; 1215 return;
1144 } 1216 }
1145 1217
1146 if (dart.is(completeResult, Future)) { 1218 if (dart.is(completeResult, Future)) {
1147 let result = listener.result; 1219 let result = listener.result;
1148 result._isChained = true; 1220 result[_isChained] = true;
1149 isPropagationAborted = true; 1221 isPropagationAborted = true;
1150 dart.dinvoke(completeResult, 'then', (ignored) => { 1222 dart.dinvoke(completeResult, 'then', (ignored) => {
1151 _propagateToListeners(source, new _FutureListener.chain(result )); 1223 _propagateToListeners(source, new _FutureListener.chain(result ));
1152 }, { 1224 }, {
1153 onError: (error, stackTrace) => { 1225 onError: (error, stackTrace) => {
1154 if (stackTrace === void 0) 1226 if (stackTrace === void 0)
1155 stackTrace = null; 1227 stackTrace = null;
1156 if (!dart.is(completeResult, _Future)) { 1228 if (!dart.is(completeResult, _Future)) {
1157 completeResult = new _Future(); 1229 completeResult = new _Future();
1158 dart.dinvoke(completeResult, '_setError', error, stackTrac e); 1230 dart.dinvoke(completeResult, '_setError', error, stackTrac e);
(...skipping 14 matching lines...) Expand all
1173 handleWhenCompleteCallback(); 1245 handleWhenCompleteCallback();
1174 } 1246 }
1175 if (oldZone !== null) 1247 if (oldZone !== null)
1176 Zone._leave(oldZone); 1248 Zone._leave(oldZone);
1177 if (isPropagationAborted) 1249 if (isPropagationAborted)
1178 return; 1250 return;
1179 if (dart.notNull(dart.notNull(listenerHasValue) && dart.notNull(!dar t.notNull(core.identical(sourceValue, listenerValueOrError)))) && dart.notNull(d art.is(listenerValueOrError, Future))) { 1251 if (dart.notNull(dart.notNull(listenerHasValue) && dart.notNull(!dar t.notNull(core.identical(sourceValue, listenerValueOrError)))) && dart.notNull(d art.is(listenerValueOrError, Future))) {
1180 let chainSource = dart.as(listenerValueOrError, Future); 1252 let chainSource = dart.as(listenerValueOrError, Future);
1181 let result = listener.result; 1253 let result = listener.result;
1182 if (dart.is(chainSource, _Future)) { 1254 if (dart.is(chainSource, _Future)) {
1183 if (chainSource._isComplete) { 1255 if (chainSource[_isComplete]) {
1184 result._isChained = true; 1256 result[_isChained] = true;
1185 source = chainSource; 1257 source = chainSource;
1186 listeners = new _FutureListener.chain(result); 1258 listeners = new _FutureListener.chain(result);
1187 continue; 1259 continue;
1188 } else { 1260 } else {
1189 _chainCoreFuture(chainSource, result); 1261 _chainCoreFuture(chainSource, result);
1190 } 1262 }
1191 } else { 1263 } else {
1192 _chainForeignFuture(chainSource, result); 1264 _chainForeignFuture(chainSource, result);
1193 } 1265 }
1194 return; 1266 return;
1195 } 1267 }
1196 } 1268 }
1197 let result = listener.result; 1269 let result = listener.result;
1198 listeners = result._removeListeners(); 1270 listeners = result._removeListeners();
1199 if (listenerHasValue) { 1271 if (listenerHasValue) {
1200 result._setValue(listenerValueOrError); 1272 result._setValue(listenerValueOrError);
1201 } else { 1273 } else {
1202 let asyncError = dart.as(listenerValueOrError, AsyncError); 1274 let asyncError = dart.as(listenerValueOrError, AsyncError);
1203 result._setErrorObject(asyncError); 1275 result._setErrorObject(asyncError);
1204 } 1276 }
1205 source = result; 1277 source = result;
1206 } 1278 }
1207 } 1279 }
1208 timeout(timeLimit, opt$) { 1280 timeout(timeLimit, opt$) {
1209 let onTimeout = opt$.onTimeout === void 0 ? null : opt$.onTimeout; 1281 let onTimeout = opt$.onTimeout === void 0 ? null : opt$.onTimeout;
1210 if (this._isComplete) 1282 if (this[_isComplete])
1211 return new _Future.immediate(this); 1283 return new _Future.immediate(this);
1212 let result = new _Future(); 1284 let result = new _Future();
1213 let timer = null; 1285 let timer = null;
1214 if (onTimeout === null) { 1286 if (onTimeout === null) {
1215 timer = new Timer(timeLimit, (() => { 1287 timer = new Timer(timeLimit, (() => {
1216 result._completeError(new TimeoutException("Future not completed", t imeLimit)); 1288 result._completeError(new TimeoutException("Future not completed", t imeLimit));
1217 }).bind(this)); 1289 }).bind(this));
1218 } else { 1290 } else {
1219 let zone = Zone.current; 1291 let zone = Zone.current;
1220 onTimeout = zone.registerCallback(onTimeout); 1292 onTimeout = zone.registerCallback(onTimeout);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1389 }
1318 } 1390 }
1319 // Function scheduleMicrotask: (() → void) → void 1391 // Function scheduleMicrotask: (() → void) → void
1320 function scheduleMicrotask(callback) { 1392 function scheduleMicrotask(callback) {
1321 if (core.identical(_ROOT_ZONE, Zone.current)) { 1393 if (core.identical(_ROOT_ZONE, Zone.current)) {
1322 _rootScheduleMicrotask(null, null, dart.as(_ROOT_ZONE, Zone), callback); 1394 _rootScheduleMicrotask(null, null, dart.as(_ROOT_ZONE, Zone), callback);
1323 return; 1395 return;
1324 } 1396 }
1325 Zone.current.scheduleMicrotask(Zone.current.bindCallback(callback, {runGuard ed: true})); 1397 Zone.current.scheduleMicrotask(Zone.current.bindCallback(callback, {runGuard ed: true}));
1326 } 1398 }
1399 let _scheduleImmediate = Symbol('_scheduleImmediate');
1400 let _initializeScheduleImmediate = Symbol('_initializeScheduleImmediate');
1401 let _scheduleImmediateJsOverride = Symbol('_scheduleImmediateJsOverride');
1402 let _scheduleImmediateWithSetImmediate = Symbol('_scheduleImmediateWithSetImme diate');
1403 let _scheduleImmediateWithTimer = Symbol('_scheduleImmediateWithTimer');
1327 class _AsyncRun extends dart.Object { 1404 class _AsyncRun extends dart.Object {
1328 static _scheduleImmediate(callback) { 1405 static [_scheduleImmediate](callback) {
1329 dart.dinvokef(scheduleImmediateClosure, callback); 1406 dart.dinvokef(scheduleImmediateClosure, callback);
1330 } 1407 }
1331 static _initializeScheduleImmediate() { 1408 static [_initializeScheduleImmediate]() {
1332 _js_helper.requiresPreamble(); 1409 _js_helper.requiresPreamble();
1333 if (self.scheduleImmediate !== null) { 1410 if (self.scheduleImmediate !== null) {
1334 return _scheduleImmediateJsOverride; 1411 return _scheduleImmediateJsOverride;
1335 } 1412 }
1336 if (dart.notNull(self.MutationObserver !== null) && dart.notNull(self.docu ment !== null)) { 1413 if (dart.notNull(self.MutationObserver !== null) && dart.notNull(self.docu ment !== null)) {
1337 let div = self.document.createElement("div"); 1414 let div = self.document.createElement("div");
1338 let span = self.document.createElement("span"); 1415 let span = self.document.createElement("span");
1339 let storedCallback = null; 1416 let storedCallback = null;
1340 // Function internalCallback: (dynamic) → dynamic 1417 // Function internalCallback: (dynamic) → dynamic
1341 function internalCallback(_) { 1418 function internalCallback(_) {
1342 _isolate_helper.leaveJsAsync(); 1419 _isolate_helper.leaveJsAsync();
1343 let f = storedCallback; 1420 let f = storedCallback;
1344 storedCallback = null; 1421 storedCallback = null;
1345 dart.dinvokef(f); 1422 dart.dinvokef(f);
1346 } 1423 }
1347 ; 1424 ;
1348 let observer = new self.MutationObserver(_js_helper.convertDartClosureTo JS(internalCallback, 1)); 1425 let observer = new self.MutationObserver(_js_helper.convertDartClosureTo JS(internalCallback, 1));
1349 observer.observe(div, {childList: true}); 1426 observer.observe(div, {childList: true});
1350 return (callback) => { 1427 return (callback) => {
1351 dart.assert(storedCallback === null); 1428 dart.assert(storedCallback === null);
1352 _isolate_helper.enterJsAsync(); 1429 _isolate_helper.enterJsAsync();
1353 storedCallback = callback; 1430 storedCallback = callback;
1354 div.firstChild ? div.removeChild(span) : div.appendChild(span); 1431 div.firstChild ? div.removeChild(span) : div.appendChild(span);
1355 }; 1432 };
1356 } else if (self.setImmediate !== null) { 1433 } else if (self.setImmediate !== null) {
1357 return _scheduleImmediateWithSetImmediate; 1434 return _scheduleImmediateWithSetImmediate;
1358 } 1435 }
1359 return _scheduleImmediateWithTimer; 1436 return _scheduleImmediateWithTimer;
1360 } 1437 }
1361 static _scheduleImmediateJsOverride(callback) { 1438 static [_scheduleImmediateJsOverride](callback) {
1362 // Function internalCallback: () → dynamic 1439 // Function internalCallback: () → dynamic
1363 function internalCallback() { 1440 function internalCallback() {
1364 _isolate_helper.leaveJsAsync(); 1441 _isolate_helper.leaveJsAsync();
1365 callback(); 1442 callback();
1366 } 1443 }
1367 ; 1444 ;
1368 _isolate_helper.enterJsAsync(); 1445 _isolate_helper.enterJsAsync();
1369 self.scheduleImmediate(_js_helper.convertDartClosureToJS(internalCallback, 0)); 1446 self.scheduleImmediate(_js_helper.convertDartClosureToJS(internalCallback, 0));
1370 } 1447 }
1371 static _scheduleImmediateWithSetImmediate(callback) { 1448 static [_scheduleImmediateWithSetImmediate](callback) {
1372 // Function internalCallback: () → dynamic 1449 // Function internalCallback: () → dynamic
1373 function internalCallback() { 1450 function internalCallback() {
1374 _isolate_helper.leaveJsAsync(); 1451 _isolate_helper.leaveJsAsync();
1375 callback(); 1452 callback();
1376 } 1453 }
1377 ; 1454 ;
1378 _isolate_helper.enterJsAsync(); 1455 _isolate_helper.enterJsAsync();
1379 self.setImmediate(_js_helper.convertDartClosureToJS(internalCallback, 0)); 1456 self.setImmediate(_js_helper.convertDartClosureToJS(internalCallback, 0));
1380 } 1457 }
1381 static _scheduleImmediateWithTimer(callback) { 1458 static [_scheduleImmediateWithTimer](callback) {
1382 Timer._createTimer(core.Duration.ZERO, callback); 1459 Timer._createTimer(core.Duration.ZERO, callback);
1383 } 1460 }
1384 } 1461 }
1385 dart.defineLazyProperties(_AsyncRun, { 1462 dart.defineLazyProperties(_AsyncRun, {
1386 get scheduleImmediateClosure() { 1463 get scheduleImmediateClosure() {
1387 return _initializeScheduleImmediate(); 1464 return _initializeScheduleImmediate();
1388 } 1465 }
1389 }); 1466 });
1467 let _sink = Symbol('_sink');
1390 let Stream$ = dart.generic(function(T) { 1468 let Stream$ = dart.generic(function(T) {
1391 class Stream extends dart.Object { 1469 class Stream extends dart.Object {
1392 Stream() { 1470 Stream() {
1393 } 1471 }
1394 Stream$fromFuture(future) { 1472 Stream$fromFuture(future) {
1395 let controller = dart.as(new StreamController({sync: true}), _StreamCont roller$(T)); 1473 let controller = dart.as(new StreamController({sync: true}), _StreamCont roller$(T));
1396 future.then(((value) => { 1474 future.then(((value) => {
1397 controller._add(dart.as(value, T)); 1475 controller._add(dart.as(value, T));
1398 controller._closeUnchecked(); 1476 controller._closeUnchecked();
1399 }).bind(this), {onError: ((error, stackTrace) => { 1477 }).bind(this), {onError: ((error, stackTrace) => {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 return new _MapStream(this, convert); 1546 return new _MapStream(this, convert);
1469 } 1547 }
1470 asyncMap(convert) { 1548 asyncMap(convert) {
1471 let controller = null; 1549 let controller = null;
1472 let subscription = null; 1550 let subscription = null;
1473 // Function onListen: () → void 1551 // Function onListen: () → void
1474 function onListen() { 1552 function onListen() {
1475 let add = controller.add; 1553 let add = controller.add;
1476 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController))); 1554 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController)));
1477 let eventSink = controller; 1555 let eventSink = controller;
1478 let addError = eventSink._addError; 1556 let addError = eventSink[_addError];
1479 subscription = this.listen(((event) => { 1557 subscription = this.listen(((event) => {
1480 let newValue = null; 1558 let newValue = null;
1481 try { 1559 try {
1482 newValue = convert(event); 1560 newValue = convert(event);
1483 } catch (e) { 1561 } catch (e) {
1484 let s = dart.stackTrace(e); 1562 let s = dart.stackTrace(e);
1485 controller.addError(e, s); 1563 controller.addError(e, s);
1486 return; 1564 return;
1487 } 1565 }
1488 1566
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 } catch (e) { 1601 } catch (e) {
1524 let s = dart.stackTrace(e); 1602 let s = dart.stackTrace(e);
1525 controller.addError(e, s); 1603 controller.addError(e, s);
1526 return; 1604 return;
1527 } 1605 }
1528 1606
1529 if (newStream !== null) { 1607 if (newStream !== null) {
1530 subscription.pause(); 1608 subscription.pause();
1531 controller.addStream(newStream).whenComplete(subscription.resume); 1609 controller.addStream(newStream).whenComplete(subscription.resume);
1532 } 1610 }
1533 }).bind(this), {onError: dart.as(eventSink._addError, core.Function), onDone: controller.close}); 1611 }).bind(this), {onError: dart.as(eventSink[_addError], core.Function), onDone: controller.close});
1534 } 1612 }
1535 if (this.isBroadcast) { 1613 if (this.isBroadcast) {
1536 controller = new StreamController.broadcast({onListen: onListen, onCan cel: (() => { 1614 controller = new StreamController.broadcast({onListen: onListen, onCan cel: (() => {
1537 subscription.cancel(); 1615 subscription.cancel();
1538 }).bind(this), sync: true}); 1616 }).bind(this), sync: true});
1539 } else { 1617 } else {
1540 controller = new StreamController({onListen: onListen, onPause: (() => { 1618 controller = new StreamController({onListen: onListen, onPause: (() => {
1541 subscription.pause(); 1619 subscription.pause();
1542 }).bind(this), onResume: (() => { 1620 }).bind(this), onResume: (() => {
1543 subscription.resume(); 1621 subscription.resume();
(...skipping 23 matching lines...) Expand all
1567 let subscription = null; 1645 let subscription = null;
1568 subscription = this.listen((element) => { 1646 subscription = this.listen((element) => {
1569 if (seenFirst) { 1647 if (seenFirst) {
1570 _runUserCode(() => combine(value, element), dart.as((newValue) => { 1648 _runUserCode(() => combine(value, element), dart.as((newValue) => {
1571 value = newValue; 1649 value = newValue;
1572 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ cancelAndErrorClosure(subscription, result), dart.throw_("Unimplemented type (dy namic, StackTrace) → dynamic"))); 1650 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ cancelAndErrorClosure(subscription, result), dart.throw_("Unimplemented type (dy namic, StackTrace) → dynamic")));
1573 } else { 1651 } else {
1574 value = element; 1652 value = element;
1575 seenFirst = true; 1653 seenFirst = true;
1576 } 1654 }
1577 }, {onError: result._completeError, onDone: (() => { 1655 }, {onError: result[_completeError], onDone: (() => {
1578 if (!dart.notNull(seenFirst)) { 1656 if (!dart.notNull(seenFirst)) {
1579 try { 1657 try {
1580 throw _internal.IterableElementError.noElement(); 1658 throw _internal.IterableElementError.noElement();
1581 } catch (e) { 1659 } catch (e) {
1582 let s = dart.stackTrace(e); 1660 let s = dart.stackTrace(e);
1583 _completeWithErrorCallback(result, e, s); 1661 _completeWithErrorCallback(result, e, s);
1584 } 1662 }
1585 1663
1586 } else { 1664 } else {
1587 result._complete(value); 1665 result._complete(value);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 } 1710 }
1633 contains(needle) { 1711 contains(needle) {
1634 let future = new _Future(); 1712 let future = new _Future();
1635 let subscription = null; 1713 let subscription = null;
1636 subscription = this.listen((element) => { 1714 subscription = this.listen((element) => {
1637 _runUserCode(() => dart.equals(element, needle), dart.as((isMatch) => { 1715 _runUserCode(() => dart.equals(element, needle), dart.as((isMatch) => {
1638 if (isMatch) { 1716 if (isMatch) {
1639 _cancelAndValue(subscription, future, true); 1717 _cancelAndValue(subscription, future, true);
1640 } 1718 }
1641 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic"))); 1719 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic")));
1642 }, {onError: future._completeError, onDone: (() => { 1720 }, {onError: future[_completeError], onDone: (() => {
1643 future._complete(false); 1721 future._complete(false);
1644 }).bind(this), cancelOnError: true}); 1722 }).bind(this), cancelOnError: true});
1645 return future; 1723 return future;
1646 } 1724 }
1647 forEach(action) { 1725 forEach(action) {
1648 let future = new _Future(); 1726 let future = new _Future();
1649 let subscription = null; 1727 let subscription = null;
1650 subscription = this.listen((element) => { 1728 subscription = this.listen((element) => {
1651 _runUserCode(() => action(element), (_) => { 1729 _runUserCode(() => action(element), (_) => {
1652 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 1730 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
1653 }, {onError: future._completeError, onDone: (() => { 1731 }, {onError: future[_completeError], onDone: (() => {
1654 future._complete(null); 1732 future._complete(null);
1655 }).bind(this), cancelOnError: true}); 1733 }).bind(this), cancelOnError: true});
1656 return future; 1734 return future;
1657 } 1735 }
1658 every(test) { 1736 every(test) {
1659 let future = new _Future(); 1737 let future = new _Future();
1660 let subscription = null; 1738 let subscription = null;
1661 subscription = this.listen((element) => { 1739 subscription = this.listen((element) => {
1662 _runUserCode(() => test(element), dart.as((isMatch) => { 1740 _runUserCode(() => test(element), dart.as((isMatch) => {
1663 if (!dart.notNull(isMatch)) { 1741 if (!dart.notNull(isMatch)) {
1664 _cancelAndValue(subscription, future, false); 1742 _cancelAndValue(subscription, future, false);
1665 } 1743 }
1666 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic"))); 1744 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic")));
1667 }, {onError: future._completeError, onDone: (() => { 1745 }, {onError: future[_completeError], onDone: (() => {
1668 future._complete(true); 1746 future._complete(true);
1669 }).bind(this), cancelOnError: true}); 1747 }).bind(this), cancelOnError: true});
1670 return future; 1748 return future;
1671 } 1749 }
1672 any(test) { 1750 any(test) {
1673 let future = new _Future(); 1751 let future = new _Future();
1674 let subscription = null; 1752 let subscription = null;
1675 subscription = this.listen((element) => { 1753 subscription = this.listen((element) => {
1676 _runUserCode(() => test(element), dart.as((isMatch) => { 1754 _runUserCode(() => test(element), dart.as((isMatch) => {
1677 if (isMatch) { 1755 if (isMatch) {
1678 _cancelAndValue(subscription, future, true); 1756 _cancelAndValue(subscription, future, true);
1679 } 1757 }
1680 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic"))); 1758 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic")));
1681 }, {onError: future._completeError, onDone: (() => { 1759 }, {onError: future[_completeError], onDone: (() => {
1682 future._complete(false); 1760 future._complete(false);
1683 }).bind(this), cancelOnError: true}); 1761 }).bind(this), cancelOnError: true});
1684 return future; 1762 return future;
1685 } 1763 }
1686 get length() { 1764 get length() {
1687 let future = new _Future(); 1765 let future = new _Future();
1688 let count = 0; 1766 let count = 0;
1689 this.listen((_) => { 1767 this.listen((_) => {
1690 count++; 1768 count++;
1691 }, {onError: future._completeError, onDone: (() => { 1769 }, {onError: future[_completeError], onDone: (() => {
1692 future._complete(count); 1770 future._complete(count);
1693 }).bind(this), cancelOnError: true}); 1771 }).bind(this), cancelOnError: true});
1694 return future; 1772 return future;
1695 } 1773 }
1696 get isEmpty() { 1774 get isEmpty() {
1697 let future = new _Future(); 1775 let future = new _Future();
1698 let subscription = null; 1776 let subscription = null;
1699 subscription = this.listen((_) => { 1777 subscription = this.listen((_) => {
1700 _cancelAndValue(subscription, future, false); 1778 _cancelAndValue(subscription, future, false);
1701 }, {onError: future._completeError, onDone: (() => { 1779 }, {onError: future[_completeError], onDone: (() => {
1702 future._complete(true); 1780 future._complete(true);
1703 }).bind(this), cancelOnError: true}); 1781 }).bind(this), cancelOnError: true});
1704 return future; 1782 return future;
1705 } 1783 }
1706 toList() { 1784 toList() {
1707 let result = new List.from([]); 1785 let result = new List.from([]);
1708 let future = new _Future(); 1786 let future = new _Future();
1709 this.listen(((data) => { 1787 this.listen(((data) => {
1710 result.add(data); 1788 result.add(data);
1711 }).bind(this), {onError: future._completeError, onDone: (() => { 1789 }).bind(this), {onError: future[_completeError], onDone: (() => {
1712 future._complete(result); 1790 future._complete(result);
1713 }).bind(this), cancelOnError: true}); 1791 }).bind(this), cancelOnError: true});
1714 return future; 1792 return future;
1715 } 1793 }
1716 toSet() { 1794 toSet() {
1717 let result = new core.Set(); 1795 let result = new core.Set();
1718 let future = new _Future(); 1796 let future = new _Future();
1719 this.listen(((data) => { 1797 this.listen(((data) => {
1720 result.add(data); 1798 result.add(data);
1721 }).bind(this), {onError: future._completeError, onDone: (() => { 1799 }).bind(this), {onError: future[_completeError], onDone: (() => {
1722 future._complete(result); 1800 future._complete(result);
1723 }).bind(this), cancelOnError: true}); 1801 }).bind(this), cancelOnError: true});
1724 return future; 1802 return future;
1725 } 1803 }
1726 drain(futureValue) { 1804 drain(futureValue) {
1727 if (futureValue === void 0) 1805 if (futureValue === void 0)
1728 futureValue = null; 1806 futureValue = null;
1729 return this.listen(null, {cancelOnError: true}).asFuture(futureValue); 1807 return this.listen(null, {cancelOnError: true}).asFuture(futureValue);
1730 } 1808 }
1731 take(count) { 1809 take(count) {
(...skipping 12 matching lines...) Expand all
1744 if (equals === void 0) 1822 if (equals === void 0)
1745 equals = null; 1823 equals = null;
1746 return dart.as(new _DistinctStream(this, dart.as(equals, dart.throw_("Un implemented type (dynamic, dynamic) → bool"))), Stream$(T)); 1824 return dart.as(new _DistinctStream(this, dart.as(equals, dart.throw_("Un implemented type (dynamic, dynamic) → bool"))), Stream$(T));
1747 } 1825 }
1748 get first() { 1826 get first() {
1749 let future = new _Future(); 1827 let future = new _Future();
1750 let subscription = null; 1828 let subscription = null;
1751 subscription = this.listen((value) => { 1829 subscription = this.listen((value) => {
1752 _cancelAndValue(subscription, future, value); 1830 _cancelAndValue(subscription, future, value);
1753 }, { 1831 }, {
1754 onError: future._completeError, 1832 onError: future[_completeError],
1755 onDone: () => { 1833 onDone: () => {
1756 try { 1834 try {
1757 throw _internal.IterableElementError.noElement(); 1835 throw _internal.IterableElementError.noElement();
1758 } catch (e) { 1836 } catch (e) {
1759 let s = dart.stackTrace(e); 1837 let s = dart.stackTrace(e);
1760 _completeWithErrorCallback(future, e, s); 1838 _completeWithErrorCallback(future, e, s);
1761 } 1839 }
1762 1840
1763 }, 1841 },
1764 cancelOnError: true 1842 cancelOnError: true
1765 }); 1843 });
1766 return future; 1844 return future;
1767 } 1845 }
1768 get last() { 1846 get last() {
1769 let future = new _Future(); 1847 let future = new _Future();
1770 let result = dart.as(null, T); 1848 let result = dart.as(null, T);
1771 let foundResult = false; 1849 let foundResult = false;
1772 let subscription = null; 1850 let subscription = null;
1773 subscription = this.listen((value) => { 1851 subscription = this.listen((value) => {
1774 foundResult = true; 1852 foundResult = true;
1775 result = value; 1853 result = value;
1776 }, {onError: future._completeError, onDone: (() => { 1854 }, {onError: future[_completeError], onDone: (() => {
1777 if (foundResult) { 1855 if (foundResult) {
1778 future._complete(result); 1856 future._complete(result);
1779 return; 1857 return;
1780 } 1858 }
1781 try { 1859 try {
1782 throw _internal.IterableElementError.noElement(); 1860 throw _internal.IterableElementError.noElement();
1783 } catch (e) { 1861 } catch (e) {
1784 let s = dart.stackTrace(e); 1862 let s = dart.stackTrace(e);
1785 _completeWithErrorCallback(future, e, s); 1863 _completeWithErrorCallback(future, e, s);
1786 } 1864 }
(...skipping 12 matching lines...) Expand all
1799 throw _internal.IterableElementError.tooMany(); 1877 throw _internal.IterableElementError.tooMany();
1800 } catch (e) { 1878 } catch (e) {
1801 let s = dart.stackTrace(e); 1879 let s = dart.stackTrace(e);
1802 _cancelAndErrorWithReplacement(subscription, future, e, s); 1880 _cancelAndErrorWithReplacement(subscription, future, e, s);
1803 } 1881 }
1804 1882
1805 return; 1883 return;
1806 } 1884 }
1807 foundResult = true; 1885 foundResult = true;
1808 result = value; 1886 result = value;
1809 }, {onError: future._completeError, onDone: (() => { 1887 }, {onError: future[_completeError], onDone: (() => {
1810 if (foundResult) { 1888 if (foundResult) {
1811 future._complete(result); 1889 future._complete(result);
1812 return; 1890 return;
1813 } 1891 }
1814 try { 1892 try {
1815 throw _internal.IterableElementError.noElement(); 1893 throw _internal.IterableElementError.noElement();
1816 } catch (e) { 1894 } catch (e) {
1817 let s = dart.stackTrace(e); 1895 let s = dart.stackTrace(e);
1818 _completeWithErrorCallback(future, e, s); 1896 _completeWithErrorCallback(future, e, s);
1819 } 1897 }
1820 1898
1821 }).bind(this), cancelOnError: true}); 1899 }).bind(this), cancelOnError: true});
1822 return future; 1900 return future;
1823 } 1901 }
1824 firstWhere(test, opt$) { 1902 firstWhere(test, opt$) {
1825 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultVal ue; 1903 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultVal ue;
1826 let future = new _Future(); 1904 let future = new _Future();
1827 let subscription = null; 1905 let subscription = null;
1828 subscription = this.listen((value) => { 1906 subscription = this.listen((value) => {
1829 _runUserCode(() => test(value), dart.as((isMatch) => { 1907 _runUserCode(() => test(value), dart.as((isMatch) => {
1830 if (isMatch) { 1908 if (isMatch) {
1831 _cancelAndValue(subscription, future, value); 1909 _cancelAndValue(subscription, future, value);
1832 } 1910 }
1833 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic"))); 1911 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic")));
1834 }, {onError: future._completeError, onDone: (() => { 1912 }, {onError: future[_completeError], onDone: (() => {
1835 if (defaultValue !== null) { 1913 if (defaultValue !== null) {
1836 _runUserCode(defaultValue, future._complete, future._completeError ); 1914 _runUserCode(defaultValue, future[_complete], future[_completeErro r]);
1837 return; 1915 return;
1838 } 1916 }
1839 try { 1917 try {
1840 throw _internal.IterableElementError.noElement(); 1918 throw _internal.IterableElementError.noElement();
1841 } catch (e) { 1919 } catch (e) {
1842 let s = dart.stackTrace(e); 1920 let s = dart.stackTrace(e);
1843 _completeWithErrorCallback(future, e, s); 1921 _completeWithErrorCallback(future, e, s);
1844 } 1922 }
1845 1923
1846 }).bind(this), cancelOnError: true}); 1924 }).bind(this), cancelOnError: true});
1847 return future; 1925 return future;
1848 } 1926 }
1849 lastWhere(test, opt$) { 1927 lastWhere(test, opt$) {
1850 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultVal ue; 1928 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultVal ue;
1851 let future = new _Future(); 1929 let future = new _Future();
1852 let result = dart.as(null, T); 1930 let result = dart.as(null, T);
1853 let foundResult = false; 1931 let foundResult = false;
1854 let subscription = null; 1932 let subscription = null;
1855 subscription = this.listen((value) => { 1933 subscription = this.listen((value) => {
1856 _runUserCode(() => true === test(value), dart.as((isMatch) => { 1934 _runUserCode(() => true === test(value), dart.as((isMatch) => {
1857 if (isMatch) { 1935 if (isMatch) {
1858 foundResult = true; 1936 foundResult = true;
1859 result = value; 1937 result = value;
1860 } 1938 }
1861 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic"))); 1939 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic")));
1862 }, {onError: future._completeError, onDone: (() => { 1940 }, {onError: future[_completeError], onDone: (() => {
1863 if (foundResult) { 1941 if (foundResult) {
1864 future._complete(result); 1942 future._complete(result);
1865 return; 1943 return;
1866 } 1944 }
1867 if (defaultValue !== null) { 1945 if (defaultValue !== null) {
1868 _runUserCode(defaultValue, future._complete, future._completeError ); 1946 _runUserCode(defaultValue, future[_complete], future[_completeErro r]);
1869 return; 1947 return;
1870 } 1948 }
1871 try { 1949 try {
1872 throw _internal.IterableElementError.noElement(); 1950 throw _internal.IterableElementError.noElement();
1873 } catch (e) { 1951 } catch (e) {
1874 let s = dart.stackTrace(e); 1952 let s = dart.stackTrace(e);
1875 _completeWithErrorCallback(future, e, s); 1953 _completeWithErrorCallback(future, e, s);
1876 } 1954 }
1877 1955
1878 }).bind(this), cancelOnError: true}); 1956 }).bind(this), cancelOnError: true});
(...skipping 14 matching lines...) Expand all
1893 let s = dart.stackTrace(e); 1971 let s = dart.stackTrace(e);
1894 _cancelAndErrorWithReplacement(subscription, future, e, s); 1972 _cancelAndErrorWithReplacement(subscription, future, e, s);
1895 } 1973 }
1896 1974
1897 return; 1975 return;
1898 } 1976 }
1899 foundResult = true; 1977 foundResult = true;
1900 result = value; 1978 result = value;
1901 } 1979 }
1902 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic"))); 1980 }, dart.throw_("Unimplemented type (dynamic) → dynamic")), dart.as(_ca ncelAndErrorClosure(subscription, future), dart.throw_("Unimplemented type (dyna mic, StackTrace) → dynamic")));
1903 }, {onError: future._completeError, onDone: (() => { 1981 }, {onError: future[_completeError], onDone: (() => {
1904 if (foundResult) { 1982 if (foundResult) {
1905 future._complete(result); 1983 future._complete(result);
1906 return; 1984 return;
1907 } 1985 }
1908 try { 1986 try {
1909 throw _internal.IterableElementError.noElement(); 1987 throw _internal.IterableElementError.noElement();
1910 } catch (e) { 1988 } catch (e) {
1911 let s = dart.stackTrace(e); 1989 let s = dart.stackTrace(e);
1912 _completeWithErrorCallback(future, e, s); 1990 _completeWithErrorCallback(future, e, s);
1913 } 1991 }
1914 1992
1915 }).bind(this), cancelOnError: true}); 1993 }).bind(this), cancelOnError: true});
1916 return future; 1994 return future;
1917 } 1995 }
1918 elementAt(index) { 1996 elementAt(index) {
1919 if (dart.notNull(!(typeof index == number)) || dart.notNull(index < 0)) 1997 if (dart.notNull(!(typeof index == number)) || dart.notNull(index < 0))
1920 throw new core.ArgumentError(index); 1998 throw new core.ArgumentError(index);
1921 let future = new _Future(); 1999 let future = new _Future();
1922 let subscription = null; 2000 let subscription = null;
1923 let elementIndex = 0; 2001 let elementIndex = 0;
1924 subscription = this.listen((value) => { 2002 subscription = this.listen((value) => {
1925 if (index === elementIndex) { 2003 if (index === elementIndex) {
1926 _cancelAndValue(subscription, future, value); 2004 _cancelAndValue(subscription, future, value);
1927 return; 2005 return;
1928 } 2006 }
1929 elementIndex = 1; 2007 elementIndex = 1;
1930 }, {onError: future._completeError, onDone: (() => { 2008 }, {onError: future[_completeError], onDone: (() => {
1931 future._completeError(new core.RangeError.index(index, this, "index" , null, elementIndex)); 2009 future._completeError(new core.RangeError.index(index, this, "index" , null, elementIndex));
1932 }).bind(this), cancelOnError: true}); 2010 }).bind(this), cancelOnError: true});
1933 return future; 2011 return future;
1934 } 2012 }
1935 timeout(timeLimit, opt$) { 2013 timeout(timeLimit, opt$) {
1936 let onTimeout = opt$.onTimeout === void 0 ? null : opt$.onTimeout; 2014 let onTimeout = opt$.onTimeout === void 0 ? null : opt$.onTimeout;
1937 let controller = null; 2015 let controller = null;
1938 let subscription = null; 2016 let subscription = null;
1939 let timer = null; 2017 let timer = null;
1940 let zone = null; 2018 let zone = null;
(...skipping 21 matching lines...) Expand all
1962 function onListen() { 2040 function onListen() {
1963 zone = Zone.current; 2041 zone = Zone.current;
1964 if (onTimeout === null) { 2042 if (onTimeout === null) {
1965 timeout = (() => { 2043 timeout = (() => {
1966 controller.addError(new TimeoutException("No stream event", timeLi mit), null); 2044 controller.addError(new TimeoutException("No stream event", timeLi mit), null);
1967 }).bind(this); 2045 }).bind(this);
1968 } else { 2046 } else {
1969 onTimeout = zone.registerUnaryCallback(dart.as(onTimeout, dart.throw _("Unimplemented type (dynamic) → dynamic"))); 2047 onTimeout = zone.registerUnaryCallback(dart.as(onTimeout, dart.throw _("Unimplemented type (dynamic) → dynamic")));
1970 let wrapper = new _ControllerEventSinkWrapper(null); 2048 let wrapper = new _ControllerEventSinkWrapper(null);
1971 timeout = (() => { 2049 timeout = (() => {
1972 wrapper._sink = controller; 2050 wrapper[_sink] = controller;
1973 zone.runUnaryGuarded(dart.as(onTimeout, dart.throw_("Unimplemented type (dynamic) → dynamic")), wrapper); 2051 zone.runUnaryGuarded(dart.as(onTimeout, dart.throw_("Unimplemented type (dynamic) → dynamic")), wrapper);
1974 wrapper._sink = null; 2052 wrapper[_sink] = null;
1975 }).bind(this); 2053 }).bind(this);
1976 } 2054 }
1977 subscription = this.listen(onData, {onError: onError, onDone: onDone}) ; 2055 subscription = this.listen(onData, {onError: onError, onDone: onDone}) ;
1978 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.throw_("Unim plemented type () → void"))); 2056 timer = zone.createTimer(timeLimit, dart.as(timeout, dart.throw_("Unim plemented type () → void")));
1979 } 2057 }
1980 // Function onCancel: () → Future<dynamic> 2058 // Function onCancel: () → Future<dynamic>
1981 function onCancel() { 2059 function onCancel() {
1982 timer.cancel(); 2060 timer.cancel();
1983 let result = subscription.cancel(); 2061 let result = subscription.cancel();
1984 subscription = null; 2062 subscription = null;
(...skipping 21 matching lines...) Expand all
2006 } 2084 }
2007 return StreamSubscription; 2085 return StreamSubscription;
2008 }); 2086 });
2009 let StreamSubscription = StreamSubscription$(dynamic); 2087 let StreamSubscription = StreamSubscription$(dynamic);
2010 let EventSink$ = dart.generic(function(T) { 2088 let EventSink$ = dart.generic(function(T) {
2011 class EventSink extends dart.Object { 2089 class EventSink extends dart.Object {
2012 } 2090 }
2013 return EventSink; 2091 return EventSink;
2014 }); 2092 });
2015 let EventSink = EventSink$(dynamic); 2093 let EventSink = EventSink$(dynamic);
2094 let _stream = Symbol('_stream');
2016 let StreamView$ = dart.generic(function(T) { 2095 let StreamView$ = dart.generic(function(T) {
2017 class StreamView extends Stream$(T) { 2096 class StreamView extends Stream$(T) {
2018 StreamView(_stream) { 2097 StreamView($_stream) {
2019 this._stream = _stream; 2098 this[_stream] = $_stream;
2020 super.Stream(); 2099 super.Stream();
2021 } 2100 }
2022 get isBroadcast() { 2101 get isBroadcast() {
2023 return this._stream.isBroadcast; 2102 return this[_stream].isBroadcast;
2024 } 2103 }
2025 asBroadcastStream(opt$) { 2104 asBroadcastStream(opt$) {
2026 let onListen = opt$.onListen === void 0 ? null : opt$.onListen; 2105 let onListen = opt$.onListen === void 0 ? null : opt$.onListen;
2027 let onCancel = opt$.onCancel === void 0 ? null : opt$.onCancel; 2106 let onCancel = opt$.onCancel === void 0 ? null : opt$.onCancel;
2028 return this._stream.asBroadcastStream({onListen: onListen, onCancel: onC ancel}); 2107 return this[_stream].asBroadcastStream({onListen: onListen, onCancel: on Cancel});
2029 } 2108 }
2030 listen(onData, opt$) { 2109 listen(onData, opt$) {
2031 let onError = opt$.onError === void 0 ? null : opt$.onError; 2110 let onError = opt$.onError === void 0 ? null : opt$.onError;
2032 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; 2111 let onDone = opt$.onDone === void 0 ? null : opt$.onDone;
2033 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error; 2112 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error;
2034 return this._stream.listen(onData, {onError: onError, onDone: onDone, ca ncelOnError: cancelOnError}); 2113 return this[_stream].listen(onData, {onError: onError, onDone: onDone, c ancelOnError: cancelOnError});
2035 } 2114 }
2036 } 2115 }
2037 return StreamView; 2116 return StreamView;
2038 }); 2117 });
2039 let StreamView = StreamView$(dynamic); 2118 let StreamView = StreamView$(dynamic);
2040 let StreamConsumer$ = dart.generic(function(S) { 2119 let StreamConsumer$ = dart.generic(function(S) {
2041 class StreamConsumer extends dart.Object { 2120 class StreamConsumer extends dart.Object {
2042 } 2121 }
2043 return StreamConsumer; 2122 return StreamConsumer;
2044 }); 2123 });
(...skipping 21 matching lines...) Expand all
2066 class StreamIterator extends dart.Object { 2145 class StreamIterator extends dart.Object {
2067 StreamIterator(stream) { 2146 StreamIterator(stream) {
2068 return new _StreamIteratorImpl(stream); 2147 return new _StreamIteratorImpl(stream);
2069 } 2148 }
2070 } 2149 }
2071 return StreamIterator; 2150 return StreamIterator;
2072 }); 2151 });
2073 let StreamIterator = StreamIterator$(dynamic); 2152 let StreamIterator = StreamIterator$(dynamic);
2074 let _ControllerEventSinkWrapper$ = dart.generic(function(T) { 2153 let _ControllerEventSinkWrapper$ = dart.generic(function(T) {
2075 class _ControllerEventSinkWrapper extends dart.Object { 2154 class _ControllerEventSinkWrapper extends dart.Object {
2076 _ControllerEventSinkWrapper(_sink) { 2155 _ControllerEventSinkWrapper($_sink) {
2077 this._sink = _sink; 2156 this[_sink] = $_sink;
2078 } 2157 }
2079 add(data) { 2158 add(data) {
2080 this._sink.add(data); 2159 this[_sink].add(data);
2081 } 2160 }
2082 addError(error, stackTrace) { 2161 addError(error, stackTrace) {
2083 if (stackTrace === void 0) 2162 if (stackTrace === void 0)
2084 stackTrace = null; 2163 stackTrace = null;
2085 this._sink.addError(error, stackTrace); 2164 this[_sink].addError(error, stackTrace);
2086 } 2165 }
2087 close() { 2166 close() {
2088 this._sink.close(); 2167 this[_sink].close();
2089 } 2168 }
2090 } 2169 }
2091 return _ControllerEventSinkWrapper; 2170 return _ControllerEventSinkWrapper;
2092 }); 2171 });
2093 let _ControllerEventSinkWrapper = _ControllerEventSinkWrapper$(dynamic); 2172 let _ControllerEventSinkWrapper = _ControllerEventSinkWrapper$(dynamic);
2094 let StreamController$ = dart.generic(function(T) { 2173 let StreamController$ = dart.generic(function(T) {
2095 class StreamController extends dart.Object { 2174 class StreamController extends dart.Object {
2096 StreamController(opt$) { 2175 StreamController(opt$) {
2097 let onListen = opt$.onListen === void 0 ? null : opt$.onListen; 2176 let onListen = opt$.onListen === void 0 ? null : opt$.onListen;
2098 let onPause = opt$.onPause === void 0 ? null : opt$.onPause; 2177 let onPause = opt$.onPause === void 0 ? null : opt$.onPause;
(...skipping 11 matching lines...) Expand all
2110 let sync = opt$.sync === void 0 ? false : opt$.sync; 2189 let sync = opt$.sync === void 0 ? false : opt$.sync;
2111 return sync ? new _SyncBroadcastStreamController(onListen, onCancel) : n ew _AsyncBroadcastStreamController(onListen, onCancel); 2190 return sync ? new _SyncBroadcastStreamController(onListen, onCancel) : n ew _AsyncBroadcastStreamController(onListen, onCancel);
2112 } 2191 }
2113 } 2192 }
2114 dart.defineNamedConstructor(StreamController, 'broadcast'); 2193 dart.defineNamedConstructor(StreamController, 'broadcast');
2115 return StreamController; 2194 return StreamController;
2116 }); 2195 });
2117 let StreamController = StreamController$(dynamic); 2196 let StreamController = StreamController$(dynamic);
2118 let _StreamControllerLifecycle$ = dart.generic(function(T) { 2197 let _StreamControllerLifecycle$ = dart.generic(function(T) {
2119 class _StreamControllerLifecycle extends dart.Object { 2198 class _StreamControllerLifecycle extends dart.Object {
2120 _recordPause(subscription) {} 2199 [_recordPause](subscription) {}
2121 _recordResume(subscription) {} 2200 [_recordResume](subscription) {}
2122 _recordCancel(subscription) { 2201 [_recordCancel](subscription) {
2123 return null; 2202 return null;
2124 } 2203 }
2125 } 2204 }
2126 return _StreamControllerLifecycle; 2205 return _StreamControllerLifecycle;
2127 }); 2206 });
2128 let _StreamControllerLifecycle = _StreamControllerLifecycle$(dynamic); 2207 let _StreamControllerLifecycle = _StreamControllerLifecycle$(dynamic);
2208 let _varData = Symbol('_varData');
2209 let _isCanceled = Symbol('_isCanceled');
2210 let _isInitialState = Symbol('_isInitialState');
2211 let _subscription = Symbol('_subscription');
2212 let _isInputPaused = Symbol('_isInputPaused');
2213 let _pendingEvents = Symbol('_pendingEvents');
2214 let _ensurePendingEvents = Symbol('_ensurePendingEvents');
2215 let _badEventState = Symbol('_badEventState');
2216 let _nullFuture = Symbol('_nullFuture');
2217 let _closeUnchecked = Symbol('_closeUnchecked');
2129 let _StreamController$ = dart.generic(function(T) { 2218 let _StreamController$ = dart.generic(function(T) {
2130 class _StreamController extends dart.Object { 2219 class _StreamController extends dart.Object {
2131 _StreamController() { 2220 _StreamController() {
2132 this._varData = null; 2221 this[_varData] = null;
2133 this._state = _STATE_INITIAL; 2222 this[_state] = _STATE_INITIAL;
2134 this._doneFuture = null; 2223 this[_doneFuture] = null;
2135 } 2224 }
2136 get stream() { 2225 get stream() {
2137 return dart.as(new _ControllerStream(this), Stream$(T)); 2226 return dart.as(new _ControllerStream(this), Stream$(T));
2138 } 2227 }
2139 get sink() { 2228 get sink() {
2140 return new _StreamSinkWrapper(this); 2229 return new _StreamSinkWrapper(this);
2141 } 2230 }
2142 get _isCanceled() { 2231 get [_isCanceled]() {
2143 return (this._state & _STATE_CANCELED) !== 0; 2232 return (this[_state] & _STATE_CANCELED) !== 0;
2144 } 2233 }
2145 get hasListener() { 2234 get hasListener() {
2146 return (this._state & _STATE_SUBSCRIBED) !== 0; 2235 return (this[_state] & _STATE_SUBSCRIBED) !== 0;
2147 } 2236 }
2148 get _isInitialState() { 2237 get [_isInitialState]() {
2149 return (this._state & _STATE_SUBSCRIPTION_MASK) === _STATE_INITIAL; 2238 return (this[_state] & _STATE_SUBSCRIPTION_MASK) === _STATE_INITIAL;
2150 } 2239 }
2151 get isClosed() { 2240 get isClosed() {
2152 return (this._state & _STATE_CLOSED) !== 0; 2241 return (this[_state] & _STATE_CLOSED) !== 0;
2153 } 2242 }
2154 get isPaused() { 2243 get isPaused() {
2155 return this.hasListener ? this._subscription._isInputPaused : !dart.notN ull(this._isCanceled); 2244 return this.hasListener ? this[_subscription][_isInputPaused] : !dart.no tNull(this[_isCanceled]);
2156 } 2245 }
2157 get _isAddingStream() { 2246 get [_isAddingStream]() {
2158 return (this._state & _STATE_ADDSTREAM) !== 0; 2247 return (this[_state] & _STATE_ADDSTREAM) !== 0;
2159 } 2248 }
2160 get _mayAddEvent() { 2249 get [_mayAddEvent]() {
2161 return this._state < _STATE_CLOSED; 2250 return this[_state] < _STATE_CLOSED;
2162 } 2251 }
2163 get _pendingEvents() { 2252 get [_pendingEvents]() {
2164 dart.assert(this._isInitialState); 2253 dart.assert(this[_isInitialState]);
2165 if (!dart.notNull(this._isAddingStream)) { 2254 if (!dart.notNull(this[_isAddingStream])) {
2166 return dart.as(this._varData, _PendingEvents); 2255 return dart.as(this[_varData], _PendingEvents);
2167 } 2256 }
2168 let state = dart.as(this._varData, _StreamControllerAddStreamState); 2257 let state = dart.as(this[_varData], _StreamControllerAddStreamState);
2169 return dart.as(state.varData, _PendingEvents); 2258 return dart.as(state.varData, _PendingEvents);
2170 } 2259 }
2171 _ensurePendingEvents() { 2260 [_ensurePendingEvents]() {
2172 dart.assert(this._isInitialState); 2261 dart.assert(this[_isInitialState]);
2173 if (!dart.notNull(this._isAddingStream)) { 2262 if (!dart.notNull(this[_isAddingStream])) {
2174 if (this._varData === null) 2263 if (this[_varData] === null)
2175 this._varData = new _StreamImplEvents(); 2264 this[_varData] = new _StreamImplEvents();
2176 return dart.as(this._varData, _StreamImplEvents); 2265 return dart.as(this[_varData], _StreamImplEvents);
2177 } 2266 }
2178 let state = dart.as(this._varData, _StreamControllerAddStreamState); 2267 let state = dart.as(this[_varData], _StreamControllerAddStreamState);
2179 if (state.varData === null) 2268 if (state.varData === null)
2180 state.varData = new _StreamImplEvents(); 2269 state.varData = new _StreamImplEvents();
2181 return dart.as(state.varData, _StreamImplEvents); 2270 return dart.as(state.varData, _StreamImplEvents);
2182 } 2271 }
2183 get _subscription() { 2272 get [_subscription]() {
2184 dart.assert(this.hasListener); 2273 dart.assert(this.hasListener);
2185 if (this._isAddingStream) { 2274 if (this[_isAddingStream]) {
2186 let addState = dart.as(this._varData, _StreamControllerAddStreamState) ; 2275 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2187 return dart.as(addState.varData, _ControllerSubscription); 2276 return dart.as(addState.varData, _ControllerSubscription);
2188 } 2277 }
2189 return dart.as(this._varData, _ControllerSubscription); 2278 return dart.as(this[_varData], _ControllerSubscription);
2190 } 2279 }
2191 _badEventState() { 2280 [_badEventState]() {
2192 if (this.isClosed) { 2281 if (this.isClosed) {
2193 return new core.StateError("Cannot add event after closing"); 2282 return new core.StateError("Cannot add event after closing");
2194 } 2283 }
2195 dart.assert(this._isAddingStream); 2284 dart.assert(this[_isAddingStream]);
2196 return new core.StateError("Cannot add event while adding a stream"); 2285 return new core.StateError("Cannot add event while adding a stream");
2197 } 2286 }
2198 addStream(source, opt$) { 2287 addStream(source, opt$) {
2199 let cancelOnError = opt$.cancelOnError === void 0 ? true : opt$.cancelOn Error; 2288 let cancelOnError = opt$.cancelOnError === void 0 ? true : opt$.cancelOn Error;
2200 if (!dart.notNull(this._mayAddEvent)) 2289 if (!dart.notNull(this[_mayAddEvent]))
2201 throw this._badEventState(); 2290 throw this[_badEventState]();
2202 if (this._isCanceled) 2291 if (this[_isCanceled])
2203 return new _Future.immediate(null); 2292 return new _Future.immediate(null);
2204 let addState = new _StreamControllerAddStreamState(this, this._varData, source, cancelOnError); 2293 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError);
2205 this._varData = addState; 2294 this[_varData] = addState;
2206 this._state = _STATE_ADDSTREAM; 2295 this[_state] = _STATE_ADDSTREAM;
2207 return addState.addStreamFuture; 2296 return addState.addStreamFuture;
2208 } 2297 }
2209 get done() { 2298 get done() {
2210 return this._ensureDoneFuture(); 2299 return this[_ensureDoneFuture]();
2211 } 2300 }
2212 _ensureDoneFuture() { 2301 [_ensureDoneFuture]() {
2213 if (this._doneFuture === null) { 2302 if (this[_doneFuture] === null) {
2214 this._doneFuture = this._isCanceled ? Future._nullFuture : new _Future (); 2303 this[_doneFuture] = this[_isCanceled] ? Future[_nullFuture] : new _Fut ure();
2215 } 2304 }
2216 return this._doneFuture; 2305 return this[_doneFuture];
2217 } 2306 }
2218 add(value) { 2307 add(value) {
2219 if (!dart.notNull(this._mayAddEvent)) 2308 if (!dart.notNull(this[_mayAddEvent]))
2220 throw this._badEventState(); 2309 throw this[_badEventState]();
2221 this._add(value); 2310 this[_add](value);
2222 } 2311 }
2223 addError(error, stackTrace) { 2312 addError(error, stackTrace) {
2224 if (stackTrace === void 0) 2313 if (stackTrace === void 0)
2225 stackTrace = null; 2314 stackTrace = null;
2226 error = _nonNullError(error); 2315 error = _nonNullError(error);
2227 if (!dart.notNull(this._mayAddEvent)) 2316 if (!dart.notNull(this[_mayAddEvent]))
2228 throw this._badEventState(); 2317 throw this[_badEventState]();
2229 let replacement = Zone.current.errorCallback(error, stackTrace); 2318 let replacement = Zone.current.errorCallback(error, stackTrace);
2230 if (replacement !== null) { 2319 if (replacement !== null) {
2231 error = _nonNullError(replacement.error); 2320 error = _nonNullError(replacement.error);
2232 stackTrace = replacement.stackTrace; 2321 stackTrace = replacement.stackTrace;
2233 } 2322 }
2234 this._addError(error, stackTrace); 2323 this[_addError](error, stackTrace);
2235 } 2324 }
2236 close() { 2325 close() {
2237 if (this.isClosed) { 2326 if (this.isClosed) {
2238 return this._ensureDoneFuture(); 2327 return this[_ensureDoneFuture]();
2239 } 2328 }
2240 if (!dart.notNull(this._mayAddEvent)) 2329 if (!dart.notNull(this[_mayAddEvent]))
2241 throw this._badEventState(); 2330 throw this[_badEventState]();
2242 this._closeUnchecked(); 2331 this[_closeUnchecked]();
2243 return this._ensureDoneFuture(); 2332 return this[_ensureDoneFuture]();
2244 } 2333 }
2245 _closeUnchecked() { 2334 [_closeUnchecked]() {
2246 this._state = _STATE_CLOSED; 2335 this[_state] = _STATE_CLOSED;
2247 if (this.hasListener) { 2336 if (this.hasListener) {
2248 this._sendDone(); 2337 this[_sendDone]();
2249 } else if (this._isInitialState) { 2338 } else if (this[_isInitialState]) {
2250 this._ensurePendingEvents().add(new _DelayedDone()); 2339 this[_ensurePendingEvents]().add(new _DelayedDone());
2251 } 2340 }
2252 } 2341 }
2253 _add(value) { 2342 [_add](value) {
2254 if (this.hasListener) { 2343 if (this.hasListener) {
2255 this._sendData(value); 2344 this[_sendData](value);
2256 } else if (this._isInitialState) { 2345 } else if (this[_isInitialState]) {
2257 this._ensurePendingEvents().add(new _DelayedData(value)); 2346 this[_ensurePendingEvents]().add(new _DelayedData(value));
2258 } 2347 }
2259 } 2348 }
2260 _addError(error, stackTrace) { 2349 [_addError](error, stackTrace) {
2261 if (this.hasListener) { 2350 if (this.hasListener) {
2262 this._sendError(error, stackTrace); 2351 this[_sendError](error, stackTrace);
2263 } else if (this._isInitialState) { 2352 } else if (this[_isInitialState]) {
2264 this._ensurePendingEvents().add(new _DelayedError(error, stackTrace)); 2353 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace)) ;
2265 } 2354 }
2266 } 2355 }
2267 _close() { 2356 [_close]() {
2268 dart.assert(this._isAddingStream); 2357 dart.assert(this[_isAddingStream]);
2269 let addState = dart.as(this._varData, _StreamControllerAddStreamState); 2358 let addState = dart.as(this[_varData], _StreamControllerAddStreamState);
2270 this._varData = addState.varData; 2359 this[_varData] = addState.varData;
2271 this._state = ~_STATE_ADDSTREAM; 2360 this[_state] = ~_STATE_ADDSTREAM;
2272 addState.complete(); 2361 addState.complete();
2273 } 2362 }
2274 _subscribe(onData, onError, onDone, cancelOnError) { 2363 [_subscribe](onData, onError, onDone, cancelOnError) {
2275 if (!dart.notNull(this._isInitialState)) { 2364 if (!dart.notNull(this[_isInitialState])) {
2276 throw new core.StateError("Stream has already been listened to."); 2365 throw new core.StateError("Stream has already been listened to.");
2277 } 2366 }
2278 let subscription = new _ControllerSubscription(this, dart.as(onData, dar t.throw_("Unimplemented type (dynamic) → void")), onError, onDone, cancelOnError ); 2367 let subscription = new _ControllerSubscription(this, dart.as(onData, dar t.throw_("Unimplemented type (dynamic) → void")), onError, onDone, cancelOnError );
2279 let pendingEvents = this._pendingEvents; 2368 let pendingEvents = this[_pendingEvents];
2280 this._state = _STATE_SUBSCRIBED; 2369 this[_state] = _STATE_SUBSCRIBED;
2281 if (this._isAddingStream) { 2370 if (this[_isAddingStream]) {
2282 let addState = dart.as(this._varData, _StreamControllerAddStreamState) ; 2371 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2283 addState.varData = subscription; 2372 addState.varData = subscription;
2284 addState.resume(); 2373 addState.resume();
2285 } else { 2374 } else {
2286 this._varData = subscription; 2375 this[_varData] = subscription;
2287 } 2376 }
2288 subscription._setPendingEvents(pendingEvents); 2377 subscription._setPendingEvents(pendingEvents);
2289 subscription._guardCallback((() => { 2378 subscription._guardCallback((() => {
2290 _runGuarded(this._onListen); 2379 _runGuarded(this[_onListen]);
2291 }).bind(this)); 2380 }).bind(this));
2292 return dart.as(subscription, StreamSubscription$(T)); 2381 return dart.as(subscription, StreamSubscription$(T));
2293 } 2382 }
2294 _recordCancel(subscription) { 2383 [_recordCancel](subscription) {
2295 let result = null; 2384 let result = null;
2296 if (this._isAddingStream) { 2385 if (this[_isAddingStream]) {
2297 let addState = dart.as(this._varData, _StreamControllerAddStreamState) ; 2386 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2298 result = addState.cancel(); 2387 result = addState.cancel();
2299 } 2388 }
2300 this._varData = null; 2389 this[_varData] = null;
2301 this._state = this._state & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM) | _S TATE_CANCELED; 2390 this[_state] = this[_state] & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM) | _STATE_CANCELED;
2302 if (this._onCancel !== null) { 2391 if (this[_onCancel] !== null) {
2303 if (result === null) { 2392 if (result === null) {
2304 try { 2393 try {
2305 result = dart.as(this._onCancel(), Future); 2394 result = dart.as(this[_onCancel](), Future);
2306 } catch (e) { 2395 } catch (e) {
2307 let s = dart.stackTrace(e); 2396 let s = dart.stackTrace(e);
2308 result = ((_) => { 2397 result = ((_) => {
2309 _._asyncCompleteError(e, s); 2398 _._asyncCompleteError(e, s);
2310 return _; 2399 return _;
2311 }).bind(this)(new _Future()); 2400 }).bind(this)(new _Future());
2312 } 2401 }
2313 2402
2314 } else { 2403 } else {
2315 result = result.whenComplete(this._onCancel); 2404 result = result.whenComplete(this[_onCancel]);
2316 } 2405 }
2317 } 2406 }
2318 // Function complete: () → void 2407 // Function complete: () → void
2319 function complete() { 2408 function complete() {
2320 if (dart.notNull(this._doneFuture !== null) && dart.notNull(this._done Future._mayComplete)) { 2409 if (dart.notNull(this[_doneFuture] !== null) && dart.notNull(this[_don eFuture][_mayComplete])) {
2321 this._doneFuture._asyncComplete(null); 2410 this[_doneFuture]._asyncComplete(null);
2322 } 2411 }
2323 } 2412 }
2324 if (result !== null) { 2413 if (result !== null) {
2325 result = result.whenComplete(complete); 2414 result = result.whenComplete(complete);
2326 } else { 2415 } else {
2327 complete(); 2416 complete();
2328 } 2417 }
2329 return result; 2418 return result;
2330 } 2419 }
2331 _recordPause(subscription) { 2420 [_recordPause](subscription) {
2332 if (this._isAddingStream) { 2421 if (this[_isAddingStream]) {
2333 let addState = dart.as(this._varData, _StreamControllerAddStreamState) ; 2422 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2334 addState.pause(); 2423 addState.pause();
2335 } 2424 }
2336 _runGuarded(this._onPause); 2425 _runGuarded(this[_onPause]);
2337 } 2426 }
2338 _recordResume(subscription) { 2427 [_recordResume](subscription) {
2339 if (this._isAddingStream) { 2428 if (this[_isAddingStream]) {
2340 let addState = dart.as(this._varData, _StreamControllerAddStreamState) ; 2429 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2341 addState.resume(); 2430 addState.resume();
2342 } 2431 }
2343 _runGuarded(this._onResume); 2432 _runGuarded(this[_onResume]);
2344 } 2433 }
2345 } 2434 }
2346 _StreamController._STATE_INITIAL = 0; 2435 _StreamController._STATE_INITIAL = 0;
2347 _StreamController._STATE_SUBSCRIBED = 1; 2436 _StreamController._STATE_SUBSCRIBED = 1;
2348 _StreamController._STATE_CANCELED = 2; 2437 _StreamController._STATE_CANCELED = 2;
2349 _StreamController._STATE_SUBSCRIPTION_MASK = 3; 2438 _StreamController._STATE_SUBSCRIPTION_MASK = 3;
2350 _StreamController._STATE_CLOSED = 4; 2439 _StreamController._STATE_CLOSED = 4;
2351 _StreamController._STATE_ADDSTREAM = 8; 2440 _StreamController._STATE_ADDSTREAM = 8;
2352 return _StreamController; 2441 return _StreamController;
2353 }); 2442 });
2354 let _StreamController = _StreamController$(dynamic); 2443 let _StreamController = _StreamController$(dynamic);
2355 let _SyncStreamControllerDispatch$ = dart.generic(function(T) { 2444 let _SyncStreamControllerDispatch$ = dart.generic(function(T) {
2356 class _SyncStreamControllerDispatch extends dart.Object { 2445 class _SyncStreamControllerDispatch extends dart.Object {
2357 _sendData(data) { 2446 [_sendData](data) {
2358 this._subscription._add(data); 2447 this[_subscription]._add(data);
2359 } 2448 }
2360 _sendError(error, stackTrace) { 2449 [_sendError](error, stackTrace) {
2361 this._subscription._addError(error, stackTrace); 2450 this[_subscription]._addError(error, stackTrace);
2362 } 2451 }
2363 _sendDone() { 2452 [_sendDone]() {
2364 this._subscription._close(); 2453 this[_subscription]._close();
2365 } 2454 }
2366 } 2455 }
2367 return _SyncStreamControllerDispatch; 2456 return _SyncStreamControllerDispatch;
2368 }); 2457 });
2369 let _SyncStreamControllerDispatch = _SyncStreamControllerDispatch$(dynamic); 2458 let _SyncStreamControllerDispatch = _SyncStreamControllerDispatch$(dynamic);
2370 let _AsyncStreamControllerDispatch$ = dart.generic(function(T) { 2459 let _AsyncStreamControllerDispatch$ = dart.generic(function(T) {
2371 class _AsyncStreamControllerDispatch extends dart.Object { 2460 class _AsyncStreamControllerDispatch extends dart.Object {
2372 _sendData(data) { 2461 [_sendData](data) {
2373 this._subscription._addPending(new _DelayedData(data)); 2462 this[_subscription]._addPending(new _DelayedData(data));
2374 } 2463 }
2375 _sendError(error, stackTrace) { 2464 [_sendError](error, stackTrace) {
2376 this._subscription._addPending(new _DelayedError(error, stackTrace)); 2465 this[_subscription]._addPending(new _DelayedError(error, stackTrace));
2377 } 2466 }
2378 _sendDone() { 2467 [_sendDone]() {
2379 this._subscription._addPending(new _DelayedDone()); 2468 this[_subscription]._addPending(new _DelayedDone());
2380 } 2469 }
2381 } 2470 }
2382 return _AsyncStreamControllerDispatch; 2471 return _AsyncStreamControllerDispatch;
2383 }); 2472 });
2384 let _AsyncStreamControllerDispatch = _AsyncStreamControllerDispatch$(dynamic); 2473 let _AsyncStreamControllerDispatch = _AsyncStreamControllerDispatch$(dynamic);
2385 let _AsyncStreamController$ = dart.generic(function(T) { 2474 let _AsyncStreamController$ = dart.generic(function(T) {
2386 class _AsyncStreamController extends dart.mixin(_StreamController$(T), _Asyn cStreamControllerDispatch$(T)) { 2475 class _AsyncStreamController extends dart.mixin(_StreamController$(T), _Asyn cStreamControllerDispatch$(T)) {
2387 _AsyncStreamController(_onListen, _onPause, _onResume, _onCancel) { 2476 _AsyncStreamController($_onListen, $_onPause, $_onResume, $_onCancel) {
2388 this._onListen = _onListen; 2477 this[_onListen] = $_onListen;
2389 this._onPause = _onPause; 2478 this[_onPause] = $_onPause;
2390 this._onResume = _onResume; 2479 this[_onResume] = $_onResume;
2391 this._onCancel = _onCancel; 2480 this[_onCancel] = $_onCancel;
2392 super._StreamController(); 2481 super._StreamController();
2393 } 2482 }
2394 } 2483 }
2395 return _AsyncStreamController; 2484 return _AsyncStreamController;
2396 }); 2485 });
2397 let _AsyncStreamController = _AsyncStreamController$(dynamic); 2486 let _AsyncStreamController = _AsyncStreamController$(dynamic);
2398 let _SyncStreamController$ = dart.generic(function(T) { 2487 let _SyncStreamController$ = dart.generic(function(T) {
2399 class _SyncStreamController extends dart.mixin(_StreamController$(T), _SyncS treamControllerDispatch$(T)) { 2488 class _SyncStreamController extends dart.mixin(_StreamController$(T), _SyncS treamControllerDispatch$(T)) {
2400 _SyncStreamController(_onListen, _onPause, _onResume, _onCancel) { 2489 _SyncStreamController($_onListen, $_onPause, $_onResume, $_onCancel) {
2401 this._onListen = _onListen; 2490 this[_onListen] = $_onListen;
2402 this._onPause = _onPause; 2491 this[_onPause] = $_onPause;
2403 this._onResume = _onResume; 2492 this[_onResume] = $_onResume;
2404 this._onCancel = _onCancel; 2493 this[_onCancel] = $_onCancel;
2405 super._StreamController(); 2494 super._StreamController();
2406 } 2495 }
2407 } 2496 }
2408 return _SyncStreamController; 2497 return _SyncStreamController;
2409 }); 2498 });
2410 let _SyncStreamController = _SyncStreamController$(dynamic); 2499 let _SyncStreamController = _SyncStreamController$(dynamic);
2411 class _NoCallbacks extends dart.Object { 2500 class _NoCallbacks extends dart.Object {
2412 get _onListen() { 2501 get [_onListen]() {
2413 return null; 2502 return null;
2414 } 2503 }
2415 get _onPause() { 2504 get [_onPause]() {
2416 return null; 2505 return null;
2417 } 2506 }
2418 get _onResume() { 2507 get [_onResume]() {
2419 return null; 2508 return null;
2420 } 2509 }
2421 get _onCancel() { 2510 get [_onCancel]() {
2422 return null; 2511 return null;
2423 } 2512 }
2424 } 2513 }
2425 class _NoCallbackAsyncStreamController extends dart.mixin(_AsyncStreamControll erDispatch, _NoCallbacks) { 2514 class _NoCallbackAsyncStreamController extends dart.mixin(_AsyncStreamControll erDispatch, _NoCallbacks) {
2426 } 2515 }
2427 class _NoCallbackSyncStreamController extends dart.mixin(_SyncStreamController Dispatch, _NoCallbacks) { 2516 class _NoCallbackSyncStreamController extends dart.mixin(_SyncStreamController Dispatch, _NoCallbacks) {
2428 } 2517 }
2429 // Function _runGuarded: (() → dynamic) → Future<dynamic> 2518 // Function _runGuarded: (() → dynamic) → Future<dynamic>
2430 function _runGuarded(notificationHandler) { 2519 function _runGuarded(notificationHandler) {
2431 if (notificationHandler === null) 2520 if (notificationHandler === null)
2432 return null; 2521 return null;
2433 try { 2522 try {
2434 let result = notificationHandler(); 2523 let result = notificationHandler();
2435 if (dart.is(result, Future)) 2524 if (dart.is(result, Future))
2436 return dart.as(result, Future); 2525 return dart.as(result, Future);
2437 return null; 2526 return null;
2438 } catch (e) { 2527 } catch (e) {
2439 let s = dart.stackTrace(e); 2528 let s = dart.stackTrace(e);
2440 Zone.current.handleUncaughtError(e, s); 2529 Zone.current.handleUncaughtError(e, s);
2441 } 2530 }
2442 2531
2443 } 2532 }
2533 let _createSubscription = Symbol('_createSubscription');
2444 let _ControllerStream$ = dart.generic(function(T) { 2534 let _ControllerStream$ = dart.generic(function(T) {
2445 class _ControllerStream extends _StreamImpl$(T) { 2535 class _ControllerStream extends _StreamImpl$(T) {
2446 _ControllerStream(_controller) { 2536 _ControllerStream($_controller) {
2447 this._controller = _controller; 2537 this[_controller] = $_controller;
2448 super._StreamImpl(); 2538 super._StreamImpl();
2449 } 2539 }
2450 _createSubscription(onData, onError, onDone, cancelOnError) { 2540 [_createSubscription](onData, onError, onDone, cancelOnError) {
2451 return this._controller._subscribe(onData, onError, onDone, cancelOnErro r); 2541 return this[_controller]._subscribe(onData, onError, onDone, cancelOnErr or);
2452 } 2542 }
2453 get hashCode() { 2543 get hashCode() {
2454 return this._controller.hashCode ^ 892482866; 2544 return this[_controller].hashCode ^ 892482866;
2455 } 2545 }
2456 ['=='](other) { 2546 ['=='](other) {
2457 if (core.identical(this, other)) 2547 if (core.identical(this, other))
2458 return true; 2548 return true;
2459 if (!dart.is(other, _ControllerStream)) 2549 if (!dart.is(other, _ControllerStream))
2460 return false; 2550 return false;
2461 let otherStream = dart.as(other, _ControllerStream); 2551 let otherStream = dart.as(other, _ControllerStream);
2462 return core.identical(otherStream._controller, this._controller); 2552 return core.identical(otherStream[_controller], this[_controller]);
2463 } 2553 }
2464 } 2554 }
2465 return _ControllerStream; 2555 return _ControllerStream;
2466 }); 2556 });
2467 let _ControllerStream = _ControllerStream$(dynamic); 2557 let _ControllerStream = _ControllerStream$(dynamic);
2468 let _ControllerSubscription$ = dart.generic(function(T) { 2558 let _ControllerSubscription$ = dart.generic(function(T) {
2469 class _ControllerSubscription extends _BufferingStreamSubscription$(T) { 2559 class _ControllerSubscription extends _BufferingStreamSubscription$(T) {
2470 _ControllerSubscription(_controller, onData, onError, onDone, cancelOnErro r) { 2560 _ControllerSubscription($_controller, onData, onError, onDone, cancelOnErr or) {
2471 this._controller = _controller; 2561 this[_controller] = $_controller;
2472 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 2562 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
2473 } 2563 }
2474 _onCancel() { 2564 [_onCancel]() {
2475 return this._controller._recordCancel(this); 2565 return this[_controller]._recordCancel(this);
2476 } 2566 }
2477 _onPause() { 2567 [_onPause]() {
2478 this._controller._recordPause(this); 2568 this[_controller]._recordPause(this);
2479 } 2569 }
2480 _onResume() { 2570 [_onResume]() {
2481 this._controller._recordResume(this); 2571 this[_controller]._recordResume(this);
2482 } 2572 }
2483 } 2573 }
2484 return _ControllerSubscription; 2574 return _ControllerSubscription;
2485 }); 2575 });
2486 let _ControllerSubscription = _ControllerSubscription$(dynamic); 2576 let _ControllerSubscription = _ControllerSubscription$(dynamic);
2577 let _target = Symbol('_target');
2487 let _StreamSinkWrapper$ = dart.generic(function(T) { 2578 let _StreamSinkWrapper$ = dart.generic(function(T) {
2488 class _StreamSinkWrapper extends dart.Object { 2579 class _StreamSinkWrapper extends dart.Object {
2489 _StreamSinkWrapper(_target) { 2580 _StreamSinkWrapper($_target) {
2490 this._target = _target; 2581 this[_target] = $_target;
2491 } 2582 }
2492 add(data) { 2583 add(data) {
2493 this._target.add(data); 2584 this[_target].add(data);
2494 } 2585 }
2495 addError(error, stackTrace) { 2586 addError(error, stackTrace) {
2496 if (stackTrace === void 0) 2587 if (stackTrace === void 0)
2497 stackTrace = null; 2588 stackTrace = null;
2498 this._target.addError(error, stackTrace); 2589 this[_target].addError(error, stackTrace);
2499 } 2590 }
2500 close() { 2591 close() {
2501 return this._target.close(); 2592 return this[_target].close();
2502 } 2593 }
2503 addStream(source, opt$) { 2594 addStream(source, opt$) {
2504 let cancelOnError = opt$.cancelOnError === void 0 ? true : opt$.cancelOn Error; 2595 let cancelOnError = opt$.cancelOnError === void 0 ? true : opt$.cancelOn Error;
2505 return this._target.addStream(source, {cancelOnError: cancelOnError}); 2596 return this[_target].addStream(source, {cancelOnError: cancelOnError});
2506 } 2597 }
2507 get done() { 2598 get done() {
2508 return this._target.done; 2599 return this[_target].done;
2509 } 2600 }
2510 } 2601 }
2511 return _StreamSinkWrapper; 2602 return _StreamSinkWrapper;
2512 }); 2603 });
2513 let _StreamSinkWrapper = _StreamSinkWrapper$(dynamic); 2604 let _StreamSinkWrapper = _StreamSinkWrapper$(dynamic);
2514 let _AddStreamState$ = dart.generic(function(T) { 2605 let _AddStreamState$ = dart.generic(function(T) {
2515 class _AddStreamState extends dart.Object { 2606 class _AddStreamState extends dart.Object {
2516 _AddStreamState(controller, source, cancelOnError) { 2607 _AddStreamState(controller, source, cancelOnError) {
2517 this.addStreamFuture = new _Future(); 2608 this.addStreamFuture = new _Future();
2518 this.addSubscription = source.listen(dart.as(controller._add, dart.throw _("Unimplemented type (dynamic) → void")), {onError: dart.as(cancelOnError ? mak eErrorHandler(controller) : controller._addError, core.Function), onDone: contro ller._close, cancelOnError: cancelOnError}); 2609 this.addSubscription = source.listen(dart.as(controller[_add], dart.thro w_("Unimplemented type (dynamic) → void")), {onError: dart.as(cancelOnError ? ma keErrorHandler(controller) : controller[_addError], core.Function), onDone: cont roller[_close], cancelOnError: cancelOnError});
2519 } 2610 }
2520 static makeErrorHandler(controller) { 2611 static makeErrorHandler(controller) {
2521 return ((e, s) => { 2612 return ((e, s) => {
2522 controller._addError(e, s); 2613 controller._addError(e, s);
2523 controller._close(); 2614 controller._close();
2524 }).bind(this); 2615 }).bind(this);
2525 } 2616 }
2526 pause() { 2617 pause() {
2527 this.addSubscription.pause(); 2618 this.addSubscription.pause();
2528 } 2619 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 } 2655 }
2565 return _EventSink; 2656 return _EventSink;
2566 }); 2657 });
2567 let _EventSink = _EventSink$(dynamic); 2658 let _EventSink = _EventSink$(dynamic);
2568 let _EventDispatch$ = dart.generic(function(T) { 2659 let _EventDispatch$ = dart.generic(function(T) {
2569 class _EventDispatch extends dart.Object { 2660 class _EventDispatch extends dart.Object {
2570 } 2661 }
2571 return _EventDispatch; 2662 return _EventDispatch;
2572 }); 2663 });
2573 let _EventDispatch = _EventDispatch$(dynamic); 2664 let _EventDispatch = _EventDispatch$(dynamic);
2665 let _onData = Symbol('_onData');
2666 let _onDone = Symbol('_onDone');
2667 let _cancelFuture = Symbol('_cancelFuture');
2668 let _setPendingEvents = Symbol('_setPendingEvents');
2669 let _extractPending = Symbol('_extractPending');
2670 let _isPaused = Symbol('_isPaused');
2671 let _inCallback = Symbol('_inCallback');
2672 let _guardCallback = Symbol('_guardCallback');
2673 let _decrementPauseCount = Symbol('_decrementPauseCount');
2674 let _mayResumeInput = Symbol('_mayResumeInput');
2675 let _cancel = Symbol('_cancel');
2676 let _isClosed = Symbol('_isClosed');
2677 let _waitsForCancel = Symbol('_waitsForCancel');
2678 let _canFire = Symbol('_canFire');
2679 let _cancelOnError = Symbol('_cancelOnError');
2680 let _incrementPauseCount = Symbol('_incrementPauseCount');
2681 let _addPending = Symbol('_addPending');
2682 let _checkState = Symbol('_checkState');
2574 let _BufferingStreamSubscription$ = dart.generic(function(T) { 2683 let _BufferingStreamSubscription$ = dart.generic(function(T) {
2575 class _BufferingStreamSubscription extends dart.Object { 2684 class _BufferingStreamSubscription extends dart.Object {
2576 _BufferingStreamSubscription(onData, onError, onDone, cancelOnError) { 2685 _BufferingStreamSubscription(onData, onError, onDone, cancelOnError) {
2577 this._zone = Zone.current; 2686 this[_zone] = Zone.current;
2578 this._state = cancelOnError ? _STATE_CANCEL_ON_ERROR : 0; 2687 this[_state] = cancelOnError ? _STATE_CANCEL_ON_ERROR : 0;
2579 this._onData = null; 2688 this[_onData] = null;
2580 this._onError = null; 2689 this[_onError] = null;
2581 this._onDone = null; 2690 this[_onDone] = null;
2582 this._cancelFuture = null; 2691 this[_cancelFuture] = null;
2583 this._pending = null; 2692 this[_pending] = null;
2584 this.onData(onData); 2693 this.onData(onData);
2585 this.onError(onError); 2694 this.onError(onError);
2586 this.onDone(onDone); 2695 this.onDone(onDone);
2587 } 2696 }
2588 _setPendingEvents(pendingEvents) { 2697 [_setPendingEvents](pendingEvents) {
2589 dart.assert(this._pending === null); 2698 dart.assert(this[_pending] === null);
2590 if (pendingEvents === null) 2699 if (pendingEvents === null)
2591 return; 2700 return;
2592 this._pending = pendingEvents; 2701 this[_pending] = pendingEvents;
2593 if (!dart.notNull(pendingEvents.isEmpty)) { 2702 if (!dart.notNull(pendingEvents.isEmpty)) {
2594 this._state = _STATE_HAS_PENDING; 2703 this[_state] = _STATE_HAS_PENDING;
2595 this._pending.schedule(this); 2704 this[_pending].schedule(this);
2596 } 2705 }
2597 } 2706 }
2598 _extractPending() { 2707 [_extractPending]() {
2599 dart.assert(this._isCanceled); 2708 dart.assert(this[_isCanceled]);
2600 let events = this._pending; 2709 let events = this[_pending];
2601 this._pending = null; 2710 this[_pending] = null;
2602 return events; 2711 return events;
2603 } 2712 }
2604 onData(handleData) { 2713 onData(handleData) {
2605 if (handleData === null) 2714 if (handleData === null)
2606 handleData = _nullDataHandler; 2715 handleData = _nullDataHandler;
2607 this._onData = this._zone.registerUnaryCallback(dart.as(handleData, dart .throw_("Unimplemented type (dynamic) → dynamic"))); 2716 this[_onData] = this[_zone].registerUnaryCallback(dart.as(handleData, da rt.throw_("Unimplemented type (dynamic) → dynamic")));
2608 } 2717 }
2609 onError(handleError) { 2718 onError(handleError) {
2610 if (handleError === null) 2719 if (handleError === null)
2611 handleError = _nullErrorHandler; 2720 handleError = _nullErrorHandler;
2612 this._onError = _registerErrorHandler(handleError, this._zone); 2721 this[_onError] = _registerErrorHandler(handleError, this[_zone]);
2613 } 2722 }
2614 onDone(handleDone) { 2723 onDone(handleDone) {
2615 if (handleDone === null) 2724 if (handleDone === null)
2616 handleDone = _nullDoneHandler; 2725 handleDone = _nullDoneHandler;
2617 this._onDone = this._zone.registerCallback(handleDone); 2726 this[_onDone] = this[_zone].registerCallback(handleDone);
2618 } 2727 }
2619 pause(resumeSignal) { 2728 pause(resumeSignal) {
2620 if (resumeSignal === void 0) 2729 if (resumeSignal === void 0)
2621 resumeSignal = null; 2730 resumeSignal = null;
2622 if (this._isCanceled) 2731 if (this[_isCanceled])
2623 return; 2732 return;
2624 let wasPaused = this._isPaused; 2733 let wasPaused = this[_isPaused];
2625 let wasInputPaused = this._isInputPaused; 2734 let wasInputPaused = this[_isInputPaused];
2626 this._state = this._state + _STATE_PAUSE_COUNT | _STATE_INPUT_PAUSED; 2735 this[_state] = this[_state] + _STATE_PAUSE_COUNT | _STATE_INPUT_PAUSED;
2627 if (resumeSignal !== null) 2736 if (resumeSignal !== null)
2628 resumeSignal.whenComplete(this.resume); 2737 resumeSignal.whenComplete(this.resume);
2629 if (dart.notNull(!dart.notNull(wasPaused)) && dart.notNull(this._pending !== null)) 2738 if (dart.notNull(!dart.notNull(wasPaused)) && dart.notNull(this[_pending ] !== null))
2630 this._pending.cancelSchedule(); 2739 this[_pending].cancelSchedule();
2631 if (dart.notNull(!dart.notNull(wasInputPaused)) && dart.notNull(!dart.no tNull(this._inCallback))) 2740 if (dart.notNull(!dart.notNull(wasInputPaused)) && dart.notNull(!dart.no tNull(this[_inCallback])))
2632 this._guardCallback(this._onPause); 2741 this[_guardCallback](this[_onPause]);
2633 } 2742 }
2634 resume() { 2743 resume() {
2635 if (this._isCanceled) 2744 if (this[_isCanceled])
2636 return; 2745 return;
2637 if (this._isPaused) { 2746 if (this[_isPaused]) {
2638 this._decrementPauseCount(); 2747 this[_decrementPauseCount]();
2639 if (!dart.notNull(this._isPaused)) { 2748 if (!dart.notNull(this[_isPaused])) {
2640 if (dart.notNull(this._hasPending) && dart.notNull(!dart.notNull(thi s._pending.isEmpty))) { 2749 if (dart.notNull(this[_hasPending]) && dart.notNull(!dart.notNull(th is[_pending].isEmpty))) {
2641 this._pending.schedule(this); 2750 this[_pending].schedule(this);
2642 } else { 2751 } else {
2643 dart.assert(this._mayResumeInput); 2752 dart.assert(this[_mayResumeInput]);
2644 this._state = ~_STATE_INPUT_PAUSED; 2753 this[_state] = ~_STATE_INPUT_PAUSED;
2645 if (!dart.notNull(this._inCallback)) 2754 if (!dart.notNull(this[_inCallback]))
2646 this._guardCallback(this._onResume); 2755 this[_guardCallback](this[_onResume]);
2647 } 2756 }
2648 } 2757 }
2649 } 2758 }
2650 } 2759 }
2651 cancel() { 2760 cancel() {
2652 this._state = ~_STATE_WAIT_FOR_CANCEL; 2761 this[_state] = ~_STATE_WAIT_FOR_CANCEL;
2653 if (this._isCanceled) 2762 if (this[_isCanceled])
2654 return this._cancelFuture; 2763 return this[_cancelFuture];
2655 this._cancel(); 2764 this[_cancel]();
2656 return this._cancelFuture; 2765 return this[_cancelFuture];
2657 } 2766 }
2658 asFuture(futureValue) { 2767 asFuture(futureValue) {
2659 if (futureValue === void 0) 2768 if (futureValue === void 0)
2660 futureValue = null; 2769 futureValue = null;
2661 let result = new _Future(); 2770 let result = new _Future();
2662 this._onDone = (() => { 2771 this[_onDone] = (() => {
2663 result._complete(futureValue); 2772 result._complete(futureValue);
2664 }).bind(this); 2773 }).bind(this);
2665 this._onError = ((error, stackTrace) => { 2774 this[_onError] = ((error, stackTrace) => {
2666 this.cancel(); 2775 this.cancel();
2667 result._completeError(error, dart.as(stackTrace, core.StackTrace)); 2776 result._completeError(error, dart.as(stackTrace, core.StackTrace));
2668 }).bind(this); 2777 }).bind(this);
2669 return result; 2778 return result;
2670 } 2779 }
2671 get _isInputPaused() { 2780 get [_isInputPaused]() {
2672 return (this._state & _STATE_INPUT_PAUSED) !== 0; 2781 return (this[_state] & _STATE_INPUT_PAUSED) !== 0;
2673 } 2782 }
2674 get _isClosed() { 2783 get [_isClosed]() {
2675 return (this._state & _STATE_CLOSED) !== 0; 2784 return (this[_state] & _STATE_CLOSED) !== 0;
2676 } 2785 }
2677 get _isCanceled() { 2786 get [_isCanceled]() {
2678 return (this._state & _STATE_CANCELED) !== 0; 2787 return (this[_state] & _STATE_CANCELED) !== 0;
2679 } 2788 }
2680 get _waitsForCancel() { 2789 get [_waitsForCancel]() {
2681 return (this._state & _STATE_WAIT_FOR_CANCEL) !== 0; 2790 return (this[_state] & _STATE_WAIT_FOR_CANCEL) !== 0;
2682 } 2791 }
2683 get _inCallback() { 2792 get [_inCallback]() {
2684 return (this._state & _STATE_IN_CALLBACK) !== 0; 2793 return (this[_state] & _STATE_IN_CALLBACK) !== 0;
2685 } 2794 }
2686 get _hasPending() { 2795 get [_hasPending]() {
2687 return (this._state & _STATE_HAS_PENDING) !== 0; 2796 return (this[_state] & _STATE_HAS_PENDING) !== 0;
2688 } 2797 }
2689 get _isPaused() { 2798 get [_isPaused]() {
2690 return this._state >= _STATE_PAUSE_COUNT; 2799 return this[_state] >= _STATE_PAUSE_COUNT;
2691 } 2800 }
2692 get _canFire() { 2801 get [_canFire]() {
2693 return this._state < _STATE_IN_CALLBACK; 2802 return this[_state] < _STATE_IN_CALLBACK;
2694 } 2803 }
2695 get _mayResumeInput() { 2804 get [_mayResumeInput]() {
2696 return dart.notNull(!dart.notNull(this._isPaused)) && dart.notNull(dart. notNull(this._pending === null) || dart.notNull(this._pending.isEmpty)); 2805 return dart.notNull(!dart.notNull(this[_isPaused])) && dart.notNull(dart .notNull(this[_pending] === null) || dart.notNull(this[_pending].isEmpty));
2697 } 2806 }
2698 get _cancelOnError() { 2807 get [_cancelOnError]() {
2699 return (this._state & _STATE_CANCEL_ON_ERROR) !== 0; 2808 return (this[_state] & _STATE_CANCEL_ON_ERROR) !== 0;
2700 } 2809 }
2701 get isPaused() { 2810 get isPaused() {
2702 return this._isPaused; 2811 return this[_isPaused];
2703 } 2812 }
2704 _cancel() { 2813 [_cancel]() {
2705 this._state = _STATE_CANCELED; 2814 this[_state] = _STATE_CANCELED;
2706 if (this._hasPending) { 2815 if (this[_hasPending]) {
2707 this._pending.cancelSchedule(); 2816 this[_pending].cancelSchedule();
2708 } 2817 }
2709 if (!dart.notNull(this._inCallback)) 2818 if (!dart.notNull(this[_inCallback]))
2710 this._pending = null; 2819 this[_pending] = null;
2711 this._cancelFuture = this._onCancel(); 2820 this[_cancelFuture] = this[_onCancel]();
2712 } 2821 }
2713 _incrementPauseCount() { 2822 [_incrementPauseCount]() {
2714 this._state = this._state + _STATE_PAUSE_COUNT | _STATE_INPUT_PAUSED; 2823 this[_state] = this[_state] + _STATE_PAUSE_COUNT | _STATE_INPUT_PAUSED;
2715 } 2824 }
2716 _decrementPauseCount() { 2825 [_decrementPauseCount]() {
2717 dart.assert(this._isPaused); 2826 dart.assert(this[_isPaused]);
2718 this._state = _STATE_PAUSE_COUNT; 2827 this[_state] = _STATE_PAUSE_COUNT;
2719 } 2828 }
2720 _add(data) { 2829 [_add](data) {
2721 dart.assert(!dart.notNull(this._isClosed)); 2830 dart.assert(!dart.notNull(this[_isClosed]));
2722 if (this._isCanceled) 2831 if (this[_isCanceled])
2723 return; 2832 return;
2724 if (this._canFire) { 2833 if (this[_canFire]) {
2725 this._sendData(data); 2834 this[_sendData](data);
2726 } else { 2835 } else {
2727 this._addPending(new _DelayedData(data)); 2836 this[_addPending](new _DelayedData(data));
2728 } 2837 }
2729 } 2838 }
2730 _addError(error, stackTrace) { 2839 [_addError](error, stackTrace) {
2731 if (this._isCanceled) 2840 if (this[_isCanceled])
2732 return; 2841 return;
2733 if (this._canFire) { 2842 if (this[_canFire]) {
2734 this._sendError(error, stackTrace); 2843 this[_sendError](error, stackTrace);
2735 } else { 2844 } else {
2736 this._addPending(new _DelayedError(error, stackTrace)); 2845 this[_addPending](new _DelayedError(error, stackTrace));
2737 } 2846 }
2738 } 2847 }
2739 _close() { 2848 [_close]() {
2740 dart.assert(!dart.notNull(this._isClosed)); 2849 dart.assert(!dart.notNull(this[_isClosed]));
2741 if (this._isCanceled) 2850 if (this[_isCanceled])
2742 return; 2851 return;
2743 this._state = _STATE_CLOSED; 2852 this[_state] = _STATE_CLOSED;
2744 if (this._canFire) { 2853 if (this[_canFire]) {
2745 this._sendDone(); 2854 this[_sendDone]();
2746 } else { 2855 } else {
2747 this._addPending(new _DelayedDone()); 2856 this[_addPending](new _DelayedDone());
2748 } 2857 }
2749 } 2858 }
2750 _onPause() { 2859 [_onPause]() {
2751 dart.assert(this._isInputPaused); 2860 dart.assert(this[_isInputPaused]);
2752 } 2861 }
2753 _onResume() { 2862 [_onResume]() {
2754 dart.assert(!dart.notNull(this._isInputPaused)); 2863 dart.assert(!dart.notNull(this[_isInputPaused]));
2755 } 2864 }
2756 _onCancel() { 2865 [_onCancel]() {
2757 dart.assert(this._isCanceled); 2866 dart.assert(this[_isCanceled]);
2758 return null; 2867 return null;
2759 } 2868 }
2760 _addPending(event) { 2869 [_addPending](event) {
2761 let pending = dart.as(this._pending, _StreamImplEvents); 2870 let pending = dart.as(this[_pending], _StreamImplEvents);
2762 if (this._pending === null) 2871 if (this[_pending] === null)
2763 pending = this._pending = new _StreamImplEvents(); 2872 pending = this[_pending] = new _StreamImplEvents();
2764 pending.add(event); 2873 pending.add(event);
2765 if (!dart.notNull(this._hasPending)) { 2874 if (!dart.notNull(this[_hasPending])) {
2766 this._state = _STATE_HAS_PENDING; 2875 this[_state] = _STATE_HAS_PENDING;
2767 if (!dart.notNull(this._isPaused)) { 2876 if (!dart.notNull(this[_isPaused])) {
2768 this._pending.schedule(this); 2877 this[_pending].schedule(this);
2769 } 2878 }
2770 } 2879 }
2771 } 2880 }
2772 _sendData(data) { 2881 [_sendData](data) {
2773 dart.assert(!dart.notNull(this._isCanceled)); 2882 dart.assert(!dart.notNull(this[_isCanceled]));
2774 dart.assert(!dart.notNull(this._isPaused)); 2883 dart.assert(!dart.notNull(this[_isPaused]));
2775 dart.assert(!dart.notNull(this._inCallback)); 2884 dart.assert(!dart.notNull(this[_inCallback]));
2776 let wasInputPaused = this._isInputPaused; 2885 let wasInputPaused = this[_isInputPaused];
2777 this._state = _STATE_IN_CALLBACK; 2886 this[_state] = _STATE_IN_CALLBACK;
2778 this._zone.runUnaryGuarded(dart.as(this._onData, dart.throw_("Unimplemen ted type (dynamic) → dynamic")), data); 2887 this[_zone].runUnaryGuarded(dart.as(this[_onData], dart.throw_("Unimplem ented type (dynamic) → dynamic")), data);
2779 this._state = ~_STATE_IN_CALLBACK; 2888 this[_state] = ~_STATE_IN_CALLBACK;
2780 this._checkState(wasInputPaused); 2889 this[_checkState](wasInputPaused);
2781 } 2890 }
2782 _sendError(error, stackTrace) { 2891 [_sendError](error, stackTrace) {
2783 dart.assert(!dart.notNull(this._isCanceled)); 2892 dart.assert(!dart.notNull(this[_isCanceled]));
2784 dart.assert(!dart.notNull(this._isPaused)); 2893 dart.assert(!dart.notNull(this[_isPaused]));
2785 dart.assert(!dart.notNull(this._inCallback)); 2894 dart.assert(!dart.notNull(this[_inCallback]));
2786 let wasInputPaused = this._isInputPaused; 2895 let wasInputPaused = this[_isInputPaused];
2787 // Function sendError: () → void 2896 // Function sendError: () → void
2788 function sendError() { 2897 function sendError() {
2789 if (dart.notNull(this._isCanceled) && dart.notNull(!dart.notNull(this. _waitsForCancel))) 2898 if (dart.notNull(this[_isCanceled]) && dart.notNull(!dart.notNull(this [_waitsForCancel])))
2790 return; 2899 return;
2791 this._state = _STATE_IN_CALLBACK; 2900 this[_state] = _STATE_IN_CALLBACK;
2792 if (dart.is(this._onError, ZoneBinaryCallback)) { 2901 if (dart.is(this[_onError], ZoneBinaryCallback)) {
2793 this._zone.runBinaryGuarded(dart.as(this._onError, dart.throw_("Unim plemented type (dynamic, dynamic) → dynamic")), error, stackTrace); 2902 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.throw_("Un implemented type (dynamic, dynamic) → dynamic")), error, stackTrace);
2794 } else { 2903 } else {
2795 this._zone.runUnaryGuarded(dart.as(this._onError, dart.throw_("Unimp lemented type (dynamic) → dynamic")), error); 2904 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.throw_("Uni mplemented type (dynamic) → dynamic")), error);
2796 } 2905 }
2797 this._state = ~_STATE_IN_CALLBACK; 2906 this[_state] = ~_STATE_IN_CALLBACK;
2798 } 2907 }
2799 if (this._cancelOnError) { 2908 if (this[_cancelOnError]) {
2800 this._state = _STATE_WAIT_FOR_CANCEL; 2909 this[_state] = _STATE_WAIT_FOR_CANCEL;
2801 this._cancel(); 2910 this[_cancel]();
2802 if (dart.is(this._cancelFuture, Future)) { 2911 if (dart.is(this[_cancelFuture], Future)) {
2803 this._cancelFuture.whenComplete(sendError); 2912 this[_cancelFuture].whenComplete(sendError);
2804 } else { 2913 } else {
2805 sendError(); 2914 sendError();
2806 } 2915 }
2807 } else { 2916 } else {
2808 sendError(); 2917 sendError();
2809 this._checkState(wasInputPaused); 2918 this[_checkState](wasInputPaused);
2810 } 2919 }
2811 } 2920 }
2812 _sendDone() { 2921 [_sendDone]() {
2813 dart.assert(!dart.notNull(this._isCanceled)); 2922 dart.assert(!dart.notNull(this[_isCanceled]));
2814 dart.assert(!dart.notNull(this._isPaused)); 2923 dart.assert(!dart.notNull(this[_isPaused]));
2815 dart.assert(!dart.notNull(this._inCallback)); 2924 dart.assert(!dart.notNull(this[_inCallback]));
2816 // Function sendDone: () → void 2925 // Function sendDone: () → void
2817 function sendDone() { 2926 function sendDone() {
2818 if (!dart.notNull(this._waitsForCancel)) 2927 if (!dart.notNull(this[_waitsForCancel]))
2819 return; 2928 return;
2820 this._state = _STATE_CANCELED | _STATE_CLOSED | _STATE_IN_CALLBACK; 2929 this[_state] = _STATE_CANCELED | _STATE_CLOSED | _STATE_IN_CALLBACK;
2821 this._zone.runGuarded(this._onDone); 2930 this[_zone].runGuarded(this[_onDone]);
2822 this._state = ~_STATE_IN_CALLBACK; 2931 this[_state] = ~_STATE_IN_CALLBACK;
2823 } 2932 }
2824 this._cancel(); 2933 this[_cancel]();
2825 this._state = _STATE_WAIT_FOR_CANCEL; 2934 this[_state] = _STATE_WAIT_FOR_CANCEL;
2826 if (dart.is(this._cancelFuture, Future)) { 2935 if (dart.is(this[_cancelFuture], Future)) {
2827 this._cancelFuture.whenComplete(sendDone); 2936 this[_cancelFuture].whenComplete(sendDone);
2828 } else { 2937 } else {
2829 sendDone(); 2938 sendDone();
2830 } 2939 }
2831 } 2940 }
2832 _guardCallback(callback) { 2941 [_guardCallback](callback) {
2833 dart.assert(!dart.notNull(this._inCallback)); 2942 dart.assert(!dart.notNull(this[_inCallback]));
2834 let wasInputPaused = this._isInputPaused; 2943 let wasInputPaused = this[_isInputPaused];
2835 this._state = _STATE_IN_CALLBACK; 2944 this[_state] = _STATE_IN_CALLBACK;
2836 dart.dinvokef(callback); 2945 dart.dinvokef(callback);
2837 this._state = ~_STATE_IN_CALLBACK; 2946 this[_state] = ~_STATE_IN_CALLBACK;
2838 this._checkState(wasInputPaused); 2947 this[_checkState](wasInputPaused);
2839 } 2948 }
2840 _checkState(wasInputPaused) { 2949 [_checkState](wasInputPaused) {
2841 dart.assert(!dart.notNull(this._inCallback)); 2950 dart.assert(!dart.notNull(this[_inCallback]));
2842 if (dart.notNull(this._hasPending) && dart.notNull(this._pending.isEmpty )) { 2951 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp ty)) {
2843 this._state = ~_STATE_HAS_PENDING; 2952 this[_state] = ~_STATE_HAS_PENDING;
2844 if (dart.notNull(this._isInputPaused) && dart.notNull(this._mayResumeI nput)) { 2953 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) {
2845 this._state = ~_STATE_INPUT_PAUSED; 2954 this[_state] = ~_STATE_INPUT_PAUSED;
2846 } 2955 }
2847 } 2956 }
2848 while (true) { 2957 while (true) {
2849 if (this._isCanceled) { 2958 if (this[_isCanceled]) {
2850 this._pending = null; 2959 this[_pending] = null;
2851 return; 2960 return;
2852 } 2961 }
2853 let isInputPaused = this._isInputPaused; 2962 let isInputPaused = this[_isInputPaused];
2854 if (wasInputPaused === isInputPaused) 2963 if (wasInputPaused === isInputPaused)
2855 break; 2964 break;
2856 this._state = _STATE_IN_CALLBACK; 2965 this[_state] = _STATE_IN_CALLBACK;
2857 if (isInputPaused) { 2966 if (isInputPaused) {
2858 this._onPause(); 2967 this[_onPause]();
2859 } else { 2968 } else {
2860 this._onResume(); 2969 this[_onResume]();
2861 } 2970 }
2862 this._state = ~_STATE_IN_CALLBACK; 2971 this[_state] = ~_STATE_IN_CALLBACK;
2863 wasInputPaused = isInputPaused; 2972 wasInputPaused = isInputPaused;
2864 } 2973 }
2865 if (dart.notNull(this._hasPending) && dart.notNull(!dart.notNull(this._i sPaused))) { 2974 if (dart.notNull(this[_hasPending]) && dart.notNull(!dart.notNull(this[_ isPaused]))) {
2866 this._pending.schedule(this); 2975 this[_pending].schedule(this);
2867 } 2976 }
2868 } 2977 }
2869 } 2978 }
2870 _BufferingStreamSubscription._STATE_CANCEL_ON_ERROR = 1; 2979 _BufferingStreamSubscription._STATE_CANCEL_ON_ERROR = 1;
2871 _BufferingStreamSubscription._STATE_CLOSED = 2; 2980 _BufferingStreamSubscription._STATE_CLOSED = 2;
2872 _BufferingStreamSubscription._STATE_INPUT_PAUSED = 4; 2981 _BufferingStreamSubscription._STATE_INPUT_PAUSED = 4;
2873 _BufferingStreamSubscription._STATE_CANCELED = 8; 2982 _BufferingStreamSubscription._STATE_CANCELED = 8;
2874 _BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL = 16; 2983 _BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL = 16;
2875 _BufferingStreamSubscription._STATE_IN_CALLBACK = 32; 2984 _BufferingStreamSubscription._STATE_IN_CALLBACK = 32;
2876 _BufferingStreamSubscription._STATE_HAS_PENDING = 64; 2985 _BufferingStreamSubscription._STATE_HAS_PENDING = 64;
2877 _BufferingStreamSubscription._STATE_PAUSE_COUNT = 128; 2986 _BufferingStreamSubscription._STATE_PAUSE_COUNT = 128;
2878 _BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7; 2987 _BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7;
2879 return _BufferingStreamSubscription; 2988 return _BufferingStreamSubscription;
2880 }); 2989 });
2881 let _BufferingStreamSubscription = _BufferingStreamSubscription$(dynamic); 2990 let _BufferingStreamSubscription = _BufferingStreamSubscription$(dynamic);
2882 let _StreamImpl$ = dart.generic(function(T) { 2991 let _StreamImpl$ = dart.generic(function(T) {
2883 class _StreamImpl extends Stream$(T) { 2992 class _StreamImpl extends Stream$(T) {
2884 listen(onData, opt$) { 2993 listen(onData, opt$) {
2885 let onError = opt$.onError === void 0 ? null : opt$.onError; 2994 let onError = opt$.onError === void 0 ? null : opt$.onError;
2886 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; 2995 let onDone = opt$.onDone === void 0 ? null : opt$.onDone;
2887 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error; 2996 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error;
2888 cancelOnError = core.identical(true, cancelOnError); 2997 cancelOnError = core.identical(true, cancelOnError);
2889 let subscription = this._createSubscription(onData, onError, onDone, can celOnError); 2998 let subscription = this[_createSubscription](onData, onError, onDone, ca ncelOnError);
2890 this._onListen(subscription); 2999 this[_onListen](subscription);
2891 return dart.as(subscription, StreamSubscription$(T)); 3000 return dart.as(subscription, StreamSubscription$(T));
2892 } 3001 }
2893 _createSubscription(onData, onError, onDone, cancelOnError) { 3002 [_createSubscription](onData, onError, onDone, cancelOnError) {
2894 return new _BufferingStreamSubscription(onData, onError, onDone, cancelO nError); 3003 return new _BufferingStreamSubscription(onData, onError, onDone, cancelO nError);
2895 } 3004 }
2896 _onListen(subscription) {} 3005 [_onListen](subscription) {}
2897 } 3006 }
2898 return _StreamImpl; 3007 return _StreamImpl;
2899 }); 3008 });
2900 let _StreamImpl = _StreamImpl$(dynamic); 3009 let _StreamImpl = _StreamImpl$(dynamic);
3010 let _isUsed = Symbol('_isUsed');
2901 let _GeneratedStreamImpl$ = dart.generic(function(T) { 3011 let _GeneratedStreamImpl$ = dart.generic(function(T) {
2902 class _GeneratedStreamImpl extends _StreamImpl$(T) { 3012 class _GeneratedStreamImpl extends _StreamImpl$(T) {
2903 _GeneratedStreamImpl(_pending) { 3013 _GeneratedStreamImpl($_pending) {
2904 this._pending = _pending; 3014 this[_pending] = $_pending;
2905 this._isUsed = false; 3015 this[_isUsed] = false;
2906 super._StreamImpl(); 3016 super._StreamImpl();
2907 } 3017 }
2908 _createSubscription(onData, onError, onDone, cancelOnError) { 3018 [_createSubscription](onData, onError, onDone, cancelOnError) {
2909 if (this._isUsed) 3019 if (this[_isUsed])
2910 throw new core.StateError("Stream has already been listened to."); 3020 throw new core.StateError("Stream has already been listened to.");
2911 this._isUsed = true; 3021 this[_isUsed] = true;
2912 return ((_) => { 3022 return ((_) => {
2913 _._setPendingEvents(this._pending()); 3023 _._setPendingEvents(this[_pending]());
2914 return _; 3024 return _;
2915 }).bind(this)(new _BufferingStreamSubscription(dart.as(onData, dart.thro w_("Unimplemented type (dynamic) → void")), onError, onDone, cancelOnError)); 3025 }).bind(this)(new _BufferingStreamSubscription(dart.as(onData, dart.thro w_("Unimplemented type (dynamic) → void")), onError, onDone, cancelOnError));
2916 } 3026 }
2917 } 3027 }
2918 return _GeneratedStreamImpl; 3028 return _GeneratedStreamImpl;
2919 }); 3029 });
2920 let _GeneratedStreamImpl = _GeneratedStreamImpl$(dynamic); 3030 let _GeneratedStreamImpl = _GeneratedStreamImpl$(dynamic);
3031 let _iterator = Symbol('_iterator');
2921 let _IterablePendingEvents$ = dart.generic(function(T) { 3032 let _IterablePendingEvents$ = dart.generic(function(T) {
2922 class _IterablePendingEvents extends _PendingEvents { 3033 class _IterablePendingEvents extends _PendingEvents {
2923 _IterablePendingEvents(data) { 3034 _IterablePendingEvents(data) {
2924 this._iterator = data.iterator; 3035 this[_iterator] = data.iterator;
2925 super._PendingEvents(); 3036 super._PendingEvents();
2926 } 3037 }
2927 get isEmpty() { 3038 get isEmpty() {
2928 return this._iterator === null; 3039 return this[_iterator] === null;
2929 } 3040 }
2930 handleNext(dispatch) { 3041 handleNext(dispatch) {
2931 if (this._iterator === null) { 3042 if (this[_iterator] === null) {
2932 throw new core.StateError("No events pending."); 3043 throw new core.StateError("No events pending.");
2933 } 3044 }
2934 let isDone = null; 3045 let isDone = null;
2935 try { 3046 try {
2936 isDone = !dart.notNull(this._iterator.moveNext()); 3047 isDone = !dart.notNull(this[_iterator].moveNext());
2937 } catch (e) { 3048 } catch (e) {
2938 let s = dart.stackTrace(e); 3049 let s = dart.stackTrace(e);
2939 this._iterator = null; 3050 this[_iterator] = null;
2940 dispatch._sendError(e, s); 3051 dispatch._sendError(e, s);
2941 return; 3052 return;
2942 } 3053 }
2943 3054
2944 if (!dart.notNull(isDone)) { 3055 if (!dart.notNull(isDone)) {
2945 dispatch._sendData(this._iterator.current); 3056 dispatch._sendData(this[_iterator].current);
2946 } else { 3057 } else {
2947 this._iterator = null; 3058 this[_iterator] = null;
2948 dispatch._sendDone(); 3059 dispatch._sendDone();
2949 } 3060 }
2950 } 3061 }
2951 clear() { 3062 clear() {
2952 if (this.isScheduled) 3063 if (this.isScheduled)
2953 this.cancelSchedule(); 3064 this.cancelSchedule();
2954 this._iterator = null; 3065 this[_iterator] = null;
2955 } 3066 }
2956 } 3067 }
2957 return _IterablePendingEvents; 3068 return _IterablePendingEvents;
2958 }); 3069 });
2959 let _IterablePendingEvents = _IterablePendingEvents$(dynamic); 3070 let _IterablePendingEvents = _IterablePendingEvents$(dynamic);
2960 // Function _nullDataHandler: (dynamic) → void 3071 // Function _nullDataHandler: (dynamic) → void
2961 function _nullDataHandler(value) { 3072 function _nullDataHandler(value) {
2962 } 3073 }
2963 // Function _nullErrorHandler: (dynamic, [StackTrace]) → void 3074 // Function _nullErrorHandler: (dynamic, [StackTrace]) → void
2964 function _nullErrorHandler(error, stackTrace) { 3075 function _nullErrorHandler(error, stackTrace) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 perform(dispatch) { 3114 perform(dispatch) {
3004 dispatch._sendDone(); 3115 dispatch._sendDone();
3005 } 3116 }
3006 get next() { 3117 get next() {
3007 return null; 3118 return null;
3008 } 3119 }
3009 set next(_) { 3120 set next(_) {
3010 throw new core.StateError("No events after a done."); 3121 throw new core.StateError("No events after a done.");
3011 } 3122 }
3012 } 3123 }
3124 let _eventScheduled = Symbol('_eventScheduled');
3013 class _PendingEvents extends dart.Object { 3125 class _PendingEvents extends dart.Object {
3014 _PendingEvents() { 3126 _PendingEvents() {
3015 this._state = _STATE_UNSCHEDULED; 3127 this[_state] = _STATE_UNSCHEDULED;
3016 } 3128 }
3017 get isScheduled() { 3129 get isScheduled() {
3018 return this._state === _STATE_SCHEDULED; 3130 return this[_state] === _STATE_SCHEDULED;
3019 } 3131 }
3020 get _eventScheduled() { 3132 get [_eventScheduled]() {
3021 return this._state >= _STATE_SCHEDULED; 3133 return this[_state] >= _STATE_SCHEDULED;
3022 } 3134 }
3023 schedule(dispatch) { 3135 schedule(dispatch) {
3024 if (this.isScheduled) 3136 if (this.isScheduled)
3025 return; 3137 return;
3026 dart.assert(!dart.notNull(this.isEmpty)); 3138 dart.assert(!dart.notNull(this.isEmpty));
3027 if (this._eventScheduled) { 3139 if (this[_eventScheduled]) {
3028 dart.assert(this._state === _STATE_CANCELED); 3140 dart.assert(this[_state] === _STATE_CANCELED);
3029 this._state = _STATE_SCHEDULED; 3141 this[_state] = _STATE_SCHEDULED;
3030 return; 3142 return;
3031 } 3143 }
3032 scheduleMicrotask((() => { 3144 scheduleMicrotask((() => {
3033 let oldState = this._state; 3145 let oldState = this[_state];
3034 this._state = _STATE_UNSCHEDULED; 3146 this[_state] = _STATE_UNSCHEDULED;
3035 if (oldState === _STATE_CANCELED) 3147 if (oldState === _STATE_CANCELED)
3036 return; 3148 return;
3037 this.handleNext(dispatch); 3149 this.handleNext(dispatch);
3038 }).bind(this)); 3150 }).bind(this));
3039 this._state = _STATE_SCHEDULED; 3151 this[_state] = _STATE_SCHEDULED;
3040 } 3152 }
3041 cancelSchedule() { 3153 cancelSchedule() {
3042 if (this.isScheduled) 3154 if (this.isScheduled)
3043 this._state = _STATE_CANCELED; 3155 this[_state] = _STATE_CANCELED;
3044 } 3156 }
3045 } 3157 }
3046 _PendingEvents._STATE_UNSCHEDULED = 0; 3158 _PendingEvents._STATE_UNSCHEDULED = 0;
3047 _PendingEvents._STATE_SCHEDULED = 1; 3159 _PendingEvents._STATE_SCHEDULED = 1;
3048 _PendingEvents._STATE_CANCELED = 3; 3160 _PendingEvents._STATE_CANCELED = 3;
3049 class _StreamImplEvents extends _PendingEvents { 3161 class _StreamImplEvents extends _PendingEvents {
3050 _StreamImplEvents() { 3162 _StreamImplEvents() {
3051 this.firstPendingEvent = null; 3163 this.firstPendingEvent = null;
3052 this.lastPendingEvent = null; 3164 this.lastPendingEvent = null;
3053 super._PendingEvents(); 3165 super._PendingEvents();
(...skipping 16 matching lines...) Expand all
3070 this.lastPendingEvent = null; 3182 this.lastPendingEvent = null;
3071 } 3183 }
3072 event.perform(dispatch); 3184 event.perform(dispatch);
3073 } 3185 }
3074 clear() { 3186 clear() {
3075 if (this.isScheduled) 3187 if (this.isScheduled)
3076 this.cancelSchedule(); 3188 this.cancelSchedule();
3077 this.firstPendingEvent = this.lastPendingEvent = null; 3189 this.firstPendingEvent = this.lastPendingEvent = null;
3078 } 3190 }
3079 } 3191 }
3192 let _unlink = Symbol('_unlink');
3193 let _insertBefore = Symbol('_insertBefore');
3080 class _BroadcastLinkedList extends dart.Object { 3194 class _BroadcastLinkedList extends dart.Object {
3081 _BroadcastLinkedList() { 3195 _BroadcastLinkedList() {
3082 this._next = null; 3196 this[_next] = null;
3083 this._previous = null; 3197 this[_previous] = null;
3084 } 3198 }
3085 _unlink() { 3199 [_unlink]() {
3086 this._previous._next = this._next; 3200 this[_previous][_next] = this[_next];
3087 this._next._previous = this._previous; 3201 this[_next][_previous] = this[_previous];
3088 this._next = this._previous = this; 3202 this[_next] = this[_previous] = this;
3089 } 3203 }
3090 _insertBefore(newNext) { 3204 [_insertBefore](newNext) {
3091 let newPrevious = newNext._previous; 3205 let newPrevious = newNext[_previous];
3092 newPrevious._next = this; 3206 newPrevious[_next] = this;
3093 newNext._previous = this._previous; 3207 newNext[_previous] = this[_previous];
3094 this._previous._next = newNext; 3208 this[_previous][_next] = newNext;
3095 this._previous = newPrevious; 3209 this[_previous] = newPrevious;
3096 } 3210 }
3097 } 3211 }
3212 let _schedule = Symbol('_schedule');
3213 let _isSent = Symbol('_isSent');
3214 let _isScheduled = Symbol('_isScheduled');
3098 let _DoneStreamSubscription$ = dart.generic(function(T) { 3215 let _DoneStreamSubscription$ = dart.generic(function(T) {
3099 class _DoneStreamSubscription extends dart.Object { 3216 class _DoneStreamSubscription extends dart.Object {
3100 _DoneStreamSubscription(_onDone) { 3217 _DoneStreamSubscription($_onDone) {
3101 this._onDone = _onDone; 3218 this[_onDone] = $_onDone;
3102 this._zone = Zone.current; 3219 this[_zone] = Zone.current;
3103 this._state = 0; 3220 this[_state] = 0;
3104 this._schedule(); 3221 this[_schedule]();
3105 } 3222 }
3106 get _isSent() { 3223 get [_isSent]() {
3107 return (this._state & _DONE_SENT) !== 0; 3224 return (this[_state] & _DONE_SENT) !== 0;
3108 } 3225 }
3109 get _isScheduled() { 3226 get [_isScheduled]() {
3110 return (this._state & _SCHEDULED) !== 0; 3227 return (this[_state] & _SCHEDULED) !== 0;
3111 } 3228 }
3112 get isPaused() { 3229 get isPaused() {
3113 return this._state >= _PAUSED; 3230 return this[_state] >= _PAUSED;
3114 } 3231 }
3115 _schedule() { 3232 [_schedule]() {
3116 if (this._isScheduled) 3233 if (this[_isScheduled])
3117 return; 3234 return;
3118 this._zone.scheduleMicrotask(this._sendDone); 3235 this[_zone].scheduleMicrotask(this[_sendDone]);
3119 this._state = _SCHEDULED; 3236 this[_state] = _SCHEDULED;
3120 } 3237 }
3121 onData(handleData) {} 3238 onData(handleData) {}
3122 onError(handleError) {} 3239 onError(handleError) {}
3123 onDone(handleDone) { 3240 onDone(handleDone) {
3124 this._onDone = handleDone; 3241 this[_onDone] = handleDone;
3125 } 3242 }
3126 pause(resumeSignal) { 3243 pause(resumeSignal) {
3127 if (resumeSignal === void 0) 3244 if (resumeSignal === void 0)
3128 resumeSignal = null; 3245 resumeSignal = null;
3129 this._state = _PAUSED; 3246 this[_state] = _PAUSED;
3130 if (resumeSignal !== null) 3247 if (resumeSignal !== null)
3131 resumeSignal.whenComplete(this.resume); 3248 resumeSignal.whenComplete(this.resume);
3132 } 3249 }
3133 resume() { 3250 resume() {
3134 if (this.isPaused) { 3251 if (this.isPaused) {
3135 this._state = _PAUSED; 3252 this[_state] = _PAUSED;
3136 if (dart.notNull(!dart.notNull(this.isPaused)) && dart.notNull(!dart.n otNull(this._isSent))) { 3253 if (dart.notNull(!dart.notNull(this.isPaused)) && dart.notNull(!dart.n otNull(this[_isSent]))) {
3137 this._schedule(); 3254 this[_schedule]();
3138 } 3255 }
3139 } 3256 }
3140 } 3257 }
3141 cancel() { 3258 cancel() {
3142 return null; 3259 return null;
3143 } 3260 }
3144 asFuture(futureValue) { 3261 asFuture(futureValue) {
3145 if (futureValue === void 0) 3262 if (futureValue === void 0)
3146 futureValue = null; 3263 futureValue = null;
3147 let result = new _Future(); 3264 let result = new _Future();
3148 this._onDone = (() => { 3265 this[_onDone] = (() => {
3149 result._completeWithValue(null); 3266 result._completeWithValue(null);
3150 }).bind(this); 3267 }).bind(this);
3151 return result; 3268 return result;
3152 } 3269 }
3153 _sendDone() { 3270 [_sendDone]() {
3154 this._state = ~_SCHEDULED; 3271 this[_state] = ~_SCHEDULED;
3155 if (this.isPaused) 3272 if (this.isPaused)
3156 return; 3273 return;
3157 this._state = _DONE_SENT; 3274 this[_state] = _DONE_SENT;
3158 if (this._onDone !== null) 3275 if (this[_onDone] !== null)
3159 this._zone.runGuarded(this._onDone); 3276 this[_zone].runGuarded(this[_onDone]);
3160 } 3277 }
3161 } 3278 }
3162 _DoneStreamSubscription._DONE_SENT = 1; 3279 _DoneStreamSubscription._DONE_SENT = 1;
3163 _DoneStreamSubscription._SCHEDULED = 2; 3280 _DoneStreamSubscription._SCHEDULED = 2;
3164 _DoneStreamSubscription._PAUSED = 4; 3281 _DoneStreamSubscription._PAUSED = 4;
3165 return _DoneStreamSubscription; 3282 return _DoneStreamSubscription;
3166 }); 3283 });
3167 let _DoneStreamSubscription = _DoneStreamSubscription$(dynamic); 3284 let _DoneStreamSubscription = _DoneStreamSubscription$(dynamic);
3285 let _source = Symbol('_source');
3286 let _onListenHandler = Symbol('_onListenHandler');
3287 let _onCancelHandler = Symbol('_onCancelHandler');
3288 let _cancelSubscription = Symbol('_cancelSubscription');
3289 let _pauseSubscription = Symbol('_pauseSubscription');
3290 let _resumeSubscription = Symbol('_resumeSubscription');
3291 let _isSubscriptionPaused = Symbol('_isSubscriptionPaused');
3168 let _AsBroadcastStream$ = dart.generic(function(T) { 3292 let _AsBroadcastStream$ = dart.generic(function(T) {
3169 class _AsBroadcastStream extends Stream$(T) { 3293 class _AsBroadcastStream extends Stream$(T) {
3170 _AsBroadcastStream(_source, onListenHandler, onCancelHandler) { 3294 _AsBroadcastStream($_source, onListenHandler, onCancelHandler) {
3171 this._source = _source; 3295 this[_source] = $_source;
3172 this._onListenHandler = Zone.current.registerUnaryCallback(dart.as(onLis tenHandler, dart.throw_("Unimplemented type (dynamic) → dynamic"))); 3296 this[_onListenHandler] = Zone.current.registerUnaryCallback(dart.as(onLi stenHandler, dart.throw_("Unimplemented type (dynamic) → dynamic")));
3173 this._onCancelHandler = Zone.current.registerUnaryCallback(dart.as(onCan celHandler, dart.throw_("Unimplemented type (dynamic) → dynamic"))); 3297 this[_onCancelHandler] = Zone.current.registerUnaryCallback(dart.as(onCa ncelHandler, dart.throw_("Unimplemented type (dynamic) → dynamic")));
3174 this._zone = Zone.current; 3298 this[_zone] = Zone.current;
3175 this._controller = null; 3299 this[_controller] = null;
3176 this._subscription = null; 3300 this[_subscription] = null;
3177 super.Stream(); 3301 super.Stream();
3178 this._controller = new _AsBroadcastStreamController(this._onListen, this ._onCancel); 3302 this[_controller] = new _AsBroadcastStreamController(this[_onListen], th is[_onCancel]);
3179 } 3303 }
3180 get isBroadcast() { 3304 get isBroadcast() {
3181 return true; 3305 return true;
3182 } 3306 }
3183 listen(onData, opt$) { 3307 listen(onData, opt$) {
3184 let onError = opt$.onError === void 0 ? null : opt$.onError; 3308 let onError = opt$.onError === void 0 ? null : opt$.onError;
3185 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; 3309 let onDone = opt$.onDone === void 0 ? null : opt$.onDone;
3186 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error; 3310 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error;
3187 if (dart.notNull(this._controller === null) || dart.notNull(this._contro ller.isClosed)) { 3311 if (dart.notNull(this[_controller] === null) || dart.notNull(this[_contr oller].isClosed)) {
3188 return new _DoneStreamSubscription(onDone); 3312 return new _DoneStreamSubscription(onDone);
3189 } 3313 }
3190 if (this._subscription === null) { 3314 if (this[_subscription] === null) {
3191 this._subscription = this._source.listen(this._controller.add, {onErro r: this._controller.addError, onDone: this._controller.close}); 3315 this[_subscription] = this[_source].listen(this[_controller].add, {onE rror: this[_controller].addError, onDone: this[_controller].close});
3192 } 3316 }
3193 cancelOnError = core.identical(true, cancelOnError); 3317 cancelOnError = core.identical(true, cancelOnError);
3194 return this._controller._subscribe(onData, onError, onDone, cancelOnErro r); 3318 return this[_controller]._subscribe(onData, onError, onDone, cancelOnErr or);
3195 } 3319 }
3196 _onCancel() { 3320 [_onCancel]() {
3197 let shutdown = dart.notNull(this._controller === null) || dart.notNull(t his._controller.isClosed); 3321 let shutdown = dart.notNull(this[_controller] === null) || dart.notNull( this[_controller].isClosed);
3198 if (this._onCancelHandler !== null) { 3322 if (this[_onCancelHandler] !== null) {
3199 this._zone.runUnary(dart.as(this._onCancelHandler, dart.throw_("Unimpl emented type (dynamic) → dynamic")), new _BroadcastSubscriptionWrapper(this)); 3323 this[_zone].runUnary(dart.as(this[_onCancelHandler], dart.throw_("Unim plemented type (dynamic) → dynamic")), new _BroadcastSubscriptionWrapper(this));
3200 } 3324 }
3201 if (shutdown) { 3325 if (shutdown) {
3202 if (this._subscription !== null) { 3326 if (this[_subscription] !== null) {
3203 this._subscription.cancel(); 3327 this[_subscription].cancel();
3204 this._subscription = null; 3328 this[_subscription] = null;
3205 } 3329 }
3206 } 3330 }
3207 } 3331 }
3208 _onListen() { 3332 [_onListen]() {
3209 if (this._onListenHandler !== null) { 3333 if (this[_onListenHandler] !== null) {
3210 this._zone.runUnary(dart.as(this._onListenHandler, dart.throw_("Unimpl emented type (dynamic) → dynamic")), new _BroadcastSubscriptionWrapper(this)); 3334 this[_zone].runUnary(dart.as(this[_onListenHandler], dart.throw_("Unim plemented type (dynamic) → dynamic")), new _BroadcastSubscriptionWrapper(this));
3211 } 3335 }
3212 } 3336 }
3213 _cancelSubscription() { 3337 [_cancelSubscription]() {
3214 if (this._subscription === null) 3338 if (this[_subscription] === null)
3215 return; 3339 return;
3216 let subscription = this._subscription; 3340 let subscription = this[_subscription];
3217 this._subscription = null; 3341 this[_subscription] = null;
3218 this._controller = null; 3342 this[_controller] = null;
3219 subscription.cancel(); 3343 subscription.cancel();
3220 } 3344 }
3221 _pauseSubscription(resumeSignal) { 3345 [_pauseSubscription](resumeSignal) {
3222 if (this._subscription === null) 3346 if (this[_subscription] === null)
3223 return; 3347 return;
3224 this._subscription.pause(resumeSignal); 3348 this[_subscription].pause(resumeSignal);
3225 } 3349 }
3226 _resumeSubscription() { 3350 [_resumeSubscription]() {
3227 if (this._subscription === null) 3351 if (this[_subscription] === null)
3228 return; 3352 return;
3229 this._subscription.resume(); 3353 this[_subscription].resume();
3230 } 3354 }
3231 get _isSubscriptionPaused() { 3355 get [_isSubscriptionPaused]() {
3232 if (this._subscription === null) 3356 if (this[_subscription] === null)
3233 return false; 3357 return false;
3234 return this._subscription.isPaused; 3358 return this[_subscription].isPaused;
3235 } 3359 }
3236 } 3360 }
3237 return _AsBroadcastStream; 3361 return _AsBroadcastStream;
3238 }); 3362 });
3239 let _AsBroadcastStream = _AsBroadcastStream$(dynamic); 3363 let _AsBroadcastStream = _AsBroadcastStream$(dynamic);
3240 let _BroadcastSubscriptionWrapper$ = dart.generic(function(T) { 3364 let _BroadcastSubscriptionWrapper$ = dart.generic(function(T) {
3241 class _BroadcastSubscriptionWrapper extends dart.Object { 3365 class _BroadcastSubscriptionWrapper extends dart.Object {
3242 _BroadcastSubscriptionWrapper(_stream) { 3366 _BroadcastSubscriptionWrapper($_stream) {
3243 this._stream = _stream; 3367 this[_stream] = $_stream;
3244 } 3368 }
3245 onData(handleData) { 3369 onData(handleData) {
3246 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription."); 3370 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription.");
3247 } 3371 }
3248 onError(handleError) { 3372 onError(handleError) {
3249 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription."); 3373 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription.");
3250 } 3374 }
3251 onDone(handleDone) { 3375 onDone(handleDone) {
3252 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription."); 3376 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription.");
3253 } 3377 }
3254 pause(resumeSignal) { 3378 pause(resumeSignal) {
3255 if (resumeSignal === void 0) 3379 if (resumeSignal === void 0)
3256 resumeSignal = null; 3380 resumeSignal = null;
3257 this._stream._pauseSubscription(resumeSignal); 3381 this[_stream]._pauseSubscription(resumeSignal);
3258 } 3382 }
3259 resume() { 3383 resume() {
3260 this._stream._resumeSubscription(); 3384 this[_stream]._resumeSubscription();
3261 } 3385 }
3262 cancel() { 3386 cancel() {
3263 this._stream._cancelSubscription(); 3387 this[_stream]._cancelSubscription();
3264 return null; 3388 return null;
3265 } 3389 }
3266 get isPaused() { 3390 get isPaused() {
3267 return this._stream._isSubscriptionPaused; 3391 return this[_stream][_isSubscriptionPaused];
3268 } 3392 }
3269 asFuture(futureValue) { 3393 asFuture(futureValue) {
3270 if (futureValue === void 0) 3394 if (futureValue === void 0)
3271 futureValue = null; 3395 futureValue = null;
3272 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription."); 3396 throw new core.UnsupportedError("Cannot change handlers of asBroadcastSt ream source subscription.");
3273 } 3397 }
3274 } 3398 }
3275 return _BroadcastSubscriptionWrapper; 3399 return _BroadcastSubscriptionWrapper;
3276 }); 3400 });
3277 let _BroadcastSubscriptionWrapper = _BroadcastSubscriptionWrapper$(dynamic); 3401 let _BroadcastSubscriptionWrapper = _BroadcastSubscriptionWrapper$(dynamic);
3402 let _current = Symbol('_current');
3403 let _futureOrPrefetch = Symbol('_futureOrPrefetch');
3404 let _clear = Symbol('_clear');
3278 let _StreamIteratorImpl$ = dart.generic(function(T) { 3405 let _StreamIteratorImpl$ = dart.generic(function(T) {
3279 class _StreamIteratorImpl extends dart.Object { 3406 class _StreamIteratorImpl extends dart.Object {
3280 _StreamIteratorImpl(stream) { 3407 _StreamIteratorImpl(stream) {
3281 this._subscription = null; 3408 this[_subscription] = null;
3282 this._current = dart.as(null, T); 3409 this[_current] = dart.as(null, T);
3283 this._futureOrPrefetch = null; 3410 this[_futureOrPrefetch] = null;
3284 this._state = _STATE_FOUND; 3411 this[_state] = _STATE_FOUND;
3285 this._subscription = stream.listen(this._onData, {onError: this._onError , onDone: this._onDone, cancelOnError: true}); 3412 this[_subscription] = stream.listen(this[_onData], {onError: this[_onErr or], onDone: this[_onDone], cancelOnError: true});
3286 } 3413 }
3287 get current() { 3414 get current() {
3288 return this._current; 3415 return this[_current];
3289 } 3416 }
3290 moveNext() { 3417 moveNext() {
3291 if (this._state === _STATE_DONE) { 3418 if (this[_state] === _STATE_DONE) {
3292 return new _Future.immediate(false); 3419 return new _Future.immediate(false);
3293 } 3420 }
3294 if (this._state === _STATE_MOVING) { 3421 if (this[_state] === _STATE_MOVING) {
3295 throw new core.StateError("Already waiting for next."); 3422 throw new core.StateError("Already waiting for next.");
3296 } 3423 }
3297 if (this._state === _STATE_FOUND) { 3424 if (this[_state] === _STATE_FOUND) {
3298 this._state = _STATE_MOVING; 3425 this[_state] = _STATE_MOVING;
3299 this._current = dart.as(null, T); 3426 this[_current] = dart.as(null, T);
3300 this._futureOrPrefetch = new _Future(); 3427 this[_futureOrPrefetch] = new _Future();
3301 return dart.as(this._futureOrPrefetch, Future$(core.bool)); 3428 return dart.as(this[_futureOrPrefetch], Future$(core.bool));
3302 } else { 3429 } else {
3303 dart.assert(this._state >= _STATE_EXTRA_DATA); 3430 dart.assert(this[_state] >= _STATE_EXTRA_DATA);
3304 switch (this._state) { 3431 switch (this[_state]) {
3305 case _STATE_EXTRA_DATA: 3432 case _STATE_EXTRA_DATA:
3306 this._state = _STATE_FOUND; 3433 this[_state] = _STATE_FOUND;
3307 this._current = dart.as(this._futureOrPrefetch, T); 3434 this[_current] = dart.as(this[_futureOrPrefetch], T);
3308 this._futureOrPrefetch = null; 3435 this[_futureOrPrefetch] = null;
3309 this._subscription.resume(); 3436 this[_subscription].resume();
3310 return new _Future.immediate(true); 3437 return new _Future.immediate(true);
3311 case _STATE_EXTRA_ERROR: 3438 case _STATE_EXTRA_ERROR:
3312 let prefetch = dart.as(this._futureOrPrefetch, AsyncError); 3439 let prefetch = dart.as(this[_futureOrPrefetch], AsyncError);
3313 this._clear(); 3440 this[_clear]();
3314 return new _Future.immediateError(prefetch.error, prefetch.stackTr ace); 3441 return new _Future.immediateError(prefetch.error, prefetch.stackTr ace);
3315 case _STATE_EXTRA_DONE: 3442 case _STATE_EXTRA_DONE:
3316 this._clear(); 3443 this[_clear]();
3317 return new _Future.immediate(false); 3444 return new _Future.immediate(false);
3318 } 3445 }
3319 } 3446 }
3320 } 3447 }
3321 _clear() { 3448 [_clear]() {
3322 this._subscription = null; 3449 this[_subscription] = null;
3323 this._futureOrPrefetch = null; 3450 this[_futureOrPrefetch] = null;
3324 this._current = dart.as(null, T); 3451 this[_current] = dart.as(null, T);
3325 this._state = _STATE_DONE; 3452 this[_state] = _STATE_DONE;
3326 } 3453 }
3327 cancel() { 3454 cancel() {
3328 let subscription = this._subscription; 3455 let subscription = this[_subscription];
3329 if (this._state === _STATE_MOVING) { 3456 if (this[_state] === _STATE_MOVING) {
3330 let hasNext = dart.as(this._futureOrPrefetch, _Future$(core.bool)); 3457 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
3331 this._clear(); 3458 this[_clear]();
3332 hasNext._complete(false); 3459 hasNext._complete(false);
3333 } else { 3460 } else {
3334 this._clear(); 3461 this[_clear]();
3335 } 3462 }
3336 return subscription.cancel(); 3463 return subscription.cancel();
3337 } 3464 }
3338 _onData(data) { 3465 [_onData](data) {
3339 if (this._state === _STATE_MOVING) { 3466 if (this[_state] === _STATE_MOVING) {
3340 this._current = data; 3467 this[_current] = data;
3341 let hasNext = dart.as(this._futureOrPrefetch, _Future$(core.bool)); 3468 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
3342 this._futureOrPrefetch = null; 3469 this[_futureOrPrefetch] = null;
3343 this._state = _STATE_FOUND; 3470 this[_state] = _STATE_FOUND;
3344 hasNext._complete(true); 3471 hasNext._complete(true);
3345 return; 3472 return;
3346 } 3473 }
3347 this._subscription.pause(); 3474 this[_subscription].pause();
3348 dart.assert(this._futureOrPrefetch === null); 3475 dart.assert(this[_futureOrPrefetch] === null);
3349 this._futureOrPrefetch = data; 3476 this[_futureOrPrefetch] = data;
3350 this._state = _STATE_EXTRA_DATA; 3477 this[_state] = _STATE_EXTRA_DATA;
3351 } 3478 }
3352 _onError(error, stackTrace) { 3479 [_onError](error, stackTrace) {
3353 if (stackTrace === void 0) 3480 if (stackTrace === void 0)
3354 stackTrace = null; 3481 stackTrace = null;
3355 if (this._state === _STATE_MOVING) { 3482 if (this[_state] === _STATE_MOVING) {
3356 let hasNext = dart.as(this._futureOrPrefetch, _Future$(core.bool)); 3483 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
3357 this._clear(); 3484 this[_clear]();
3358 hasNext._completeError(error, stackTrace); 3485 hasNext._completeError(error, stackTrace);
3359 return; 3486 return;
3360 } 3487 }
3361 this._subscription.pause(); 3488 this[_subscription].pause();
3362 dart.assert(this._futureOrPrefetch === null); 3489 dart.assert(this[_futureOrPrefetch] === null);
3363 this._futureOrPrefetch = new AsyncError(error, stackTrace); 3490 this[_futureOrPrefetch] = new AsyncError(error, stackTrace);
3364 this._state = _STATE_EXTRA_ERROR; 3491 this[_state] = _STATE_EXTRA_ERROR;
3365 } 3492 }
3366 _onDone() { 3493 [_onDone]() {
3367 if (this._state === _STATE_MOVING) { 3494 if (this[_state] === _STATE_MOVING) {
3368 let hasNext = dart.as(this._futureOrPrefetch, _Future$(core.bool)); 3495 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
3369 this._clear(); 3496 this[_clear]();
3370 hasNext._complete(false); 3497 hasNext._complete(false);
3371 return; 3498 return;
3372 } 3499 }
3373 this._subscription.pause(); 3500 this[_subscription].pause();
3374 this._futureOrPrefetch = null; 3501 this[_futureOrPrefetch] = null;
3375 this._state = _STATE_EXTRA_DONE; 3502 this[_state] = _STATE_EXTRA_DONE;
3376 } 3503 }
3377 } 3504 }
3378 _StreamIteratorImpl._STATE_FOUND = 0; 3505 _StreamIteratorImpl._STATE_FOUND = 0;
3379 _StreamIteratorImpl._STATE_DONE = 1; 3506 _StreamIteratorImpl._STATE_DONE = 1;
3380 _StreamIteratorImpl._STATE_MOVING = 2; 3507 _StreamIteratorImpl._STATE_MOVING = 2;
3381 _StreamIteratorImpl._STATE_EXTRA_DATA = 3; 3508 _StreamIteratorImpl._STATE_EXTRA_DATA = 3;
3382 _StreamIteratorImpl._STATE_EXTRA_ERROR = 4; 3509 _StreamIteratorImpl._STATE_EXTRA_ERROR = 4;
3383 _StreamIteratorImpl._STATE_EXTRA_DONE = 5; 3510 _StreamIteratorImpl._STATE_EXTRA_DONE = 5;
3384 return _StreamIteratorImpl; 3511 return _StreamIteratorImpl;
3385 }); 3512 });
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3425 } 3552 }
3426 // Function _cancelAndValue: (StreamSubscription<dynamic>, _Future<dynamic>, d ynamic) → void 3553 // Function _cancelAndValue: (StreamSubscription<dynamic>, _Future<dynamic>, d ynamic) → void
3427 function _cancelAndValue(subscription, future, value) { 3554 function _cancelAndValue(subscription, future, value) {
3428 let cancelFuture = subscription.cancel(); 3555 let cancelFuture = subscription.cancel();
3429 if (dart.is(cancelFuture, Future)) { 3556 if (dart.is(cancelFuture, Future)) {
3430 cancelFuture.whenComplete(() => future._complete(value)); 3557 cancelFuture.whenComplete(() => future._complete(value));
3431 } else { 3558 } else {
3432 future._complete(value); 3559 future._complete(value);
3433 } 3560 }
3434 } 3561 }
3562 let _handleData = Symbol('_handleData');
3563 let _handleError = Symbol('_handleError');
3564 let _handleDone = Symbol('_handleDone');
3435 let _ForwardingStream$ = dart.generic(function(S, T) { 3565 let _ForwardingStream$ = dart.generic(function(S, T) {
3436 class _ForwardingStream extends Stream$(T) { 3566 class _ForwardingStream extends Stream$(T) {
3437 _ForwardingStream(_source) { 3567 _ForwardingStream($_source) {
3438 this._source = _source; 3568 this[_source] = $_source;
3439 super.Stream(); 3569 super.Stream();
3440 } 3570 }
3441 get isBroadcast() { 3571 get isBroadcast() {
3442 return this._source.isBroadcast; 3572 return this[_source].isBroadcast;
3443 } 3573 }
3444 listen(onData, opt$) { 3574 listen(onData, opt$) {
3445 let onError = opt$.onError === void 0 ? null : opt$.onError; 3575 let onError = opt$.onError === void 0 ? null : opt$.onError;
3446 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; 3576 let onDone = opt$.onDone === void 0 ? null : opt$.onDone;
3447 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error; 3577 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error;
3448 cancelOnError = core.identical(true, cancelOnError); 3578 cancelOnError = core.identical(true, cancelOnError);
3449 return this._createSubscription(onData, onError, onDone, cancelOnError); 3579 return this[_createSubscription](onData, onError, onDone, cancelOnError) ;
3450 } 3580 }
3451 _createSubscription(onData, onError, onDone, cancelOnError) { 3581 [_createSubscription](onData, onError, onDone, cancelOnError) {
3452 return new _ForwardingStreamSubscription(this, onData, onError, onDone, cancelOnError); 3582 return new _ForwardingStreamSubscription(this, onData, onError, onDone, cancelOnError);
3453 } 3583 }
3454 _handleData(data, sink) { 3584 [_handleData](data, sink) {
3455 let outputData = data; 3585 let outputData = data;
3456 sink._add(outputData); 3586 sink._add(outputData);
3457 } 3587 }
3458 _handleError(error, stackTrace, sink) { 3588 [_handleError](error, stackTrace, sink) {
3459 sink._addError(error, stackTrace); 3589 sink._addError(error, stackTrace);
3460 } 3590 }
3461 _handleDone(sink) { 3591 [_handleDone](sink) {
3462 sink._close(); 3592 sink._close();
3463 } 3593 }
3464 } 3594 }
3465 return _ForwardingStream; 3595 return _ForwardingStream;
3466 }); 3596 });
3467 let _ForwardingStream = _ForwardingStream$(dynamic, dynamic); 3597 let _ForwardingStream = _ForwardingStream$(dynamic, dynamic);
3468 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) { 3598 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) {
3469 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T) { 3599 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T) {
3470 _ForwardingStreamSubscription(_stream, onData, onError, onDone, cancelOnEr ror) { 3600 _ForwardingStreamSubscription($_stream, onData, onError, onDone, cancelOnE rror) {
3471 this._stream = _stream; 3601 this[_stream] = $_stream;
3472 this._subscription = null; 3602 this[_subscription] = null;
3473 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 3603 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
3474 this._subscription = this._stream._source.listen(this._handleData, {onEr ror: this._handleError, onDone: this._handleDone}); 3604 this[_subscription] = this[_stream][_source].listen(this[_handleData], { onError: this[_handleError], onDone: this[_handleDone]});
3475 } 3605 }
3476 _add(data) { 3606 [_add](data) {
3477 if (this._isClosed) 3607 if (this[_isClosed])
3478 return; 3608 return;
3479 super._add(data); 3609 super._add(data);
3480 } 3610 }
3481 _addError(error, stackTrace) { 3611 [_addError](error, stackTrace) {
3482 if (this._isClosed) 3612 if (this[_isClosed])
3483 return; 3613 return;
3484 super._addError(error, stackTrace); 3614 super._addError(error, stackTrace);
3485 } 3615 }
3486 _onPause() { 3616 [_onPause]() {
3487 if (this._subscription === null) 3617 if (this[_subscription] === null)
3488 return; 3618 return;
3489 this._subscription.pause(); 3619 this[_subscription].pause();
3490 } 3620 }
3491 _onResume() { 3621 [_onResume]() {
3492 if (this._subscription === null) 3622 if (this[_subscription] === null)
3493 return; 3623 return;
3494 this._subscription.resume(); 3624 this[_subscription].resume();
3495 } 3625 }
3496 _onCancel() { 3626 [_onCancel]() {
3497 if (this._subscription !== null) { 3627 if (this[_subscription] !== null) {
3498 let subscription = this._subscription; 3628 let subscription = this[_subscription];
3499 this._subscription = null; 3629 this[_subscription] = null;
3500 subscription.cancel(); 3630 subscription.cancel();
3501 } 3631 }
3502 return null; 3632 return null;
3503 } 3633 }
3504 _handleData(data) { 3634 [_handleData](data) {
3505 this._stream._handleData(data, this); 3635 this[_stream]._handleData(data, this);
3506 } 3636 }
3507 _handleError(error, stackTrace) { 3637 [_handleError](error, stackTrace) {
3508 this._stream._handleError(error, stackTrace, this); 3638 this[_stream]._handleError(error, stackTrace, this);
3509 } 3639 }
3510 _handleDone() { 3640 [_handleDone]() {
3511 this._stream._handleDone(this); 3641 this[_stream]._handleDone(this);
3512 } 3642 }
3513 } 3643 }
3514 return _ForwardingStreamSubscription; 3644 return _ForwardingStreamSubscription;
3515 }); 3645 });
3516 let _ForwardingStreamSubscription = _ForwardingStreamSubscription$(dynamic, dy namic); 3646 let _ForwardingStreamSubscription = _ForwardingStreamSubscription$(dynamic, dy namic);
3517 // Function _addErrorWithReplacement: (_EventSink<dynamic>, dynamic, dynamic) → void 3647 // Function _addErrorWithReplacement: (_EventSink<dynamic>, dynamic, dynamic) → void
3518 function _addErrorWithReplacement(sink, error, stackTrace) { 3648 function _addErrorWithReplacement(sink, error, stackTrace) {
3519 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core .StackTrace)); 3649 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core .StackTrace));
3520 if (replacement !== null) { 3650 if (replacement !== null) {
3521 error = _nonNullError(replacement.error); 3651 error = _nonNullError(replacement.error);
3522 stackTrace = replacement.stackTrace; 3652 stackTrace = replacement.stackTrace;
3523 } 3653 }
3524 sink._addError(error, dart.as(stackTrace, core.StackTrace)); 3654 sink._addError(error, dart.as(stackTrace, core.StackTrace));
3525 } 3655 }
3656 let _test = Symbol('_test');
3526 let _WhereStream$ = dart.generic(function(T) { 3657 let _WhereStream$ = dart.generic(function(T) {
3527 class _WhereStream extends _ForwardingStream$(T, T) { 3658 class _WhereStream extends _ForwardingStream$(T, T) {
3528 _WhereStream(source, test) { 3659 _WhereStream(source, test) {
3529 this._test = test; 3660 this[_test] = test;
3530 super._ForwardingStream(source); 3661 super._ForwardingStream(source);
3531 } 3662 }
3532 _handleData(inputEvent, sink) { 3663 [_handleData](inputEvent, sink) {
3533 let satisfies = null; 3664 let satisfies = null;
3534 try { 3665 try {
3535 satisfies = this._test(inputEvent); 3666 satisfies = this[_test](inputEvent);
3536 } catch (e) { 3667 } catch (e) {
3537 let s = dart.stackTrace(e); 3668 let s = dart.stackTrace(e);
3538 _addErrorWithReplacement(sink, e, s); 3669 _addErrorWithReplacement(sink, e, s);
3539 return; 3670 return;
3540 } 3671 }
3541 3672
3542 if (satisfies) { 3673 if (satisfies) {
3543 sink._add(inputEvent); 3674 sink._add(inputEvent);
3544 } 3675 }
3545 } 3676 }
3546 } 3677 }
3547 return _WhereStream; 3678 return _WhereStream;
3548 }); 3679 });
3549 let _WhereStream = _WhereStream$(dynamic); 3680 let _WhereStream = _WhereStream$(dynamic);
3681 let _transform = Symbol('_transform');
3550 let _MapStream$ = dart.generic(function(S, T) { 3682 let _MapStream$ = dart.generic(function(S, T) {
3551 class _MapStream extends _ForwardingStream$(S, T) { 3683 class _MapStream extends _ForwardingStream$(S, T) {
3552 _MapStream(source, transform) { 3684 _MapStream(source, transform) {
3553 this._transform = dart.as(transform, _Transformation); 3685 this[_transform] = dart.as(transform, _Transformation);
3554 super._ForwardingStream(source); 3686 super._ForwardingStream(source);
3555 } 3687 }
3556 _handleData(inputEvent, sink) { 3688 [_handleData](inputEvent, sink) {
3557 let outputEvent = null; 3689 let outputEvent = null;
3558 try { 3690 try {
3559 outputEvent = dart.as(this._transform(inputEvent), T); 3691 outputEvent = dart.as(this[_transform](inputEvent), T);
3560 } catch (e) { 3692 } catch (e) {
3561 let s = dart.stackTrace(e); 3693 let s = dart.stackTrace(e);
3562 _addErrorWithReplacement(sink, e, s); 3694 _addErrorWithReplacement(sink, e, s);
3563 return; 3695 return;
3564 } 3696 }
3565 3697
3566 sink._add(outputEvent); 3698 sink._add(outputEvent);
3567 } 3699 }
3568 } 3700 }
3569 return _MapStream; 3701 return _MapStream;
3570 }); 3702 });
3571 let _MapStream = _MapStream$(dynamic, dynamic); 3703 let _MapStream = _MapStream$(dynamic, dynamic);
3704 let _expand = Symbol('_expand');
3572 let _ExpandStream$ = dart.generic(function(S, T) { 3705 let _ExpandStream$ = dart.generic(function(S, T) {
3573 class _ExpandStream extends _ForwardingStream$(S, T) { 3706 class _ExpandStream extends _ForwardingStream$(S, T) {
3574 _ExpandStream(source, expand) { 3707 _ExpandStream(source, expand) {
3575 this._expand = expand; 3708 this[_expand] = expand;
3576 super._ForwardingStream(source); 3709 super._ForwardingStream(source);
3577 } 3710 }
3578 _handleData(inputEvent, sink) { 3711 [_handleData](inputEvent, sink) {
3579 try { 3712 try {
3580 for (let value of this._expand(inputEvent)) { 3713 for (let value of this[_expand](inputEvent)) {
3581 sink._add(value); 3714 sink._add(value);
3582 } 3715 }
3583 } catch (e) { 3716 } catch (e) {
3584 let s = dart.stackTrace(e); 3717 let s = dart.stackTrace(e);
3585 _addErrorWithReplacement(sink, e, s); 3718 _addErrorWithReplacement(sink, e, s);
3586 } 3719 }
3587 3720
3588 } 3721 }
3589 } 3722 }
3590 return _ExpandStream; 3723 return _ExpandStream;
3591 }); 3724 });
3592 let _ExpandStream = _ExpandStream$(dynamic, dynamic); 3725 let _ExpandStream = _ExpandStream$(dynamic, dynamic);
3593 let _HandleErrorStream$ = dart.generic(function(T) { 3726 let _HandleErrorStream$ = dart.generic(function(T) {
3594 class _HandleErrorStream extends _ForwardingStream$(T, T) { 3727 class _HandleErrorStream extends _ForwardingStream$(T, T) {
3595 _HandleErrorStream(source, onError, test) { 3728 _HandleErrorStream(source, onError, test) {
3596 this._transform = onError; 3729 this[_transform] = onError;
3597 this._test = test; 3730 this[_test] = test;
3598 super._ForwardingStream(source); 3731 super._ForwardingStream(source);
3599 } 3732 }
3600 _handleError(error, stackTrace, sink) { 3733 [_handleError](error, stackTrace, sink) {
3601 let matches = true; 3734 let matches = true;
3602 if (this._test !== null) { 3735 if (this[_test] !== null) {
3603 try { 3736 try {
3604 matches = this._test(error); 3737 matches = this[_test](error);
3605 } catch (e) { 3738 } catch (e) {
3606 let s = dart.stackTrace(e); 3739 let s = dart.stackTrace(e);
3607 _addErrorWithReplacement(sink, e, s); 3740 _addErrorWithReplacement(sink, e, s);
3608 return; 3741 return;
3609 } 3742 }
3610 3743
3611 } 3744 }
3612 if (matches) { 3745 if (matches) {
3613 try { 3746 try {
3614 _invokeErrorHandler(this._transform, error, stackTrace); 3747 _invokeErrorHandler(this[_transform], error, stackTrace);
3615 } catch (e) { 3748 } catch (e) {
3616 let s = dart.stackTrace(e); 3749 let s = dart.stackTrace(e);
3617 if (core.identical(e, error)) { 3750 if (core.identical(e, error)) {
3618 sink._addError(error, stackTrace); 3751 sink._addError(error, stackTrace);
3619 } else { 3752 } else {
3620 _addErrorWithReplacement(sink, e, s); 3753 _addErrorWithReplacement(sink, e, s);
3621 } 3754 }
3622 return; 3755 return;
3623 } 3756 }
3624 3757
3625 } else { 3758 } else {
3626 sink._addError(error, stackTrace); 3759 sink._addError(error, stackTrace);
3627 } 3760 }
3628 } 3761 }
3629 } 3762 }
3630 return _HandleErrorStream; 3763 return _HandleErrorStream;
3631 }); 3764 });
3632 let _HandleErrorStream = _HandleErrorStream$(dynamic); 3765 let _HandleErrorStream = _HandleErrorStream$(dynamic);
3766 let _remaining = Symbol('_remaining');
3633 let _TakeStream$ = dart.generic(function(T) { 3767 let _TakeStream$ = dart.generic(function(T) {
3634 class _TakeStream extends _ForwardingStream$(T, T) { 3768 class _TakeStream extends _ForwardingStream$(T, T) {
3635 _TakeStream(source, count) { 3769 _TakeStream(source, count) {
3636 this._remaining = count; 3770 this[_remaining] = count;
3637 super._ForwardingStream(source); 3771 super._ForwardingStream(source);
3638 if (!(typeof count == number)) 3772 if (!(typeof count == number))
3639 throw new core.ArgumentError(count); 3773 throw new core.ArgumentError(count);
3640 } 3774 }
3641 _handleData(inputEvent, sink) { 3775 [_handleData](inputEvent, sink) {
3642 if (this._remaining > 0) { 3776 if (this[_remaining] > 0) {
3643 sink._add(inputEvent); 3777 sink._add(inputEvent);
3644 this._remaining = 1; 3778 this[_remaining] = 1;
3645 if (this._remaining === 0) { 3779 if (this[_remaining] === 0) {
3646 sink._close(); 3780 sink._close();
3647 } 3781 }
3648 } 3782 }
3649 } 3783 }
3650 } 3784 }
3651 return _TakeStream; 3785 return _TakeStream;
3652 }); 3786 });
3653 let _TakeStream = _TakeStream$(dynamic); 3787 let _TakeStream = _TakeStream$(dynamic);
3654 let _TakeWhileStream$ = dart.generic(function(T) { 3788 let _TakeWhileStream$ = dart.generic(function(T) {
3655 class _TakeWhileStream extends _ForwardingStream$(T, T) { 3789 class _TakeWhileStream extends _ForwardingStream$(T, T) {
3656 _TakeWhileStream(source, test) { 3790 _TakeWhileStream(source, test) {
3657 this._test = test; 3791 this[_test] = test;
3658 super._ForwardingStream(source); 3792 super._ForwardingStream(source);
3659 } 3793 }
3660 _handleData(inputEvent, sink) { 3794 [_handleData](inputEvent, sink) {
3661 let satisfies = null; 3795 let satisfies = null;
3662 try { 3796 try {
3663 satisfies = this._test(inputEvent); 3797 satisfies = this[_test](inputEvent);
3664 } catch (e) { 3798 } catch (e) {
3665 let s = dart.stackTrace(e); 3799 let s = dart.stackTrace(e);
3666 _addErrorWithReplacement(sink, e, s); 3800 _addErrorWithReplacement(sink, e, s);
3667 sink._close(); 3801 sink._close();
3668 return; 3802 return;
3669 } 3803 }
3670 3804
3671 if (satisfies) { 3805 if (satisfies) {
3672 sink._add(inputEvent); 3806 sink._add(inputEvent);
3673 } else { 3807 } else {
3674 sink._close(); 3808 sink._close();
3675 } 3809 }
3676 } 3810 }
3677 } 3811 }
3678 return _TakeWhileStream; 3812 return _TakeWhileStream;
3679 }); 3813 });
3680 let _TakeWhileStream = _TakeWhileStream$(dynamic); 3814 let _TakeWhileStream = _TakeWhileStream$(dynamic);
3681 let _SkipStream$ = dart.generic(function(T) { 3815 let _SkipStream$ = dart.generic(function(T) {
3682 class _SkipStream extends _ForwardingStream$(T, T) { 3816 class _SkipStream extends _ForwardingStream$(T, T) {
3683 _SkipStream(source, count) { 3817 _SkipStream(source, count) {
3684 this._remaining = count; 3818 this[_remaining] = count;
3685 super._ForwardingStream(source); 3819 super._ForwardingStream(source);
3686 if (dart.notNull(!(typeof count == number)) || dart.notNull(count < 0)) 3820 if (dart.notNull(!(typeof count == number)) || dart.notNull(count < 0))
3687 throw new core.ArgumentError(count); 3821 throw new core.ArgumentError(count);
3688 } 3822 }
3689 _handleData(inputEvent, sink) { 3823 [_handleData](inputEvent, sink) {
3690 if (this._remaining > 0) { 3824 if (this[_remaining] > 0) {
3691 this._remaining--; 3825 this[_remaining]--;
3692 return; 3826 return;
3693 } 3827 }
3694 sink._add(inputEvent); 3828 sink._add(inputEvent);
3695 } 3829 }
3696 } 3830 }
3697 return _SkipStream; 3831 return _SkipStream;
3698 }); 3832 });
3699 let _SkipStream = _SkipStream$(dynamic); 3833 let _SkipStream = _SkipStream$(dynamic);
3834 let _hasFailed = Symbol('_hasFailed');
3700 let _SkipWhileStream$ = dart.generic(function(T) { 3835 let _SkipWhileStream$ = dart.generic(function(T) {
3701 class _SkipWhileStream extends _ForwardingStream$(T, T) { 3836 class _SkipWhileStream extends _ForwardingStream$(T, T) {
3702 _SkipWhileStream(source, test) { 3837 _SkipWhileStream(source, test) {
3703 this._test = test; 3838 this[_test] = test;
3704 this._hasFailed = false; 3839 this[_hasFailed] = false;
3705 super._ForwardingStream(source); 3840 super._ForwardingStream(source);
3706 } 3841 }
3707 _handleData(inputEvent, sink) { 3842 [_handleData](inputEvent, sink) {
3708 if (this._hasFailed) { 3843 if (this[_hasFailed]) {
3709 sink._add(inputEvent); 3844 sink._add(inputEvent);
3710 return; 3845 return;
3711 } 3846 }
3712 let satisfies = null; 3847 let satisfies = null;
3713 try { 3848 try {
3714 satisfies = this._test(inputEvent); 3849 satisfies = this[_test](inputEvent);
3715 } catch (e) { 3850 } catch (e) {
3716 let s = dart.stackTrace(e); 3851 let s = dart.stackTrace(e);
3717 _addErrorWithReplacement(sink, e, s); 3852 _addErrorWithReplacement(sink, e, s);
3718 this._hasFailed = true; 3853 this[_hasFailed] = true;
3719 return; 3854 return;
3720 } 3855 }
3721 3856
3722 if (!dart.notNull(satisfies)) { 3857 if (!dart.notNull(satisfies)) {
3723 this._hasFailed = true; 3858 this[_hasFailed] = true;
3724 sink._add(inputEvent); 3859 sink._add(inputEvent);
3725 } 3860 }
3726 } 3861 }
3727 } 3862 }
3728 return _SkipWhileStream; 3863 return _SkipWhileStream;
3729 }); 3864 });
3730 let _SkipWhileStream = _SkipWhileStream$(dynamic); 3865 let _SkipWhileStream = _SkipWhileStream$(dynamic);
3866 let _equals = Symbol('_equals');
3731 let _DistinctStream$ = dart.generic(function(T) { 3867 let _DistinctStream$ = dart.generic(function(T) {
3732 class _DistinctStream extends _ForwardingStream$(T, T) { 3868 class _DistinctStream extends _ForwardingStream$(T, T) {
3733 _DistinctStream(source, equals) { 3869 _DistinctStream(source, equals) {
3734 this._previous = _SENTINEL; 3870 this[_previous] = _SENTINEL;
3735 this._equals = equals; 3871 this[_equals] = equals;
3736 super._ForwardingStream(source); 3872 super._ForwardingStream(source);
3737 } 3873 }
3738 _handleData(inputEvent, sink) { 3874 [_handleData](inputEvent, sink) {
3739 if (core.identical(this._previous, _SENTINEL)) { 3875 if (core.identical(this[_previous], _SENTINEL)) {
3740 this._previous = inputEvent; 3876 this[_previous] = inputEvent;
3741 return sink._add(inputEvent); 3877 return sink._add(inputEvent);
3742 } else { 3878 } else {
3743 let isEqual = null; 3879 let isEqual = null;
3744 try { 3880 try {
3745 if (this._equals === null) { 3881 if (this[_equals] === null) {
3746 isEqual = dart.equals(this._previous, inputEvent); 3882 isEqual = dart.equals(this[_previous], inputEvent);
3747 } else { 3883 } else {
3748 isEqual = this._equals(dart.as(this._previous, T), inputEvent); 3884 isEqual = this[_equals](dart.as(this[_previous], T), inputEvent);
3749 } 3885 }
3750 } catch (e) { 3886 } catch (e) {
3751 let s = dart.stackTrace(e); 3887 let s = dart.stackTrace(e);
3752 _addErrorWithReplacement(sink, e, s); 3888 _addErrorWithReplacement(sink, e, s);
3753 return null; 3889 return null;
3754 } 3890 }
3755 3891
3756 if (!dart.notNull(isEqual)) { 3892 if (!dart.notNull(isEqual)) {
3757 sink._add(inputEvent); 3893 sink._add(inputEvent);
3758 this._previous = inputEvent; 3894 this[_previous] = inputEvent;
3759 } 3895 }
3760 } 3896 }
3761 } 3897 }
3762 } 3898 }
3763 dart.defineLazyProperties(_DistinctStream, { 3899 dart.defineLazyProperties(_DistinctStream, {
3764 get _SENTINEL() { 3900 get _SENTINEL() {
3765 return new core.Object(); 3901 return new core.Object();
3766 }, 3902 },
3767 set _SENTINEL() {} 3903 set _SENTINEL() {}
3768 }); 3904 });
3769 return _DistinctStream; 3905 return _DistinctStream;
3770 }); 3906 });
3771 let _DistinctStream = _DistinctStream$(dynamic); 3907 let _DistinctStream = _DistinctStream$(dynamic);
3772 let _EventSinkWrapper$ = dart.generic(function(T) { 3908 let _EventSinkWrapper$ = dart.generic(function(T) {
3773 class _EventSinkWrapper extends dart.Object { 3909 class _EventSinkWrapper extends dart.Object {
3774 _EventSinkWrapper(_sink) { 3910 _EventSinkWrapper($_sink) {
3775 this._sink = _sink; 3911 this[_sink] = $_sink;
3776 } 3912 }
3777 add(data) { 3913 add(data) {
3778 this._sink._add(data); 3914 this[_sink]._add(data);
3779 } 3915 }
3780 addError(error, stackTrace) { 3916 addError(error, stackTrace) {
3781 if (stackTrace === void 0) 3917 if (stackTrace === void 0)
3782 stackTrace = null; 3918 stackTrace = null;
3783 this._sink._addError(error, stackTrace); 3919 this[_sink]._addError(error, stackTrace);
3784 } 3920 }
3785 close() { 3921 close() {
3786 this._sink._close(); 3922 this[_sink]._close();
3787 } 3923 }
3788 } 3924 }
3789 return _EventSinkWrapper; 3925 return _EventSinkWrapper;
3790 }); 3926 });
3791 let _EventSinkWrapper = _EventSinkWrapper$(dynamic); 3927 let _EventSinkWrapper = _EventSinkWrapper$(dynamic);
3928 let _transformerSink = Symbol('_transformerSink');
3929 let _isSubscribed = Symbol('_isSubscribed');
3792 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) { 3930 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) {
3793 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio n$(T) { 3931 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio n$(T) {
3794 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone , cancelOnError) { 3932 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone , cancelOnError) {
3795 this._transformerSink = null; 3933 this[_transformerSink] = null;
3796 this._subscription = null; 3934 this[_subscription] = null;
3797 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 3935 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
3798 let eventSink = new _EventSinkWrapper(this); 3936 let eventSink = new _EventSinkWrapper(this);
3799 this._transformerSink = mapper(eventSink); 3937 this[_transformerSink] = mapper(eventSink);
3800 this._subscription = source.listen(this._handleData, {onError: this._han dleError, onDone: this._handleDone}); 3938 this[_subscription] = source.listen(this[_handleData], {onError: this[_h andleError], onDone: this[_handleDone]});
3801 } 3939 }
3802 get _isSubscribed() { 3940 get [_isSubscribed]() {
3803 return this._subscription !== null; 3941 return this[_subscription] !== null;
3804 } 3942 }
3805 _add(data) { 3943 [_add](data) {
3806 if (this._isClosed) { 3944 if (this[_isClosed]) {
3807 throw new core.StateError("Stream is already closed"); 3945 throw new core.StateError("Stream is already closed");
3808 } 3946 }
3809 super._add(data); 3947 super._add(data);
3810 } 3948 }
3811 _addError(error, stackTrace) { 3949 [_addError](error, stackTrace) {
3812 if (this._isClosed) { 3950 if (this[_isClosed]) {
3813 throw new core.StateError("Stream is already closed"); 3951 throw new core.StateError("Stream is already closed");
3814 } 3952 }
3815 super._addError(error, stackTrace); 3953 super._addError(error, stackTrace);
3816 } 3954 }
3817 _close() { 3955 [_close]() {
3818 if (this._isClosed) { 3956 if (this[_isClosed]) {
3819 throw new core.StateError("Stream is already closed"); 3957 throw new core.StateError("Stream is already closed");
3820 } 3958 }
3821 super._close(); 3959 super._close();
3822 } 3960 }
3823 _onPause() { 3961 [_onPause]() {
3824 if (this._isSubscribed) 3962 if (this[_isSubscribed])
3825 this._subscription.pause(); 3963 this[_subscription].pause();
3826 } 3964 }
3827 _onResume() { 3965 [_onResume]() {
3828 if (this._isSubscribed) 3966 if (this[_isSubscribed])
3829 this._subscription.resume(); 3967 this[_subscription].resume();
3830 } 3968 }
3831 _onCancel() { 3969 [_onCancel]() {
3832 if (this._isSubscribed) { 3970 if (this[_isSubscribed]) {
3833 let subscription = this._subscription; 3971 let subscription = this[_subscription];
3834 this._subscription = null; 3972 this[_subscription] = null;
3835 subscription.cancel(); 3973 subscription.cancel();
3836 } 3974 }
3837 return null; 3975 return null;
3838 } 3976 }
3839 _handleData(data) { 3977 [_handleData](data) {
3840 try { 3978 try {
3841 this._transformerSink.add(data); 3979 this[_transformerSink].add(data);
3842 } catch (e) { 3980 } catch (e) {
3843 let s = dart.stackTrace(e); 3981 let s = dart.stackTrace(e);
3844 this._addError(e, s); 3982 this[_addError](e, s);
3845 } 3983 }
3846 3984
3847 } 3985 }
3848 _handleError(error, stackTrace) { 3986 [_handleError](error, stackTrace) {
3849 if (stackTrace === void 0) 3987 if (stackTrace === void 0)
3850 stackTrace = null; 3988 stackTrace = null;
3851 try { 3989 try {
3852 this._transformerSink.addError(error, dart.as(stackTrace, core.StackTr ace)); 3990 this[_transformerSink].addError(error, dart.as(stackTrace, core.StackT race));
3853 } catch (e) { 3991 } catch (e) {
3854 let s = dart.stackTrace(e); 3992 let s = dart.stackTrace(e);
3855 if (core.identical(e, error)) { 3993 if (core.identical(e, error)) {
3856 this._addError(error, dart.as(stackTrace, core.StackTrace)); 3994 this[_addError](error, dart.as(stackTrace, core.StackTrace));
3857 } else { 3995 } else {
3858 this._addError(e, s); 3996 this[_addError](e, s);
3859 } 3997 }
3860 } 3998 }
3861 3999
3862 } 4000 }
3863 _handleDone() { 4001 [_handleDone]() {
3864 try { 4002 try {
3865 this._subscription = null; 4003 this[_subscription] = null;
3866 this._transformerSink.close(); 4004 this[_transformerSink].close();
3867 } catch (e) { 4005 } catch (e) {
3868 let s = dart.stackTrace(e); 4006 let s = dart.stackTrace(e);
3869 this._addError(e, s); 4007 this[_addError](e, s);
3870 } 4008 }
3871 4009
3872 } 4010 }
3873 } 4011 }
3874 return _SinkTransformerStreamSubscription; 4012 return _SinkTransformerStreamSubscription;
3875 }); 4013 });
3876 let _SinkTransformerStreamSubscription = _SinkTransformerStreamSubscription$(d ynamic, dynamic); 4014 let _SinkTransformerStreamSubscription = _SinkTransformerStreamSubscription$(d ynamic, dynamic);
4015 let _sinkMapper = Symbol('_sinkMapper');
3877 let _StreamSinkTransformer$ = dart.generic(function(S, T) { 4016 let _StreamSinkTransformer$ = dart.generic(function(S, T) {
3878 class _StreamSinkTransformer extends dart.Object { 4017 class _StreamSinkTransformer extends dart.Object {
3879 _StreamSinkTransformer(_sinkMapper) { 4018 _StreamSinkTransformer($_sinkMapper) {
3880 this._sinkMapper = _sinkMapper; 4019 this[_sinkMapper] = $_sinkMapper;
3881 } 4020 }
3882 bind(stream) { 4021 bind(stream) {
3883 return new _BoundSinkStream(stream, this._sinkMapper); 4022 return new _BoundSinkStream(stream, this[_sinkMapper]);
3884 } 4023 }
3885 } 4024 }
3886 return _StreamSinkTransformer; 4025 return _StreamSinkTransformer;
3887 }); 4026 });
3888 let _StreamSinkTransformer = _StreamSinkTransformer$(dynamic, dynamic); 4027 let _StreamSinkTransformer = _StreamSinkTransformer$(dynamic, dynamic);
3889 let _BoundSinkStream$ = dart.generic(function(S, T) { 4028 let _BoundSinkStream$ = dart.generic(function(S, T) {
3890 class _BoundSinkStream extends Stream$(T) { 4029 class _BoundSinkStream extends Stream$(T) {
3891 get isBroadcast() { 4030 get isBroadcast() {
3892 return this._stream.isBroadcast; 4031 return this[_stream].isBroadcast;
3893 } 4032 }
3894 _BoundSinkStream(_stream, _sinkMapper) { 4033 _BoundSinkStream($_stream, $_sinkMapper) {
3895 this._stream = _stream; 4034 this[_stream] = $_stream;
3896 this._sinkMapper = _sinkMapper; 4035 this[_sinkMapper] = $_sinkMapper;
3897 super.Stream(); 4036 super.Stream();
3898 } 4037 }
3899 listen(onData, opt$) { 4038 listen(onData, opt$) {
3900 let onError = opt$.onError === void 0 ? null : opt$.onError; 4039 let onError = opt$.onError === void 0 ? null : opt$.onError;
3901 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; 4040 let onDone = opt$.onDone === void 0 ? null : opt$.onDone;
3902 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error; 4041 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error;
3903 cancelOnError = core.identical(true, cancelOnError); 4042 cancelOnError = core.identical(true, cancelOnError);
3904 let subscription = dart.as(new _SinkTransformerStreamSubscription(this._ stream, dart.as(this._sinkMapper, _SinkMapper), dart.as(onData, dart.throw_("Uni mplemented type (dynamic) → void")), onError, onDone, cancelOnError), StreamSubs cription$(T)); 4043 let subscription = dart.as(new _SinkTransformerStreamSubscription(this[_ stream], dart.as(this[_sinkMapper], _SinkMapper), dart.as(onData, dart.throw_("U nimplemented type (dynamic) → void")), onError, onDone, cancelOnError), StreamSu bscription$(T));
3905 return subscription; 4044 return subscription;
3906 } 4045 }
3907 } 4046 }
3908 return _BoundSinkStream; 4047 return _BoundSinkStream;
3909 }); 4048 });
3910 let _BoundSinkStream = _BoundSinkStream$(dynamic, dynamic); 4049 let _BoundSinkStream = _BoundSinkStream$(dynamic, dynamic);
3911 let _HandlerEventSink$ = dart.generic(function(S, T) { 4050 let _HandlerEventSink$ = dart.generic(function(S, T) {
3912 class _HandlerEventSink extends dart.Object { 4051 class _HandlerEventSink extends dart.Object {
3913 _HandlerEventSink(_handleData, _handleError, _handleDone, _sink) { 4052 _HandlerEventSink($_handleData, $_handleError, $_handleDone, $_sink) {
3914 this._handleData = _handleData; 4053 this[_handleData] = $_handleData;
3915 this._handleError = _handleError; 4054 this[_handleError] = $_handleError;
3916 this._handleDone = _handleDone; 4055 this[_handleDone] = $_handleDone;
3917 this._sink = _sink; 4056 this[_sink] = $_sink;
3918 } 4057 }
3919 add(data) { 4058 add(data) {
3920 return this._handleData(data, this._sink); 4059 return this[_handleData](data, this[_sink]);
3921 } 4060 }
3922 addError(error, stackTrace) { 4061 addError(error, stackTrace) {
3923 if (stackTrace === void 0) 4062 if (stackTrace === void 0)
3924 stackTrace = null; 4063 stackTrace = null;
3925 return this._handleError(error, stackTrace, this._sink); 4064 return this[_handleError](error, stackTrace, this[_sink]);
3926 } 4065 }
3927 close() { 4066 close() {
3928 return this._handleDone(this._sink); 4067 return this[_handleDone](this[_sink]);
3929 } 4068 }
3930 } 4069 }
3931 return _HandlerEventSink; 4070 return _HandlerEventSink;
3932 }); 4071 });
3933 let _HandlerEventSink = _HandlerEventSink$(dynamic, dynamic); 4072 let _HandlerEventSink = _HandlerEventSink$(dynamic, dynamic);
4073 let _defaultHandleData = Symbol('_defaultHandleData');
4074 let _defaultHandleError = Symbol('_defaultHandleError');
4075 let _defaultHandleDone = Symbol('_defaultHandleDone');
3934 let _StreamHandlerTransformer$ = dart.generic(function(S, T) { 4076 let _StreamHandlerTransformer$ = dart.generic(function(S, T) {
3935 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) { 4077 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) {
3936 _StreamHandlerTransformer(opt$) { 4078 _StreamHandlerTransformer(opt$) {
3937 let handleData = opt$.handleData === void 0 ? null : opt$.handleData; 4079 let handleData = opt$.handleData === void 0 ? null : opt$.handleData;
3938 let handleError = opt$.handleError === void 0 ? null : opt$.handleError; 4080 let handleError = opt$.handleError === void 0 ? null : opt$.handleError;
3939 let handleDone = opt$.handleDone === void 0 ? null : opt$.handleDone; 4081 let handleDone = opt$.handleDone === void 0 ? null : opt$.handleDone;
3940 super._StreamSinkTransformer(dart.as((outputSink) => { 4082 super._StreamSinkTransformer(dart.as((outputSink) => {
3941 if (handleData === null) 4083 if (handleData === null)
3942 handleData = _defaultHandleData; 4084 handleData = _defaultHandleData;
3943 if (handleError === null) 4085 if (handleError === null)
3944 handleError = _defaultHandleError; 4086 handleError = _defaultHandleError;
3945 if (handleDone === null) 4087 if (handleDone === null)
3946 handleDone = _defaultHandleDone; 4088 handleDone = _defaultHandleDone;
3947 return new _HandlerEventSink(handleData, handleError, handleDone, outp utSink); 4089 return new _HandlerEventSink(handleData, handleError, handleDone, outp utSink);
3948 }, _SinkMapper)); 4090 }, _SinkMapper));
3949 } 4091 }
3950 bind(stream) { 4092 bind(stream) {
3951 return super.bind(stream); 4093 return super.bind(stream);
3952 } 4094 }
3953 static _defaultHandleData(data, sink) { 4095 static [_defaultHandleData](data, sink) {
3954 sink.add(data); 4096 sink.add(data);
3955 } 4097 }
3956 static _defaultHandleError(error, stackTrace, sink) { 4098 static [_defaultHandleError](error, stackTrace, sink) {
3957 sink.addError(error); 4099 sink.addError(error);
3958 } 4100 }
3959 static _defaultHandleDone(sink) { 4101 static [_defaultHandleDone](sink) {
3960 sink.close(); 4102 sink.close();
3961 } 4103 }
3962 } 4104 }
3963 return _StreamHandlerTransformer; 4105 return _StreamHandlerTransformer;
3964 }); 4106 });
3965 let _StreamHandlerTransformer = _StreamHandlerTransformer$(dynamic, dynamic); 4107 let _StreamHandlerTransformer = _StreamHandlerTransformer$(dynamic, dynamic);
4108 let _transformer = Symbol('_transformer');
3966 let _StreamSubscriptionTransformer$ = dart.generic(function(S, T) { 4109 let _StreamSubscriptionTransformer$ = dart.generic(function(S, T) {
3967 class _StreamSubscriptionTransformer extends dart.Object { 4110 class _StreamSubscriptionTransformer extends dart.Object {
3968 _StreamSubscriptionTransformer(_transformer) { 4111 _StreamSubscriptionTransformer($_transformer) {
3969 this._transformer = _transformer; 4112 this[_transformer] = $_transformer;
3970 } 4113 }
3971 bind(stream) { 4114 bind(stream) {
3972 return new _BoundSubscriptionStream(stream, this._transformer); 4115 return new _BoundSubscriptionStream(stream, this[_transformer]);
3973 } 4116 }
3974 } 4117 }
3975 return _StreamSubscriptionTransformer; 4118 return _StreamSubscriptionTransformer;
3976 }); 4119 });
3977 let _StreamSubscriptionTransformer = _StreamSubscriptionTransformer$(dynamic, dynamic); 4120 let _StreamSubscriptionTransformer = _StreamSubscriptionTransformer$(dynamic, dynamic);
3978 let _BoundSubscriptionStream$ = dart.generic(function(S, T) { 4121 let _BoundSubscriptionStream$ = dart.generic(function(S, T) {
3979 class _BoundSubscriptionStream extends Stream$(T) { 4122 class _BoundSubscriptionStream extends Stream$(T) {
3980 _BoundSubscriptionStream(_stream, _transformer) { 4123 _BoundSubscriptionStream($_stream, $_transformer) {
3981 this._stream = _stream; 4124 this[_stream] = $_stream;
3982 this._transformer = _transformer; 4125 this[_transformer] = $_transformer;
3983 super.Stream(); 4126 super.Stream();
3984 } 4127 }
3985 listen(onData, opt$) { 4128 listen(onData, opt$) {
3986 let onError = opt$.onError === void 0 ? null : opt$.onError; 4129 let onError = opt$.onError === void 0 ? null : opt$.onError;
3987 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; 4130 let onDone = opt$.onDone === void 0 ? null : opt$.onDone;
3988 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error; 4131 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOn Error;
3989 cancelOnError = core.identical(true, cancelOnError); 4132 cancelOnError = core.identical(true, cancelOnError);
3990 let result = this._transformer(this._stream, cancelOnError); 4133 let result = this[_transformer](this[_stream], cancelOnError);
3991 result.onData(onData); 4134 result.onData(onData);
3992 result.onError(onError); 4135 result.onError(onError);
3993 result.onDone(onDone); 4136 result.onDone(onDone);
3994 return result; 4137 return result;
3995 } 4138 }
3996 } 4139 }
3997 return _BoundSubscriptionStream; 4140 return _BoundSubscriptionStream;
3998 }); 4141 });
3999 let _BoundSubscriptionStream = _BoundSubscriptionStream$(dynamic, dynamic); 4142 let _BoundSubscriptionStream = _BoundSubscriptionStream$(dynamic, dynamic);
4143 let _createTimer = Symbol('_createTimer');
4144 let _createPeriodicTimer = Symbol('_createPeriodicTimer');
4000 class Timer extends dart.Object { 4145 class Timer extends dart.Object {
4001 Timer(duration, callback) { 4146 Timer(duration, callback) {
4002 if (dart.equals(Zone.current, Zone.ROOT)) { 4147 if (dart.equals(Zone.current, Zone.ROOT)) {
4003 return Zone.current.createTimer(duration, callback); 4148 return Zone.current.createTimer(duration, callback);
4004 } 4149 }
4005 return Zone.current.createTimer(duration, Zone.current.bindCallback(callba ck, {runGuarded: true})); 4150 return Zone.current.createTimer(duration, Zone.current.bindCallback(callba ck, {runGuarded: true}));
4006 } 4151 }
4007 Timer$periodic(duration, callback) { 4152 Timer$periodic(duration, callback) {
4008 if (dart.equals(Zone.current, Zone.ROOT)) { 4153 if (dart.equals(Zone.current, Zone.ROOT)) {
4009 return Zone.current.createPeriodicTimer(duration, callback); 4154 return Zone.current.createPeriodicTimer(duration, callback);
4010 } 4155 }
4011 return Zone.current.createPeriodicTimer(duration, Zone.current.bindUnaryCa llback(dart.as(callback, dart.throw_("Unimplemented type (dynamic) → dynamic")), {runGuarded: true})); 4156 return Zone.current.createPeriodicTimer(duration, Zone.current.bindUnaryCa llback(dart.as(callback, dart.throw_("Unimplemented type (dynamic) → dynamic")), {runGuarded: true}));
4012 } 4157 }
4013 static run(callback) { 4158 static run(callback) {
4014 new Timer(core.Duration.ZERO, callback); 4159 new Timer(core.Duration.ZERO, callback);
4015 } 4160 }
4016 static _createTimer(duration, callback) { 4161 static [_createTimer](duration, callback) {
4017 let milliseconds = duration.inMilliseconds; 4162 let milliseconds = duration.inMilliseconds;
4018 if (milliseconds < 0) 4163 if (milliseconds < 0)
4019 milliseconds = 0; 4164 milliseconds = 0;
4020 return new _isolate_helper.TimerImpl(milliseconds, callback); 4165 return new _isolate_helper.TimerImpl(milliseconds, callback);
4021 } 4166 }
4022 static _createPeriodicTimer(duration, callback) { 4167 static [_createPeriodicTimer](duration, callback) {
4023 let milliseconds = duration.inMilliseconds; 4168 let milliseconds = duration.inMilliseconds;
4024 if (milliseconds < 0) 4169 if (milliseconds < 0)
4025 milliseconds = 0; 4170 milliseconds = 0;
4026 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback); 4171 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback);
4027 } 4172 }
4028 } 4173 }
4029 dart.defineNamedConstructor(Timer, 'periodic'); 4174 dart.defineNamedConstructor(Timer, 'periodic');
4030 class AsyncError extends dart.Object { 4175 class AsyncError extends dart.Object {
4031 AsyncError(error, stackTrace) { 4176 AsyncError(error, stackTrace) {
4032 this.error = error; 4177 this.error = error;
4033 this.stackTrace = stackTrace; 4178 this.stackTrace = stackTrace;
4034 } 4179 }
4035 toString() { 4180 toString() {
4036 return dart.as(dart.dinvoke(this.error, 'toString'), core.String); 4181 return dart.as(dart.dinvoke(this.error, 'toString'), core.String);
4037 } 4182 }
4038 } 4183 }
4039 class _ZoneFunction extends dart.Object { 4184 class _ZoneFunction extends dart.Object {
4040 _ZoneFunction(zone, function) { 4185 _ZoneFunction(zone, function) {
4041 this.zone = zone; 4186 this.zone = zone;
4042 this["function"] = function; 4187 this['function'] = function;
4043 } 4188 }
4044 } 4189 }
4045 class ZoneSpecification extends dart.Object { 4190 class ZoneSpecification extends dart.Object {
4046 ZoneSpecification(opt$) { 4191 ZoneSpecification(opt$) {
4047 return new _ZoneSpecification(opt$); 4192 return new _ZoneSpecification(opt$);
4048 } 4193 }
4049 ZoneSpecification$from(other, opt$) { 4194 ZoneSpecification$from(other, opt$) {
4050 let handleUncaughtError = opt$.handleUncaughtError === void 0 ? null : opt $.handleUncaughtError; 4195 let handleUncaughtError = opt$.handleUncaughtError === void 0 ? null : opt $.handleUncaughtError;
4051 let run = opt$.run === void 0 ? null : opt$.run; 4196 let run = opt$.run === void 0 ? null : opt$.run;
4052 let runUnary = opt$.runUnary === void 0 ? null : opt$.runUnary; 4197 let runUnary = opt$.runUnary === void 0 ? null : opt$.runUnary;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4089 this.errorCallback = errorCallback; 4234 this.errorCallback = errorCallback;
4090 this.scheduleMicrotask = scheduleMicrotask; 4235 this.scheduleMicrotask = scheduleMicrotask;
4091 this.createTimer = createTimer; 4236 this.createTimer = createTimer;
4092 this.createPeriodicTimer = createPeriodicTimer; 4237 this.createPeriodicTimer = createPeriodicTimer;
4093 this.print = print; 4238 this.print = print;
4094 this.fork = fork; 4239 this.fork = fork;
4095 } 4240 }
4096 } 4241 }
4097 class ZoneDelegate extends dart.Object { 4242 class ZoneDelegate extends dart.Object {
4098 } 4243 }
4244 let _enter = Symbol('_enter');
4245 let _leave = Symbol('_leave');
4099 class Zone extends dart.Object { 4246 class Zone extends dart.Object {
4100 Zone$_() { 4247 Zone$_() {
4101 } 4248 }
4102 static get current() { 4249 static get current() {
4103 return _current; 4250 return _current;
4104 } 4251 }
4105 static _enter(zone) { 4252 static [_enter](zone) {
4106 dart.assert(zone !== null); 4253 dart.assert(zone !== null);
4107 dart.assert(!dart.notNull(core.identical(zone, _current))); 4254 dart.assert(!dart.notNull(core.identical(zone, _current)));
4108 let previous = _current; 4255 let previous = _current;
4109 _current = zone; 4256 _current = zone;
4110 return previous; 4257 return previous;
4111 } 4258 }
4112 static _leave(previous) { 4259 static [_leave](previous) {
4113 dart.assert(previous !== null); 4260 dart.assert(previous !== null);
4114 Zone._current = previous; 4261 Zone[_current] = previous;
4115 } 4262 }
4116 } 4263 }
4117 dart.defineNamedConstructor(Zone, '_'); 4264 dart.defineNamedConstructor(Zone, '_');
4118 Zone.ROOT = dart.as(_ROOT_ZONE, Zone); 4265 Zone.ROOT = dart.as(_ROOT_ZONE, Zone);
4119 Zone._current = dart.as(_ROOT_ZONE, Zone); 4266 Zone._current = dart.as(_ROOT_ZONE, Zone);
4267 let _delegate = Symbol('_delegate');
4120 // Function _parentDelegate: (_Zone) → ZoneDelegate 4268 // Function _parentDelegate: (_Zone) → ZoneDelegate
4121 function _parentDelegate(zone) { 4269 function _parentDelegate(zone) {
4122 if (zone.parent === null) 4270 if (zone.parent === null)
4123 return null; 4271 return null;
4124 return zone.parent._delegate; 4272 return zone.parent[_delegate];
4125 } 4273 }
4274 let _delegationTarget = Symbol('_delegationTarget');
4275 let _handleUncaughtError = Symbol('_handleUncaughtError');
4276 let _run = Symbol('_run');
4277 let _runUnary = Symbol('_runUnary');
4278 let _runBinary = Symbol('_runBinary');
4279 let _registerCallback = Symbol('_registerCallback');
4280 let _registerUnaryCallback = Symbol('_registerUnaryCallback');
4281 let _registerBinaryCallback = Symbol('_registerBinaryCallback');
4282 let _errorCallback = Symbol('_errorCallback');
4283 let _scheduleMicrotask = Symbol('_scheduleMicrotask');
4284 let _print = Symbol('_print');
4285 let _fork = Symbol('_fork');
4126 class _ZoneDelegate extends dart.Object { 4286 class _ZoneDelegate extends dart.Object {
4127 _ZoneDelegate(_delegationTarget) { 4287 _ZoneDelegate($_delegationTarget) {
4128 this._delegationTarget = _delegationTarget; 4288 this[_delegationTarget] = $_delegationTarget;
4129 } 4289 }
4130 handleUncaughtError(zone, error, stackTrace) { 4290 handleUncaughtError(zone, error, stackTrace) {
4131 let implementation = this._delegationTarget._handleUncaughtError; 4291 let implementation = this[_delegationTarget][_handleUncaughtError];
4132 let implZone = implementation.zone; 4292 let implZone = implementation.zone;
4133 return dart.dinvokef(implementation["function"], implZone, _parentDelegate (implZone), zone, error, stackTrace); 4293 return dart.dinvokef(implementation['function'], implZone, _parentDelegate (implZone), zone, error, stackTrace);
4134 } 4294 }
4135 run(zone, f) { 4295 run(zone, f) {
4136 let implementation = this._delegationTarget._run; 4296 let implementation = this[_delegationTarget][_run];
4137 let implZone = implementation.zone; 4297 let implZone = implementation.zone;
4138 return dart.dinvokef(implementation["function"], implZone, _parentDelegate (implZone), zone, f); 4298 return dart.dinvokef(implementation['function'], implZone, _parentDelegate (implZone), zone, f);
4139 } 4299 }
4140 runUnary(zone, f, arg) { 4300 runUnary(zone, f, arg) {
4141 let implementation = this._delegationTarget._runUnary; 4301 let implementation = this[_delegationTarget][_runUnary];
4142 let implZone = implementation.zone; 4302 let implZone = implementation.zone;
4143 return dart.dinvokef(implementation["function"], implZone, _parentDelegate (implZone), zone, f, arg); 4303 return dart.dinvokef(implementation['function'], implZone, _parentDelegate (implZone), zone, f, arg);
4144 } 4304 }
4145 runBinary(zone, f, arg1, arg2) { 4305 runBinary(zone, f, arg1, arg2) {
4146 let implementation = this._delegationTarget._runBinary; 4306 let implementation = this[_delegationTarget][_runBinary];
4147 let implZone = implementation.zone; 4307 let implZone = implementation.zone;
4148 return dart.dinvokef(implementation["function"], implZone, _parentDelegate (implZone), zone, f, arg1, arg2); 4308 return dart.dinvokef(implementation['function'], implZone, _parentDelegate (implZone), zone, f, arg1, arg2);
4149 } 4309 }
4150 registerCallback(zone, f) { 4310 registerCallback(zone, f) {
4151 let implementation = this._delegationTarget._registerCallback; 4311 let implementation = this[_delegationTarget][_registerCallback];
4152 let implZone = implementation.zone; 4312 let implZone = implementation.zone;
4153 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, f), ZoneCallback); 4313 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, f), ZoneCallback);
4154 } 4314 }
4155 registerUnaryCallback(zone, f) { 4315 registerUnaryCallback(zone, f) {
4156 let implementation = this._delegationTarget._registerUnaryCallback; 4316 let implementation = this[_delegationTarget][_registerUnaryCallback];
4157 let implZone = implementation.zone; 4317 let implZone = implementation.zone;
4158 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, f), ZoneUnaryCallback); 4318 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, f), ZoneUnaryCallback);
4159 } 4319 }
4160 registerBinaryCallback(zone, f) { 4320 registerBinaryCallback(zone, f) {
4161 let implementation = this._delegationTarget._registerBinaryCallback; 4321 let implementation = this[_delegationTarget][_registerBinaryCallback];
4162 let implZone = implementation.zone; 4322 let implZone = implementation.zone;
4163 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, f), ZoneBinaryCallback); 4323 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, f), ZoneBinaryCallback);
4164 } 4324 }
4165 errorCallback(zone, error, stackTrace) { 4325 errorCallback(zone, error, stackTrace) {
4166 let implementation = this._delegationTarget._errorCallback; 4326 let implementation = this[_delegationTarget][_errorCallback];
4167 let implZone = implementation.zone; 4327 let implZone = implementation.zone;
4168 if (core.identical(implZone, _ROOT_ZONE)) 4328 if (core.identical(implZone, _ROOT_ZONE))
4169 return null; 4329 return null;
4170 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, error, stackTrace), AsyncError); 4330 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, error, stackTrace), AsyncError);
4171 } 4331 }
4172 scheduleMicrotask(zone, f) { 4332 scheduleMicrotask(zone, f) {
4173 let implementation = this._delegationTarget._scheduleMicrotask; 4333 let implementation = this[_delegationTarget][_scheduleMicrotask];
4174 let implZone = implementation.zone; 4334 let implZone = implementation.zone;
4175 dart.dinvokef(implementation["function"], implZone, _parentDelegate(implZo ne), zone, f); 4335 dart.dinvokef(implementation['function'], implZone, _parentDelegate(implZo ne), zone, f);
4176 } 4336 }
4177 createTimer(zone, duration, f) { 4337 createTimer(zone, duration, f) {
4178 let implementation = this._delegationTarget._createTimer; 4338 let implementation = this[_delegationTarget][_createTimer];
4179 let implZone = implementation.zone; 4339 let implZone = implementation.zone;
4180 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, duration, f), Timer); 4340 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, duration, f), Timer);
4181 } 4341 }
4182 createPeriodicTimer(zone, period, f) { 4342 createPeriodicTimer(zone, period, f) {
4183 let implementation = this._delegationTarget._createPeriodicTimer; 4343 let implementation = this[_delegationTarget][_createPeriodicTimer];
4184 let implZone = implementation.zone; 4344 let implZone = implementation.zone;
4185 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, period, f), Timer); 4345 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, period, f), Timer);
4186 } 4346 }
4187 print(zone, line) { 4347 print(zone, line) {
4188 let implementation = this._delegationTarget._print; 4348 let implementation = this[_delegationTarget][_print];
4189 let implZone = implementation.zone; 4349 let implZone = implementation.zone;
4190 dart.dinvokef(implementation["function"], implZone, _parentDelegate(implZo ne), zone, line); 4350 dart.dinvokef(implementation['function'], implZone, _parentDelegate(implZo ne), zone, line);
4191 } 4351 }
4192 fork(zone, specification, zoneValues) { 4352 fork(zone, specification, zoneValues) {
4193 let implementation = this._delegationTarget._fork; 4353 let implementation = this[_delegationTarget][_fork];
4194 let implZone = implementation.zone; 4354 let implZone = implementation.zone;
4195 return dart.as(dart.dinvokef(implementation["function"], implZone, _parent Delegate(implZone), zone, specification, zoneValues), Zone); 4355 return dart.as(dart.dinvokef(implementation['function'], implZone, _parent Delegate(implZone), zone, specification, zoneValues), Zone);
4196 } 4356 }
4197 } 4357 }
4198 class _Zone extends dart.Object { 4358 class _Zone extends dart.Object {
4199 _Zone() { 4359 _Zone() {
4200 } 4360 }
4201 inSameErrorZone(otherZone) { 4361 inSameErrorZone(otherZone) {
4202 return dart.notNull(core.identical(this, otherZone)) || dart.notNull(core. identical(this.errorZone, otherZone.errorZone)); 4362 return dart.notNull(core.identical(this, otherZone)) || dart.notNull(core. identical(this.errorZone, otherZone.errorZone));
4203 } 4363 }
4204 } 4364 }
4365 let _delegateCache = Symbol('_delegateCache');
4366 let _map = Symbol('_map');
4205 class _CustomZone extends _Zone { 4367 class _CustomZone extends _Zone {
4206 get _delegate() { 4368 get [_delegate]() {
4207 if (this._delegateCache !== null) 4369 if (this[_delegateCache] !== null)
4208 return this._delegateCache; 4370 return this[_delegateCache];
4209 this._delegateCache = new _ZoneDelegate(this); 4371 this[_delegateCache] = new _ZoneDelegate(this);
4210 return this._delegateCache; 4372 return this[_delegateCache];
4211 } 4373 }
4212 _CustomZone(parent, specification, _map) { 4374 _CustomZone(parent, specification, $_map) {
4213 this.parent = parent; 4375 this.parent = parent;
4214 this._map = _map; 4376 this[_map] = $_map;
4215 this._runUnary = null; 4377 this[_runUnary] = null;
4216 this._run = null; 4378 this[_run] = null;
4217 this._runBinary = null; 4379 this[_runBinary] = null;
4218 this._registerCallback = null; 4380 this[_registerCallback] = null;
4219 this._registerUnaryCallback = null; 4381 this[_registerUnaryCallback] = null;
4220 this._registerBinaryCallback = null; 4382 this[_registerBinaryCallback] = null;
4221 this._errorCallback = null; 4383 this[_errorCallback] = null;
4222 this._scheduleMicrotask = null; 4384 this[_scheduleMicrotask] = null;
4223 this._createTimer = null; 4385 this[_createTimer] = null;
4224 this._createPeriodicTimer = null; 4386 this[_createPeriodicTimer] = null;
4225 this._print = null; 4387 this[_print] = null;
4226 this._fork = null; 4388 this[_fork] = null;
4227 this._handleUncaughtError = null; 4389 this[_handleUncaughtError] = null;
4228 this._delegateCache = null; 4390 this[_delegateCache] = null;
4229 super._Zone(); 4391 super._Zone();
4230 this._run = specification.run !== null ? new _ZoneFunction(this, specifica tion.run) : this.parent._run; 4392 this[_run] = specification.run !== null ? new _ZoneFunction(this, specific ation.run) : this.parent[_run];
4231 this._runUnary = specification.runUnary !== null ? new _ZoneFunction(this, specification.runUnary) : this.parent._runUnary; 4393 this[_runUnary] = specification.runUnary !== null ? new _ZoneFunction(this , specification.runUnary) : this.parent[_runUnary];
4232 this._runBinary = specification.runBinary !== null ? new _ZoneFunction(thi s, specification.runBinary) : this.parent._runBinary; 4394 this[_runBinary] = specification.runBinary !== null ? new _ZoneFunction(th is, specification.runBinary) : this.parent[_runBinary];
4233 this._registerCallback = specification.registerCallback !== null ? new _Zo neFunction(this, specification.registerCallback) : this.parent._registerCallback ; 4395 this[_registerCallback] = specification.registerCallback !== null ? new _Z oneFunction(this, specification.registerCallback) : this.parent[_registerCallbac k];
4234 this._registerUnaryCallback = specification.registerUnaryCallback !== null ? new _ZoneFunction(this, specification.registerUnaryCallback) : this.parent._r egisterUnaryCallback; 4396 this[_registerUnaryCallback] = specification.registerUnaryCallback !== nul l ? new _ZoneFunction(this, specification.registerUnaryCallback) : this.parent[_ registerUnaryCallback];
4235 this._registerBinaryCallback = specification.registerBinaryCallback !== nu ll ? new _ZoneFunction(this, specification.registerBinaryCallback) : this.parent ._registerBinaryCallback; 4397 this[_registerBinaryCallback] = specification.registerBinaryCallback !== n ull ? new _ZoneFunction(this, specification.registerBinaryCallback) : this.paren t[_registerBinaryCallback];
4236 this._errorCallback = specification.errorCallback !== null ? new _ZoneFunc tion(this, specification.errorCallback) : this.parent._errorCallback; 4398 this[_errorCallback] = specification.errorCallback !== null ? new _ZoneFun ction(this, specification.errorCallback) : this.parent[_errorCallback];
4237 this._scheduleMicrotask = specification.scheduleMicrotask !== null ? new _ ZoneFunction(this, specification.scheduleMicrotask) : this.parent._scheduleMicro task; 4399 this[_scheduleMicrotask] = specification.scheduleMicrotask !== null ? new _ZoneFunction(this, specification.scheduleMicrotask) : this.parent[_scheduleMicr otask];
4238 this._createTimer = specification.createTimer !== null ? new _ZoneFunction (this, specification.createTimer) : this.parent._createTimer; 4400 this[_createTimer] = specification.createTimer !== null ? new _ZoneFunctio n(this, specification.createTimer) : this.parent[_createTimer];
4239 this._createPeriodicTimer = specification.createPeriodicTimer !== null ? n ew _ZoneFunction(this, specification.createPeriodicTimer) : this.parent._createP eriodicTimer; 4401 this[_createPeriodicTimer] = specification.createPeriodicTimer !== null ? new _ZoneFunction(this, specification.createPeriodicTimer) : this.parent[_create PeriodicTimer];
4240 this._print = specification.print !== null ? new _ZoneFunction(this, speci fication.print) : this.parent._print; 4402 this[_print] = specification.print !== null ? new _ZoneFunction(this, spec ification.print) : this.parent[_print];
4241 this._fork = specification.fork !== null ? new _ZoneFunction(this, specifi cation.fork) : this.parent._fork; 4403 this[_fork] = specification.fork !== null ? new _ZoneFunction(this, specif ication.fork) : this.parent[_fork];
4242 this._handleUncaughtError = specification.handleUncaughtError !== null ? n ew _ZoneFunction(this, specification.handleUncaughtError) : this.parent._handleU ncaughtError; 4404 this[_handleUncaughtError] = specification.handleUncaughtError !== null ? new _ZoneFunction(this, specification.handleUncaughtError) : this.parent[_handle UncaughtError];
4243 } 4405 }
4244 get errorZone() { 4406 get errorZone() {
4245 return this._handleUncaughtError.zone; 4407 return this[_handleUncaughtError].zone;
4246 } 4408 }
4247 runGuarded(f) { 4409 runGuarded(f) {
4248 try { 4410 try {
4249 return this.run(f); 4411 return this.run(f);
4250 } catch (e) { 4412 } catch (e) {
4251 let s = dart.stackTrace(e); 4413 let s = dart.stackTrace(e);
4252 return this.handleUncaughtError(e, s); 4414 return this.handleUncaughtError(e, s);
4253 } 4415 }
4254 4416
4255 } 4417 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4292 bindBinaryCallback(f, opt$) { 4454 bindBinaryCallback(f, opt$) {
4293 let runGuarded = opt$.runGuarded === void 0 ? true : opt$.runGuarded; 4455 let runGuarded = opt$.runGuarded === void 0 ? true : opt$.runGuarded;
4294 let registered = this.registerBinaryCallback(f); 4456 let registered = this.registerBinaryCallback(f);
4295 if (runGuarded) { 4457 if (runGuarded) {
4296 return ((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).b ind(this); 4458 return ((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).b ind(this);
4297 } else { 4459 } else {
4298 return ((arg1, arg2) => this.runBinary(registered, arg1, arg2)).bind(thi s); 4460 return ((arg1, arg2) => this.runBinary(registered, arg1, arg2)).bind(thi s);
4299 } 4461 }
4300 } 4462 }
4301 get(key) { 4463 get(key) {
4302 let result = this._map.get(key); 4464 let result = this[_map].get(key);
4303 if (dart.notNull(result !== null) || dart.notNull(this._map.containsKey(ke y))) 4465 if (dart.notNull(result !== null) || dart.notNull(this[_map].containsKey(k ey)))
4304 return result; 4466 return result;
4305 if (this.parent !== null) { 4467 if (this.parent !== null) {
4306 let value = this.parent.get(key); 4468 let value = this.parent.get(key);
4307 if (value !== null) { 4469 if (value !== null) {
4308 this._map.set(key, value); 4470 this[_map].set(key, value);
4309 } 4471 }
4310 return value; 4472 return value;
4311 } 4473 }
4312 dart.assert(dart.equals(this, _ROOT_ZONE)); 4474 dart.assert(dart.equals(this, _ROOT_ZONE));
4313 return null; 4475 return null;
4314 } 4476 }
4315 handleUncaughtError(error, stackTrace) { 4477 handleUncaughtError(error, stackTrace) {
4316 let implementation = this._handleUncaughtError; 4478 let implementation = this[_handleUncaughtError];
4317 dart.assert(implementation !== null); 4479 dart.assert(implementation !== null);
4318 let parentDelegate = _parentDelegate(implementation.zone); 4480 let parentDelegate = _parentDelegate(implementation.zone);
4319 return dart.dinvokef(implementation["function"], implementation.zone, pare ntDelegate, this, error, stackTrace); 4481 return dart.dinvokef(implementation['function'], implementation.zone, pare ntDelegate, this, error, stackTrace);
4320 } 4482 }
4321 fork(opt$) { 4483 fork(opt$) {
4322 let specification = opt$.specification === void 0 ? null : opt$.specificat ion; 4484 let specification = opt$.specification === void 0 ? null : opt$.specificat ion;
4323 let zoneValues = opt$.zoneValues === void 0 ? null : opt$.zoneValues; 4485 let zoneValues = opt$.zoneValues === void 0 ? null : opt$.zoneValues;
4324 let implementation = this._fork; 4486 let implementation = this[_fork];
4325 dart.assert(implementation !== null); 4487 dart.assert(implementation !== null);
4326 let parentDelegate = _parentDelegate(implementation.zone); 4488 let parentDelegate = _parentDelegate(implementation.zone);
4327 return dart.as(dart.dinvokef(implementation["function"], implementation.zo ne, parentDelegate, this, specification, zoneValues), Zone); 4489 return dart.as(dart.dinvokef(implementation['function'], implementation.zo ne, parentDelegate, this, specification, zoneValues), Zone);
4328 } 4490 }
4329 run(f) { 4491 run(f) {
4330 let implementation = this._run; 4492 let implementation = this[_run];
4331 dart.assert(implementation !== null); 4493 dart.assert(implementation !== null);
4332 let parentDelegate = _parentDelegate(implementation.zone); 4494 let parentDelegate = _parentDelegate(implementation.zone);
4333 return dart.dinvokef(implementation["function"], implementation.zone, pare ntDelegate, this, f); 4495 return dart.dinvokef(implementation['function'], implementation.zone, pare ntDelegate, this, f);
4334 } 4496 }
4335 runUnary(f, arg) { 4497 runUnary(f, arg) {
4336 let implementation = this._runUnary; 4498 let implementation = this[_runUnary];
4337 dart.assert(implementation !== null); 4499 dart.assert(implementation !== null);
4338 let parentDelegate = _parentDelegate(implementation.zone); 4500 let parentDelegate = _parentDelegate(implementation.zone);
4339 return dart.dinvokef(implementation["function"], implementation.zone, pare ntDelegate, this, f, arg); 4501 return dart.dinvokef(implementation['function'], implementation.zone, pare ntDelegate, this, f, arg);
4340 } 4502 }
4341 runBinary(f, arg1, arg2) { 4503 runBinary(f, arg1, arg2) {
4342 let implementation = this._runBinary; 4504 let implementation = this[_runBinary];
4343 dart.assert(implementation !== null); 4505 dart.assert(implementation !== null);
4344 let parentDelegate = _parentDelegate(implementation.zone); 4506 let parentDelegate = _parentDelegate(implementation.zone);
4345 return dart.dinvokef(implementation["function"], implementation.zone, pare ntDelegate, this, f, arg1, arg2); 4507 return dart.dinvokef(implementation['function'], implementation.zone, pare ntDelegate, this, f, arg1, arg2);
4346 } 4508 }
4347 registerCallback(f) { 4509 registerCallback(f) {
4348 let implementation = this._registerCallback; 4510 let implementation = this[_registerCallback];
4349 dart.assert(implementation !== null); 4511 dart.assert(implementation !== null);
4350 let parentDelegate = _parentDelegate(implementation.zone); 4512 let parentDelegate = _parentDelegate(implementation.zone);
4351 return dart.as(dart.dinvokef(implementation["function"], implementation.zo ne, parentDelegate, this, f), ZoneCallback); 4513 return dart.as(dart.dinvokef(implementation['function'], implementation.zo ne, parentDelegate, this, f), ZoneCallback);
4352 } 4514 }
4353 registerUnaryCallback(f) { 4515 registerUnaryCallback(f) {
4354 let implementation = this._registerUnaryCallback; 4516 let implementation = this[_registerUnaryCallback];
4355 dart.assert(implementation !== null); 4517 dart.assert(implementation !== null);
4356 let parentDelegate = _parentDelegate(implementation.zone); 4518 let parentDelegate = _parentDelegate(implementation.zone);
4357 return dart.as(dart.dinvokef(implementation["function"], implementation.zo ne, parentDelegate, this, f), ZoneUnaryCallback); 4519 return dart.as(dart.dinvokef(implementation['function'], implementation.zo ne, parentDelegate, this, f), ZoneUnaryCallback);
4358 } 4520 }
4359 registerBinaryCallback(f) { 4521 registerBinaryCallback(f) {
4360 let implementation = this._registerBinaryCallback; 4522 let implementation = this[_registerBinaryCallback];
4361 dart.assert(implementation !== null); 4523 dart.assert(implementation !== null);
4362 let parentDelegate = _parentDelegate(implementation.zone); 4524 let parentDelegate = _parentDelegate(implementation.zone);
4363 return dart.as(dart.dinvokef(implementation["function"], implementation.zo ne, parentDelegate, this, f), ZoneBinaryCallback); 4525 return dart.as(dart.dinvokef(implementation['function'], implementation.zo ne, parentDelegate, this, f), ZoneBinaryCallback);
4364 } 4526 }
4365 errorCallback(error, stackTrace) { 4527 errorCallback(error, stackTrace) {
4366 let implementation = this._errorCallback; 4528 let implementation = this[_errorCallback];
4367 dart.assert(implementation !== null); 4529 dart.assert(implementation !== null);
4368 let implementationZone = implementation.zone; 4530 let implementationZone = implementation.zone;
4369 if (core.identical(implementationZone, _ROOT_ZONE)) 4531 if (core.identical(implementationZone, _ROOT_ZONE))
4370 return null; 4532 return null;
4371 let parentDelegate = _parentDelegate(dart.as(implementationZone, _Zone)); 4533 let parentDelegate = _parentDelegate(dart.as(implementationZone, _Zone));
4372 return dart.as(dart.dinvokef(implementation["function"], implementationZon e, parentDelegate, this, error, stackTrace), AsyncError); 4534 return dart.as(dart.dinvokef(implementation['function'], implementationZon e, parentDelegate, this, error, stackTrace), AsyncError);
4373 } 4535 }
4374 scheduleMicrotask(f) { 4536 scheduleMicrotask(f) {
4375 let implementation = this._scheduleMicrotask; 4537 let implementation = this[_scheduleMicrotask];
4376 dart.assert(implementation !== null); 4538 dart.assert(implementation !== null);
4377 let parentDelegate = _parentDelegate(implementation.zone); 4539 let parentDelegate = _parentDelegate(implementation.zone);
4378 return dart.dinvokef(implementation["function"], implementation.zone, pare ntDelegate, this, f); 4540 return dart.dinvokef(implementation['function'], implementation.zone, pare ntDelegate, this, f);
4379 } 4541 }
4380 createTimer(duration, f) { 4542 createTimer(duration, f) {
4381 let implementation = this._createTimer; 4543 let implementation = this[_createTimer];
4382 dart.assert(implementation !== null); 4544 dart.assert(implementation !== null);
4383 let parentDelegate = _parentDelegate(implementation.zone); 4545 let parentDelegate = _parentDelegate(implementation.zone);
4384 return dart.as(dart.dinvokef(implementation["function"], implementation.zo ne, parentDelegate, this, duration, f), Timer); 4546 return dart.as(dart.dinvokef(implementation['function'], implementation.zo ne, parentDelegate, this, duration, f), Timer);
4385 } 4547 }
4386 createPeriodicTimer(duration, f) { 4548 createPeriodicTimer(duration, f) {
4387 let implementation = this._createPeriodicTimer; 4549 let implementation = this[_createPeriodicTimer];
4388 dart.assert(implementation !== null); 4550 dart.assert(implementation !== null);
4389 let parentDelegate = _parentDelegate(implementation.zone); 4551 let parentDelegate = _parentDelegate(implementation.zone);
4390 return dart.as(dart.dinvokef(implementation["function"], implementation.zo ne, parentDelegate, this, duration, f), Timer); 4552 return dart.as(dart.dinvokef(implementation['function'], implementation.zo ne, parentDelegate, this, duration, f), Timer);
4391 } 4553 }
4392 print(line) { 4554 print(line) {
4393 let implementation = this._print; 4555 let implementation = this[_print];
4394 dart.assert(implementation !== null); 4556 dart.assert(implementation !== null);
4395 let parentDelegate = _parentDelegate(implementation.zone); 4557 let parentDelegate = _parentDelegate(implementation.zone);
4396 return dart.dinvokef(implementation["function"], implementation.zone, pare ntDelegate, this, line); 4558 return dart.dinvokef(implementation['function'], implementation.zone, pare ntDelegate, this, line);
4397 } 4559 }
4398 } 4560 }
4399 // Function _rootHandleUncaughtError: (Zone, ZoneDelegate, Zone, dynamic, Stac kTrace) → void 4561 // Function _rootHandleUncaughtError: (Zone, ZoneDelegate, Zone, dynamic, Stac kTrace) → void
4400 function _rootHandleUncaughtError(self, parent, zone, error, stackTrace) { 4562 function _rootHandleUncaughtError(self, parent, zone, error, stackTrace) {
4401 _schedulePriorityAsyncCallback(() => { 4563 _schedulePriorityAsyncCallback(() => {
4402 throw new _UncaughtAsyncError(error, stackTrace); 4564 throw new _UncaughtAsyncError(error, stackTrace);
4403 }); 4565 });
4404 } 4566 }
4405 // Function _rootRun: (Zone, ZoneDelegate, Zone, () → dynamic) → dynamic 4567 // Function _rootRun: (Zone, ZoneDelegate, Zone, () → dynamic) → dynamic
4406 function _rootRun(self, parent, zone, f) { 4568 function _rootRun(self, parent, zone, f) {
4407 if (dart.equals(Zone._current, zone)) 4569 if (dart.equals(Zone[_current], zone))
4408 return f(); 4570 return f();
4409 let old = Zone._enter(zone); 4571 let old = Zone._enter(zone);
4410 try { 4572 try {
4411 return f(); 4573 return f();
4412 } finally { 4574 } finally {
4413 Zone._leave(old); 4575 Zone._leave(old);
4414 } 4576 }
4415 } 4577 }
4416 // Function _rootRunUnary: (Zone, ZoneDelegate, Zone, (dynamic) → dynamic, dyn amic) → dynamic 4578 // Function _rootRunUnary: (Zone, ZoneDelegate, Zone, (dynamic) → dynamic, dyn amic) → dynamic
4417 function _rootRunUnary(self, parent, zone, f, arg) { 4579 function _rootRunUnary(self, parent, zone, f, arg) {
4418 if (dart.equals(Zone._current, zone)) 4580 if (dart.equals(Zone[_current], zone))
4419 return f(arg); 4581 return f(arg);
4420 let old = Zone._enter(zone); 4582 let old = Zone._enter(zone);
4421 try { 4583 try {
4422 return f(arg); 4584 return f(arg);
4423 } finally { 4585 } finally {
4424 Zone._leave(old); 4586 Zone._leave(old);
4425 } 4587 }
4426 } 4588 }
4427 // Function _rootRunBinary: (Zone, ZoneDelegate, Zone, (dynamic, dynamic) → dy namic, dynamic, dynamic) → dynamic 4589 // Function _rootRunBinary: (Zone, ZoneDelegate, Zone, (dynamic, dynamic) → dy namic, dynamic, dynamic) → dynamic
4428 function _rootRunBinary(self, parent, zone, f, arg1, arg2) { 4590 function _rootRunBinary(self, parent, zone, f, arg1, arg2) {
4429 if (dart.equals(Zone._current, zone)) 4591 if (dart.equals(Zone[_current], zone))
4430 return f(arg1, arg2); 4592 return f(arg1, arg2);
4431 let old = Zone._enter(zone); 4593 let old = Zone._enter(zone);
4432 try { 4594 try {
4433 return f(arg1, arg2); 4595 return f(arg1, arg2);
4434 } finally { 4596 } finally {
4435 Zone._leave(old); 4597 Zone._leave(old);
4436 } 4598 }
4437 } 4599 }
4438 // Function _rootRegisterCallback: (Zone, ZoneDelegate, Zone, () → dynamic) → ZoneCallback 4600 // Function _rootRegisterCallback: (Zone, ZoneDelegate, Zone, () → dynamic) → ZoneCallback
4439 function _rootRegisterCallback(self, parent, zone, f) { 4601 function _rootRegisterCallback(self, parent, zone, f) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
4485 function _rootFork(self, parent, zone, specification, zoneValues) { 4647 function _rootFork(self, parent, zone, specification, zoneValues) {
4486 _internal.printToZone = _printToZone; 4648 _internal.printToZone = _printToZone;
4487 if (specification === null) { 4649 if (specification === null) {
4488 specification = new ZoneSpecification(); 4650 specification = new ZoneSpecification();
4489 } else if (!dart.is(specification, _ZoneSpecification)) { 4651 } else if (!dart.is(specification, _ZoneSpecification)) {
4490 throw new core.ArgumentError("ZoneSpecifications must be instantiated" + " with the provided constructor."); 4652 throw new core.ArgumentError("ZoneSpecifications must be instantiated" + " with the provided constructor.");
4491 } 4653 }
4492 let valueMap = null; 4654 let valueMap = null;
4493 if (zoneValues === null) { 4655 if (zoneValues === null) {
4494 if (dart.is(zone, _Zone)) { 4656 if (dart.is(zone, _Zone)) {
4495 valueMap = zone._map; 4657 valueMap = zone[_map];
4496 } else { 4658 } else {
4497 valueMap = new collection.HashMap(); 4659 valueMap = new collection.HashMap();
4498 } 4660 }
4499 } else { 4661 } else {
4500 valueMap = new collection.HashMap.from(zoneValues); 4662 valueMap = new collection.HashMap.from(zoneValues);
4501 } 4663 }
4502 return new _CustomZone(dart.as(zone, _Zone), specification, valueMap); 4664 return new _CustomZone(dart.as(zone, _Zone), specification, valueMap);
4503 } 4665 }
4504 class _RootZoneSpecification extends dart.Object { 4666 class _RootZoneSpecification extends dart.Object {
4505 get handleUncaughtError() { 4667 get handleUncaughtError() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4539 return _rootPrint; 4701 return _rootPrint;
4540 } 4702 }
4541 get fork() { 4703 get fork() {
4542 return _rootFork; 4704 return _rootFork;
4543 } 4705 }
4544 } 4706 }
4545 class _RootZone extends _Zone { 4707 class _RootZone extends _Zone {
4546 _RootZone() { 4708 _RootZone() {
4547 super._Zone(); 4709 super._Zone();
4548 } 4710 }
4549 get _run() { 4711 get [_run]() {
4550 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRun); 4712 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRun);
4551 } 4713 }
4552 get _runUnary() { 4714 get [_runUnary]() {
4553 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRunUnary); 4715 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRunUnary);
4554 } 4716 }
4555 get _runBinary() { 4717 get [_runBinary]() {
4556 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRunBinary); 4718 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRunBinary);
4557 } 4719 }
4558 get _registerCallback() { 4720 get [_registerCallback]() {
4559 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRegisterCallback ); 4721 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRegisterCallback );
4560 } 4722 }
4561 get _registerUnaryCallback() { 4723 get [_registerUnaryCallback]() {
4562 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRegisterUnaryCal lback); 4724 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRegisterUnaryCal lback);
4563 } 4725 }
4564 get _registerBinaryCallback() { 4726 get [_registerBinaryCallback]() {
4565 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRegisterBinaryCa llback); 4727 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootRegisterBinaryCa llback);
4566 } 4728 }
4567 get _errorCallback() { 4729 get [_errorCallback]() {
4568 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootErrorCallback); 4730 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootErrorCallback);
4569 } 4731 }
4570 get _scheduleMicrotask() { 4732 get [_scheduleMicrotask]() {
4571 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootScheduleMicrotas k); 4733 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootScheduleMicrotas k);
4572 } 4734 }
4573 get _createTimer() { 4735 get [_createTimer]() {
4574 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootCreateTimer); 4736 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootCreateTimer);
4575 } 4737 }
4576 get _createPeriodicTimer() { 4738 get [_createPeriodicTimer]() {
4577 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootCreatePeriodicTi mer); 4739 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootCreatePeriodicTi mer);
4578 } 4740 }
4579 get _print() { 4741 get [_print]() {
4580 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootPrint); 4742 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootPrint);
4581 } 4743 }
4582 get _fork() { 4744 get [_fork]() {
4583 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootFork); 4745 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootFork);
4584 } 4746 }
4585 get _handleUncaughtError() { 4747 get [_handleUncaughtError]() {
4586 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootHandleUncaughtEr ror); 4748 return new _ZoneFunction(dart.as(_ROOT_ZONE, _Zone), _rootHandleUncaughtEr ror);
4587 } 4749 }
4588 get parent() { 4750 get parent() {
4589 return null; 4751 return null;
4590 } 4752 }
4591 get _map() { 4753 get [_map]() {
4592 return _rootMap; 4754 return _rootMap;
4593 } 4755 }
4594 get _delegate() { 4756 get [_delegate]() {
4595 if (_rootDelegate !== null) 4757 if (_rootDelegate !== null)
4596 return _rootDelegate; 4758 return _rootDelegate;
4597 return _rootDelegate = new _ZoneDelegate(this); 4759 return _rootDelegate = new _ZoneDelegate(this);
4598 } 4760 }
4599 get errorZone() { 4761 get errorZone() {
4600 return this; 4762 return this;
4601 } 4763 }
4602 runGuarded(f) { 4764 runGuarded(f) {
4603 try { 4765 try {
4604 if (core.identical(_ROOT_ZONE, Zone._current)) { 4766 if (core.identical(_ROOT_ZONE, Zone[_current])) {
4605 return f(); 4767 return f();
4606 } 4768 }
4607 return _rootRun(null, null, this, f); 4769 return _rootRun(null, null, this, f);
4608 } catch (e) { 4770 } catch (e) {
4609 let s = dart.stackTrace(e); 4771 let s = dart.stackTrace(e);
4610 return this.handleUncaughtError(e, s); 4772 return this.handleUncaughtError(e, s);
4611 } 4773 }
4612 4774
4613 } 4775 }
4614 runUnaryGuarded(f, arg) { 4776 runUnaryGuarded(f, arg) {
4615 try { 4777 try {
4616 if (core.identical(_ROOT_ZONE, Zone._current)) { 4778 if (core.identical(_ROOT_ZONE, Zone[_current])) {
4617 return f(arg); 4779 return f(arg);
4618 } 4780 }
4619 return _rootRunUnary(null, null, this, f, arg); 4781 return _rootRunUnary(null, null, this, f, arg);
4620 } catch (e) { 4782 } catch (e) {
4621 let s = dart.stackTrace(e); 4783 let s = dart.stackTrace(e);
4622 return this.handleUncaughtError(e, s); 4784 return this.handleUncaughtError(e, s);
4623 } 4785 }
4624 4786
4625 } 4787 }
4626 runBinaryGuarded(f, arg1, arg2) { 4788 runBinaryGuarded(f, arg1, arg2) {
4627 try { 4789 try {
4628 if (core.identical(_ROOT_ZONE, Zone._current)) { 4790 if (core.identical(_ROOT_ZONE, Zone[_current])) {
4629 return f(arg1, arg2); 4791 return f(arg1, arg2);
4630 } 4792 }
4631 return _rootRunBinary(null, null, this, f, arg1, arg2); 4793 return _rootRunBinary(null, null, this, f, arg1, arg2);
4632 } catch (e) { 4794 } catch (e) {
4633 let s = dart.stackTrace(e); 4795 let s = dart.stackTrace(e);
4634 return this.handleUncaughtError(e, s); 4796 return this.handleUncaughtError(e, s);
4635 } 4797 }
4636 4798
4637 } 4799 }
4638 bindCallback(f, opt$) { 4800 bindCallback(f, opt$) {
(...skipping 25 matching lines...) Expand all
4664 } 4826 }
4665 handleUncaughtError(error, stackTrace) { 4827 handleUncaughtError(error, stackTrace) {
4666 return _rootHandleUncaughtError(null, null, this, error, stackTrace); 4828 return _rootHandleUncaughtError(null, null, this, error, stackTrace);
4667 } 4829 }
4668 fork(opt$) { 4830 fork(opt$) {
4669 let specification = opt$.specification === void 0 ? null : opt$.specificat ion; 4831 let specification = opt$.specification === void 0 ? null : opt$.specificat ion;
4670 let zoneValues = opt$.zoneValues === void 0 ? null : opt$.zoneValues; 4832 let zoneValues = opt$.zoneValues === void 0 ? null : opt$.zoneValues;
4671 return _rootFork(null, null, this, specification, zoneValues); 4833 return _rootFork(null, null, this, specification, zoneValues);
4672 } 4834 }
4673 run(f) { 4835 run(f) {
4674 if (core.identical(Zone._current, _ROOT_ZONE)) 4836 if (core.identical(Zone[_current], _ROOT_ZONE))
4675 return f(); 4837 return f();
4676 return _rootRun(null, null, this, f); 4838 return _rootRun(null, null, this, f);
4677 } 4839 }
4678 runUnary(f, arg) { 4840 runUnary(f, arg) {
4679 if (core.identical(Zone._current, _ROOT_ZONE)) 4841 if (core.identical(Zone[_current], _ROOT_ZONE))
4680 return f(arg); 4842 return f(arg);
4681 return _rootRunUnary(null, null, this, f, arg); 4843 return _rootRunUnary(null, null, this, f, arg);
4682 } 4844 }
4683 runBinary(f, arg1, arg2) { 4845 runBinary(f, arg1, arg2) {
4684 if (core.identical(Zone._current, _ROOT_ZONE)) 4846 if (core.identical(Zone[_current], _ROOT_ZONE))
4685 return f(arg1, arg2); 4847 return f(arg1, arg2);
4686 return _rootRunBinary(null, null, this, f, arg1, arg2); 4848 return _rootRunBinary(null, null, this, f, arg1, arg2);
4687 } 4849 }
4688 registerCallback(f) { 4850 registerCallback(f) {
4689 return f; 4851 return f;
4690 } 4852 }
4691 registerUnaryCallback(f) { 4853 registerUnaryCallback(f) {
4692 return f; 4854 return f;
4693 } 4855 }
4694 registerBinaryCallback(f) { 4856 registerBinaryCallback(f) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4781 exports.StreamIterator$ = StreamIterator$; 4943 exports.StreamIterator$ = StreamIterator$;
4782 exports.StreamController = StreamController; 4944 exports.StreamController = StreamController;
4783 exports.StreamController$ = StreamController$; 4945 exports.StreamController$ = StreamController$;
4784 exports.Timer = Timer; 4946 exports.Timer = Timer;
4785 exports.AsyncError = AsyncError; 4947 exports.AsyncError = AsyncError;
4786 exports.ZoneSpecification = ZoneSpecification; 4948 exports.ZoneSpecification = ZoneSpecification;
4787 exports.ZoneDelegate = ZoneDelegate; 4949 exports.ZoneDelegate = ZoneDelegate;
4788 exports.Zone = Zone; 4950 exports.Zone = Zone;
4789 exports.runZoned = runZoned; 4951 exports.runZoned = runZoned;
4790 })(async || (async = {})); 4952 })(async || (async = {}));
OLDNEW
« no previous file with comments | « test/codegen/expect/_native_typed_data/_native_typed_data.js ('k') | test/codegen/expect/collection/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698