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

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

Powered by Google App Engine
This is Rietveld 408576698