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

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

Powered by Google App Engine
This is Rietveld 408576698