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

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

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

Powered by Google App Engine
This is Rietveld 408576698