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

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

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/collection.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(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic
5 function _invokeErrorHandler(errorHandler, error, stackTrace) { 5 function _invokeErrorHandler(errorHandler, error, stackTrace) {
6 if (dart.is(errorHandler, ZoneBinaryCallback)) { 6 if (dart.is(errorHandler, ZoneBinaryCallback)) {
7 return dart.dinvokef(errorHandler, error, stackTrace); 7 return dart.dinvokef(errorHandler, error, stackTrace);
8 } else { 8 } else {
9 return dart.dinvokef(errorHandler, error); 9 return dart.dinvokef(errorHandler, error);
10 } 10 }
(...skipping 25 matching lines...) Expand all
36 if (stackTrace != null) 36 if (stackTrace != null)
37 return stackTrace; 37 return stackTrace;
38 if (dart.is(error, core.Error)) { 38 if (dart.is(error, core.Error)) {
39 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace); 39 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace);
40 } 40 }
41 return null; 41 return null;
42 } 42 }
43 toString() { 43 toString() {
44 let result = `Uncaught Error: ${this.error}`; 44 let result = `Uncaught Error: ${this.error}`;
45 if (this.stackTrace != null) { 45 if (this.stackTrace != null) {
46 result = `\nStack Trace:\n${this.stackTrace}`; 46 result = core.String['+'](result, `\nStack Trace:\n${this.stackTrace}`);
47 } 47 }
48 return result; 48 return result;
49 } 49 }
50 } 50 }
51 let _controller = Symbol('_controller'); 51 let _controller = Symbol('_controller');
52 let _createSubscription = Symbol('_createSubscription'); 52 let _createSubscription = Symbol('_createSubscription');
53 let _subscribe = Symbol('_subscribe'); 53 let _subscribe = Symbol('_subscribe');
54 let _onListen = Symbol('_onListen'); 54 let _onListen = Symbol('_onListen');
55 let _add = Symbol('_add'); 55 let _add = Symbol('_add');
56 let _closeUnchecked = Symbol('_closeUnchecked'); 56 let _closeUnchecked = Symbol('_closeUnchecked');
57 let _addError = Symbol('_addError'); 57 let _addError = Symbol('_addError');
58 let _completeError = Symbol('_completeError'); 58 let _completeError = Symbol('_completeError');
59 let _complete = Symbol('_complete'); 59 let _complete = Symbol('_complete');
60 let _sink = Symbol('_sink'); 60 let _sink = Symbol('_sink');
61 let Stream$ = dart.generic(function(T) { 61 let Stream$ = dart.generic(function(T) {
62 class Stream extends core.Object { 62 class Stream extends core.Object {
63 Stream() { 63 Stream() {
64 } 64 }
65 fromFuture(future) { 65 fromFuture(future) {
66 let controller = new (StreamController$(T))({sync: true}); 66 let controller = new (StreamController$(T))({sync: true});
67 future.then(dart.as((value) => { 67 future.then(dart.as(value => {
68 controller[_add](dart.as(value, T)); 68 controller[_add](dart.as(value, T));
69 controller[_closeUnchecked](); 69 controller[_closeUnchecked]();
70 }, dart.throw_("Unimplemented type (T) → dynamic")), { 70 }, dart.throw_("Unimplemented type (T) → dynamic")), {
71 onError: (error, stackTrace) => { 71 onError: (error, stackTrace) => {
72 controller[_addError](error, dart.as(stackTrace, core.StackTrace)); 72 controller[_addError](error, dart.as(stackTrace, core.StackTrace));
73 controller[_closeUnchecked](); 73 controller[_closeUnchecked]();
74 } 74 }
75 }); 75 });
76 return controller.stream; 76 return controller.stream;
77 } 77 }
78 fromIterable(data) { 78 fromIterable(data) {
79 return new (_GeneratedStreamImpl$(T))(() => new (_IterablePendingEvents$ (T))(data)); 79 return new (_GeneratedStreamImpl$(T))(() => new (_IterablePendingEvents$ (T))(data));
80 } 80 }
81 periodic(period, computation) { 81 periodic(period, computation) {
82 if (computation === void 0) 82 if (computation === void 0)
83 computation = null; 83 computation = null;
84 if (computation == null) 84 if (computation == null)
85 computation = dart.as((i) => null, dart.throw_("Unimplemented type (in t) → T")); 85 computation = dart.as(i => null, dart.throw_("Unimplemented type (int) → T"));
86 let timer = null; 86 let timer = null;
87 let computationCount = 0; 87 let computationCount = 0;
88 let controller = null; 88 let controller = null;
89 let watch = new core.Stopwatch(); 89 let watch = new core.Stopwatch();
90 // Function sendEvent: () → void 90 // Function sendEvent: () → void
91 function sendEvent() { 91 function sendEvent() {
92 watch.reset(); 92 watch.reset();
93 let data = computation(((x) => computationCount = dart.notNull(x) + 1, x)(computationCount)); 93 let data = computation((() => {
94 let x = computationCount;
95 computationCount = dart.notNull(x) + 1;
96 return x;
97 })());
94 controller.add(data); 98 controller.add(data);
95 } 99 }
96 // Function startPeriodicTimer: () → void 100 // Function startPeriodicTimer: () → void
97 function startPeriodicTimer() { 101 function startPeriodicTimer() {
98 dart.assert(timer == null); 102 dart.assert(timer == null);
99 timer = new Timer.periodic(period, (timer) => { 103 timer = new Timer.periodic(period, timer => {
100 sendEvent(); 104 sendEvent();
101 }); 105 });
102 } 106 }
103 controller = new (StreamController$(T))({ 107 controller = new (StreamController$(T))({
104 sync: true, 108 sync: true,
105 onListen: () => { 109 onListen: () => {
106 watch.start(); 110 watch.start();
107 startPeriodicTimer(); 111 startPeriodicTimer();
108 }, 112 },
109 onPause: () => { 113 onPause: () => {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 152 }
149 asyncMap(convert) { 153 asyncMap(convert) {
150 let controller = null; 154 let controller = null;
151 let subscription = null; 155 let subscription = null;
152 // Function onListen: () → void 156 // Function onListen: () → void
153 function onListen() { 157 function onListen() {
154 let add = controller.add; 158 let add = controller.add;
155 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController))); 159 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController)));
156 let eventSink = controller; 160 let eventSink = controller;
157 let addError = eventSink[_addError]; 161 let addError = eventSink[_addError];
158 subscription = this.listen((event) => { 162 subscription = this.listen(event => {
159 let newValue = null; 163 let newValue = null;
160 try { 164 try {
161 newValue = convert(event); 165 newValue = convert(event);
162 } catch (e) { 166 } catch (e) {
163 let s = dart.stackTrace(e); 167 let s = dart.stackTrace(e);
164 controller.addError(e, s); 168 controller.addError(e, s);
165 return; 169 return;
166 } 170 }
167 171
168 if (dart.is(newValue, Future)) { 172 if (dart.is(newValue, Future)) {
(...skipping 29 matching lines...) Expand all
198 } 202 }
199 return controller.stream; 203 return controller.stream;
200 } 204 }
201 asyncExpand(convert) { 205 asyncExpand(convert) {
202 let controller = null; 206 let controller = null;
203 let subscription = null; 207 let subscription = null;
204 // Function onListen: () → void 208 // Function onListen: () → void
205 function onListen() { 209 function onListen() {
206 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController))); 210 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da rt.notNull(dart.is(controller, _BroadcastStreamController)));
207 let eventSink = controller; 211 let eventSink = controller;
208 subscription = this.listen((event) => { 212 subscription = this.listen(event => {
209 let newStream = null; 213 let newStream = null;
210 try { 214 try {
211 newStream = convert(event); 215 newStream = convert(event);
212 } catch (e) { 216 } catch (e) {
213 let s = dart.stackTrace(e); 217 let s = dart.stackTrace(e);
214 controller.addError(e, s); 218 controller.addError(e, s);
215 return; 219 return;
216 } 220 }
217 221
218 if (newStream != null) { 222 if (newStream != null) {
(...skipping 28 matching lines...) Expand all
247 return controller.stream; 251 return controller.stream;
248 } 252 }
249 handleError(onError, opts) { 253 handleError(onError, opts) {
250 let test = opts && 'test' in opts ? opts.test : null; 254 let test = opts && 'test' in opts ? opts.test : null;
251 return new (_HandleErrorStream$(T))(this, onError, test); 255 return new (_HandleErrorStream$(T))(this, onError, test);
252 } 256 }
253 expand(convert) { 257 expand(convert) {
254 return new (_ExpandStream$(T, dynamic))(this, convert); 258 return new (_ExpandStream$(T, dynamic))(this, convert);
255 } 259 }
256 pipe(streamConsumer) { 260 pipe(streamConsumer) {
257 return streamConsumer.addStream(this).then((_) => streamConsumer.close() ); 261 return streamConsumer.addStream(this).then(_ => streamConsumer.close());
258 } 262 }
259 transform(streamTransformer) { 263 transform(streamTransformer) {
260 return streamTransformer.bind(this); 264 return streamTransformer.bind(this);
261 } 265 }
262 reduce(combine) { 266 reduce(combine) {
263 let result = new (_Future$(T))(); 267 let result = new (_Future$(T))();
264 let seenFirst = false; 268 let seenFirst = false;
265 let value = null; 269 let value = null;
266 let subscription = null; 270 let subscription = null;
267 subscription = this.listen((element) => { 271 subscription = this.listen(element => {
268 if (seenFirst) { 272 if (seenFirst) {
269 _runUserCode(() => combine(value, element), (newValue) => { 273 _runUserCode(() => combine(value, element), newValue => {
270 value = newValue; 274 value = newValue;
271 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_ ("Unimplemented type (dynamic, StackTrace) → dynamic"))); 275 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_ ("Unimplemented type (dynamic, StackTrace) → dynamic")));
272 } else { 276 } else {
273 value = element; 277 value = element;
274 seenFirst = true; 278 seenFirst = true;
275 } 279 }
276 }, { 280 }, {
277 onError: result[_completeError], 281 onError: result[_completeError],
278 onDone: () => { 282 onDone: () => {
279 if (!dart.notNull(seenFirst)) { 283 if (!dart.notNull(seenFirst)) {
280 try { 284 try {
281 throw _internal.IterableElementError.noElement(); 285 throw _internal.IterableElementError.noElement();
282 } catch (e) { 286 } catch (e) {
283 let s = dart.stackTrace(e); 287 let s = dart.stackTrace(e);
284 _completeWithErrorCallback(result, e, s); 288 _completeWithErrorCallback(result, e, s);
285 } 289 }
286 290
287 } else { 291 } else {
288 result[_complete](value); 292 result[_complete](value);
289 } 293 }
290 }, 294 },
291 cancelOnError: true 295 cancelOnError: true
292 }); 296 });
293 return result; 297 return result;
294 } 298 }
295 fold(initialValue, combine) { 299 fold(initialValue, combine) {
296 let result = new _Future(); 300 let result = new _Future();
297 let value = initialValue; 301 let value = initialValue;
298 let subscription = null; 302 let subscription = null;
299 subscription = this.listen((element) => { 303 subscription = this.listen(element => {
300 _runUserCode(() => dart.dinvokef(combine, value, element), (newValue) => { 304 _runUserCode(() => dart.dinvokef(combine, value, element), newValue => {
301 value = newValue; 305 value = newValue;
302 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 306 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
303 }, { 307 }, {
304 onError: (e, st) => { 308 onError: (e, st) => {
305 result[_completeError](e, dart.as(st, core.StackTrace)); 309 result[_completeError](e, dart.as(st, core.StackTrace));
306 }, 310 },
307 onDone: () => { 311 onDone: () => {
308 result[_complete](value); 312 result[_complete](value);
309 }, 313 },
310 cancelOnError: true 314 cancelOnError: true
311 }); 315 });
312 return result; 316 return result;
313 } 317 }
314 join(separator) { 318 join(separator) {
315 if (separator === void 0) 319 if (separator === void 0)
316 separator = ""; 320 separator = "";
317 let result = new (_Future$(core.String))(); 321 let result = new (_Future$(core.String))();
318 let buffer = new core.StringBuffer(); 322 let buffer = new core.StringBuffer();
319 let subscription = null; 323 let subscription = null;
320 let first = true; 324 let first = true;
321 subscription = this.listen((element) => { 325 subscription = this.listen(element => {
322 if (!dart.notNull(first)) { 326 if (!dart.notNull(first)) {
323 buffer.write(separator); 327 buffer.write(separator);
324 } 328 }
325 first = false; 329 first = false;
326 try { 330 try {
327 buffer.write(element); 331 buffer.write(element);
328 } catch (e) { 332 } catch (e) {
329 let s = dart.stackTrace(e); 333 let s = dart.stackTrace(e);
330 _cancelAndErrorWithReplacement(subscription, result, e, s); 334 _cancelAndErrorWithReplacement(subscription, result, e, s);
331 } 335 }
332 336
333 }, { 337 }, {
334 onError: (e) => { 338 onError: e => {
335 result[_completeError](e); 339 result[_completeError](e);
336 }, 340 },
337 onDone: () => { 341 onDone: () => {
338 result[_complete](buffer.toString()); 342 result[_complete](buffer.toString());
339 }, 343 },
340 cancelOnError: true 344 cancelOnError: true
341 }); 345 });
342 return result; 346 return result;
343 } 347 }
344 contains(needle) { 348 contains(needle) {
345 let future = new (_Future$(core.bool))(); 349 let future = new (_Future$(core.bool))();
346 let subscription = null; 350 let subscription = null;
347 subscription = this.listen((element) => { 351 subscription = this.listen(element => {
348 _runUserCode(() => dart.equals(element, needle), (isMatch) => { 352 _runUserCode(() => dart.equals(element, needle), isMatch => {
349 if (isMatch) { 353 if (isMatch) {
350 _cancelAndValue(subscription, future, true); 354 _cancelAndValue(subscription, future, true);
351 } 355 }
352 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 356 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
353 }, { 357 }, {
354 onError: future[_completeError], 358 onError: future[_completeError],
355 onDone: () => { 359 onDone: () => {
356 future[_complete](false); 360 future[_complete](false);
357 }, 361 },
358 cancelOnError: true 362 cancelOnError: true
359 }); 363 });
360 return future; 364 return future;
361 } 365 }
362 forEach(action) { 366 forEach(action) {
363 let future = new _Future(); 367 let future = new _Future();
364 let subscription = null; 368 let subscription = null;
365 subscription = this.listen((element) => { 369 subscription = this.listen(element => {
366 _runUserCode(() => action(element), (_) => { 370 _runUserCode(() => action(element), _ => {
367 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 371 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
368 }, { 372 }, {
369 onError: future[_completeError], 373 onError: future[_completeError],
370 onDone: () => { 374 onDone: () => {
371 future[_complete](null); 375 future[_complete](null);
372 }, 376 },
373 cancelOnError: true 377 cancelOnError: true
374 }); 378 });
375 return future; 379 return future;
376 } 380 }
377 every(test) { 381 every(test) {
378 let future = new (_Future$(core.bool))(); 382 let future = new (_Future$(core.bool))();
379 let subscription = null; 383 let subscription = null;
380 subscription = this.listen((element) => { 384 subscription = this.listen(element => {
381 _runUserCode(() => test(element), (isMatch) => { 385 _runUserCode(() => test(element), isMatch => {
382 if (!dart.notNull(isMatch)) { 386 if (!dart.notNull(isMatch)) {
383 _cancelAndValue(subscription, future, false); 387 _cancelAndValue(subscription, future, false);
384 } 388 }
385 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 389 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
386 }, { 390 }, {
387 onError: future[_completeError], 391 onError: future[_completeError],
388 onDone: () => { 392 onDone: () => {
389 future[_complete](true); 393 future[_complete](true);
390 }, 394 },
391 cancelOnError: true 395 cancelOnError: true
392 }); 396 });
393 return future; 397 return future;
394 } 398 }
395 any(test) { 399 any(test) {
396 let future = new (_Future$(core.bool))(); 400 let future = new (_Future$(core.bool))();
397 let subscription = null; 401 let subscription = null;
398 subscription = this.listen((element) => { 402 subscription = this.listen(element => {
399 _runUserCode(() => test(element), (isMatch) => { 403 _runUserCode(() => test(element), isMatch => {
400 if (isMatch) { 404 if (isMatch) {
401 _cancelAndValue(subscription, future, true); 405 _cancelAndValue(subscription, future, true);
402 } 406 }
403 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 407 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
404 }, { 408 }, {
405 onError: future[_completeError], 409 onError: future[_completeError],
406 onDone: () => { 410 onDone: () => {
407 future[_complete](false); 411 future[_complete](false);
408 }, 412 },
409 cancelOnError: true 413 cancelOnError: true
410 }); 414 });
411 return future; 415 return future;
412 } 416 }
413 get length() { 417 get length() {
414 let future = new (_Future$(core.int))(); 418 let future = new (_Future$(core.int))();
415 let count = 0; 419 let count = 0;
416 this.listen(dart.as((_) => { 420 this.listen(dart.as(_ => {
417 count = dart.notNull(count) + 1; 421 count = dart.notNull(count) + 1;
418 }, dart.throw_("Unimplemented type (T) → void")), { 422 }, dart.throw_("Unimplemented type (T) → void")), {
419 onError: future[_completeError], 423 onError: future[_completeError],
420 onDone: () => { 424 onDone: () => {
421 future[_complete](count); 425 future[_complete](count);
422 }, 426 },
423 cancelOnError: true 427 cancelOnError: true
424 }); 428 });
425 return future; 429 return future;
426 } 430 }
427 get isEmpty() { 431 get isEmpty() {
428 let future = new (_Future$(core.bool))(); 432 let future = new (_Future$(core.bool))();
429 let subscription = null; 433 let subscription = null;
430 subscription = this.listen(dart.as((_) => { 434 subscription = this.listen(dart.as(_ => {
431 _cancelAndValue(subscription, future, false); 435 _cancelAndValue(subscription, future, false);
432 }, dart.throw_("Unimplemented type (T) → void")), { 436 }, dart.throw_("Unimplemented type (T) → void")), {
433 onError: future[_completeError], 437 onError: future[_completeError],
434 onDone: () => { 438 onDone: () => {
435 future[_complete](true); 439 future[_complete](true);
436 }, 440 },
437 cancelOnError: true 441 cancelOnError: true
438 }); 442 });
439 return future; 443 return future;
440 } 444 }
441 toList() { 445 toList() {
442 let result = new core.List$(T).from([]); 446 let result = new core.List$(T).from([]);
443 let future = new (_Future$(core.List$(T)))(); 447 let future = new (_Future$(core.List$(T)))();
444 this.listen((data) => { 448 this.listen(data => {
445 result[core.$add](data); 449 result[core.$add](data);
446 }, { 450 }, {
447 onError: future[_completeError], 451 onError: future[_completeError],
448 onDone: () => { 452 onDone: () => {
449 future[_complete](result); 453 future[_complete](result);
450 }, 454 },
451 cancelOnError: true 455 cancelOnError: true
452 }); 456 });
453 return future; 457 return future;
454 } 458 }
455 toSet() { 459 toSet() {
456 let result = new (core.Set$(T))(); 460 let result = new (core.Set$(T))();
457 let future = new (_Future$(core.Set$(T)))(); 461 let future = new (_Future$(core.Set$(T)))();
458 this.listen((data) => { 462 this.listen(data => {
459 result.add(data); 463 result.add(data);
460 }, { 464 }, {
461 onError: future[_completeError], 465 onError: future[_completeError],
462 onDone: () => { 466 onDone: () => {
463 future[_complete](result); 467 future[_complete](result);
464 }, 468 },
465 cancelOnError: true 469 cancelOnError: true
466 }); 470 });
467 return future; 471 return future;
468 } 472 }
(...skipping 15 matching lines...) Expand all
484 return dart.as(new _SkipWhileStream(this, test), Stream$(T)); 488 return dart.as(new _SkipWhileStream(this, test), Stream$(T));
485 } 489 }
486 distinct(equals) { 490 distinct(equals) {
487 if (equals === void 0) 491 if (equals === void 0)
488 equals = null; 492 equals = null;
489 return dart.as(new _DistinctStream(this, equals), Stream$(T)); 493 return dart.as(new _DistinctStream(this, equals), Stream$(T));
490 } 494 }
491 get first() { 495 get first() {
492 let future = new (_Future$(T))(); 496 let future = new (_Future$(T))();
493 let subscription = null; 497 let subscription = null;
494 subscription = this.listen((value) => { 498 subscription = this.listen(value => {
495 _cancelAndValue(subscription, future, value); 499 _cancelAndValue(subscription, future, value);
496 }, { 500 }, {
497 onError: future[_completeError], 501 onError: future[_completeError],
498 onDone: () => { 502 onDone: () => {
499 try { 503 try {
500 throw _internal.IterableElementError.noElement(); 504 throw _internal.IterableElementError.noElement();
501 } catch (e) { 505 } catch (e) {
502 let s = dart.stackTrace(e); 506 let s = dart.stackTrace(e);
503 _completeWithErrorCallback(future, e, s); 507 _completeWithErrorCallback(future, e, s);
504 } 508 }
505 509
506 }, 510 },
507 cancelOnError: true 511 cancelOnError: true
508 }); 512 });
509 return future; 513 return future;
510 } 514 }
511 get last() { 515 get last() {
512 let future = new (_Future$(T))(); 516 let future = new (_Future$(T))();
513 let result = null; 517 let result = null;
514 let foundResult = false; 518 let foundResult = false;
515 let subscription = null; 519 let subscription = null;
516 subscription = this.listen((value) => { 520 subscription = this.listen(value => {
517 foundResult = true; 521 foundResult = true;
518 result = value; 522 result = value;
519 }, { 523 }, {
520 onError: future[_completeError], 524 onError: future[_completeError],
521 onDone: () => { 525 onDone: () => {
522 if (foundResult) { 526 if (foundResult) {
523 future[_complete](result); 527 future[_complete](result);
524 return; 528 return;
525 } 529 }
526 try { 530 try {
527 throw _internal.IterableElementError.noElement(); 531 throw _internal.IterableElementError.noElement();
528 } catch (e) { 532 } catch (e) {
529 let s = dart.stackTrace(e); 533 let s = dart.stackTrace(e);
530 _completeWithErrorCallback(future, e, s); 534 _completeWithErrorCallback(future, e, s);
531 } 535 }
532 536
533 }, 537 },
534 cancelOnError: true 538 cancelOnError: true
535 }); 539 });
536 return future; 540 return future;
537 } 541 }
538 get single() { 542 get single() {
539 let future = new (_Future$(T))(); 543 let future = new (_Future$(T))();
540 let result = null; 544 let result = null;
541 let foundResult = false; 545 let foundResult = false;
542 let subscription = null; 546 let subscription = null;
543 subscription = this.listen((value) => { 547 subscription = this.listen(value => {
544 if (foundResult) { 548 if (foundResult) {
545 try { 549 try {
546 throw _internal.IterableElementError.tooMany(); 550 throw _internal.IterableElementError.tooMany();
547 } catch (e) { 551 } catch (e) {
548 let s = dart.stackTrace(e); 552 let s = dart.stackTrace(e);
549 _cancelAndErrorWithReplacement(subscription, future, e, s); 553 _cancelAndErrorWithReplacement(subscription, future, e, s);
550 } 554 }
551 555
552 return; 556 return;
553 } 557 }
(...skipping 15 matching lines...) Expand all
569 573
570 }, 574 },
571 cancelOnError: true 575 cancelOnError: true
572 }); 576 });
573 return future; 577 return future;
574 } 578 }
575 firstWhere(test, opts) { 579 firstWhere(test, opts) {
576 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null; 580 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null;
577 let future = new _Future(); 581 let future = new _Future();
578 let subscription = null; 582 let subscription = null;
579 subscription = this.listen((value) => { 583 subscription = this.listen(value => {
580 _runUserCode(() => test(value), (isMatch) => { 584 _runUserCode(() => test(value), isMatch => {
581 if (isMatch) { 585 if (isMatch) {
582 _cancelAndValue(subscription, future, value); 586 _cancelAndValue(subscription, future, value);
583 } 587 }
584 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 588 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
585 }, { 589 }, {
586 onError: future[_completeError], 590 onError: future[_completeError],
587 onDone: () => { 591 onDone: () => {
588 if (defaultValue != null) { 592 if (defaultValue != null) {
589 _runUserCode(defaultValue, future[_complete], future[_completeErro r]); 593 _runUserCode(defaultValue, future[_complete], future[_completeErro r]);
590 return; 594 return;
591 } 595 }
592 try { 596 try {
593 throw _internal.IterableElementError.noElement(); 597 throw _internal.IterableElementError.noElement();
594 } catch (e) { 598 } catch (e) {
595 let s = dart.stackTrace(e); 599 let s = dart.stackTrace(e);
596 _completeWithErrorCallback(future, e, s); 600 _completeWithErrorCallback(future, e, s);
597 } 601 }
598 602
599 }, 603 },
600 cancelOnError: true 604 cancelOnError: true
601 }); 605 });
602 return future; 606 return future;
603 } 607 }
604 lastWhere(test, opts) { 608 lastWhere(test, opts) {
605 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null; 609 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null;
606 let future = new _Future(); 610 let future = new _Future();
607 let result = null; 611 let result = null;
608 let foundResult = false; 612 let foundResult = false;
609 let subscription = null; 613 let subscription = null;
610 subscription = this.listen((value) => { 614 subscription = this.listen(value => {
611 _runUserCode(() => true == test(value), (isMatch) => { 615 _runUserCode(() => true == test(value), isMatch => {
612 if (isMatch) { 616 if (isMatch) {
613 foundResult = true; 617 foundResult = true;
614 result = value; 618 result = value;
615 } 619 }
616 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic"))); 620 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_(" Unimplemented type (dynamic, StackTrace) → dynamic")));
617 }, { 621 }, {
618 onError: future[_completeError], 622 onError: future[_completeError],
619 onDone: () => { 623 onDone: () => {
620 if (foundResult) { 624 if (foundResult) {
621 future[_complete](result); 625 future[_complete](result);
(...skipping 13 matching lines...) Expand all
635 }, 639 },
636 cancelOnError: true 640 cancelOnError: true
637 }); 641 });
638 return future; 642 return future;
639 } 643 }
640 singleWhere(test) { 644 singleWhere(test) {
641 let future = new (_Future$(T))(); 645 let future = new (_Future$(T))();
642 let result = null; 646 let result = null;
643 let foundResult = false; 647 let foundResult = false;
644 let subscription = null; 648 let subscription = null;
645 subscription = this.listen((value) => { 649 subscription = this.listen(value => {
646 _runUserCode(() => true == test(value), (isMatch) => { 650 _runUserCode(() => true == test(value), isMatch => {
647 if (isMatch) { 651 if (isMatch) {
648 if (foundResult) { 652 if (foundResult) {
649 try { 653 try {
650 throw _internal.IterableElementError.tooMany(); 654 throw _internal.IterableElementError.tooMany();
651 } catch (e) { 655 } catch (e) {
652 let s = dart.stackTrace(e); 656 let s = dart.stackTrace(e);
653 _cancelAndErrorWithReplacement(subscription, future, e, s); 657 _cancelAndErrorWithReplacement(subscription, future, e, s);
654 } 658 }
655 659
656 return; 660 return;
(...skipping 20 matching lines...) Expand all
677 cancelOnError: true 681 cancelOnError: true
678 }); 682 });
679 return future; 683 return future;
680 } 684 }
681 elementAt(index) { 685 elementAt(index) {
682 if (dart.notNull(!(typeof index == 'number')) || dart.notNull(index) < 0 ) 686 if (dart.notNull(!(typeof index == 'number')) || dart.notNull(index) < 0 )
683 throw new core.ArgumentError(index); 687 throw new core.ArgumentError(index);
684 let future = new (_Future$(T))(); 688 let future = new (_Future$(T))();
685 let subscription = null; 689 let subscription = null;
686 let elementIndex = 0; 690 let elementIndex = 0;
687 subscription = this.listen((value) => { 691 subscription = this.listen(value => {
688 if (index == elementIndex) { 692 if (index == elementIndex) {
689 _cancelAndValue(subscription, future, value); 693 _cancelAndValue(subscription, future, value);
690 return; 694 return;
691 } 695 }
692 elementIndex = 1; 696 elementIndex = dart.notNull(elementIndex) + 1;
693 }, { 697 }, {
694 onError: future[_completeError], 698 onError: future[_completeError],
695 onDone: (() => { 699 onDone: (() => {
696 future[_completeError](new core.RangeError.index(index, this, "index ", null, elementIndex)); 700 future[_completeError](new core.RangeError.index(index, this, "index ", null, elementIndex));
697 }).bind(this), 701 }).bind(this),
698 cancelOnError: true 702 cancelOnError: true
699 }); 703 });
700 return future; 704 return future;
701 } 705 }
702 timeout(timeLimit, opts) { 706 timeout(timeLimit, opts) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 this.onData(onData); 900 this.onData(onData);
897 this.onError(onError); 901 this.onError(onError);
898 this.onDone(onDone); 902 this.onDone(onDone);
899 } 903 }
900 [_setPendingEvents](pendingEvents) { 904 [_setPendingEvents](pendingEvents) {
901 dart.assert(this[_pending] == null); 905 dart.assert(this[_pending] == null);
902 if (pendingEvents == null) 906 if (pendingEvents == null)
903 return; 907 return;
904 this[_pending] = pendingEvents; 908 this[_pending] = pendingEvents;
905 if (!dart.notNull(pendingEvents.isEmpty)) { 909 if (!dart.notNull(pendingEvents.isEmpty)) {
906 this[_state] = _BufferingStreamSubscription[_STATE_HAS_PENDING]; 910 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_HAS_PENDING]);
907 this[_pending].schedule(this); 911 this[_pending].schedule(this);
908 } 912 }
909 } 913 }
910 [_extractPending]() { 914 [_extractPending]() {
911 dart.assert(this[_isCanceled]); 915 dart.assert(this[_isCanceled]);
912 let events = this[_pending]; 916 let events = this[_pending];
913 this[_pending] = null; 917 this[_pending] = null;
914 return events; 918 return events;
915 } 919 }
916 onData(handleData) { 920 onData(handleData) {
(...skipping 29 matching lines...) Expand all
946 resume() { 950 resume() {
947 if (this[_isCanceled]) 951 if (this[_isCanceled])
948 return; 952 return;
949 if (this[_isPaused]) { 953 if (this[_isPaused]) {
950 this[_decrementPauseCount](); 954 this[_decrementPauseCount]();
951 if (!dart.notNull(this[_isPaused])) { 955 if (!dart.notNull(this[_isPaused])) {
952 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) { 956 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) {
953 this[_pending].schedule(this); 957 this[_pending].schedule(this);
954 } else { 958 } else {
955 dart.assert(this[_mayResumeInput]); 959 dart.assert(this[_mayResumeInput]);
956 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_I NPUT_PAUSED]); 960 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi ngStreamSubscription[_STATE_INPUT_PAUSED]);
957 if (!dart.notNull(this[_inCallback])) 961 if (!dart.notNull(this[_inCallback]))
958 this[_guardCallback](this[_onResume]); 962 this[_guardCallback](this[_onResume]);
959 } 963 }
960 } 964 }
961 } 965 }
962 } 966 }
963 cancel() { 967 cancel() {
964 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_WAIT_FO R_CANCEL]); 968 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription[_STATE_WAIT_FOR_CANCEL]);
965 if (this[_isCanceled]) 969 if (this[_isCanceled])
966 return this[_cancelFuture]; 970 return this[_cancelFuture];
967 this[_cancel](); 971 this[_cancel]();
968 return this[_cancelFuture]; 972 return this[_cancelFuture];
969 } 973 }
970 asFuture(futureValue) { 974 asFuture(futureValue) {
971 if (futureValue === void 0) 975 if (futureValue === void 0)
972 futureValue = null; 976 futureValue = null;
973 let result = new (_Future$(T))(); 977 let result = new (_Future$(T))();
974 this[_onDone] = () => { 978 this[_onDone] = () => {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 get [_mayResumeInput]() { 1011 get [_mayResumeInput]() {
1008 return !dart.notNull(this[_isPaused]) && (dart.notNull(this[_pending] == null) || dart.notNull(this[_pending].isEmpty)); 1012 return !dart.notNull(this[_isPaused]) && (dart.notNull(this[_pending] == null) || dart.notNull(this[_pending].isEmpty));
1009 } 1013 }
1010 get [_cancelOnError]() { 1014 get [_cancelOnError]() {
1011 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr iption[_STATE_CANCEL_ON_ERROR])) != 0; 1015 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr iption[_STATE_CANCEL_ON_ERROR])) != 0;
1012 } 1016 }
1013 get isPaused() { 1017 get isPaused() {
1014 return this[_isPaused]; 1018 return this[_isPaused];
1015 } 1019 }
1016 [_cancel]() { 1020 [_cancel]() {
1017 this[_state] = _BufferingStreamSubscription[_STATE_CANCELED]; 1021 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_CANCELED]);
1018 if (this[_hasPending]) { 1022 if (this[_hasPending]) {
1019 this[_pending].cancelSchedule(); 1023 this[_pending].cancelSchedule();
1020 } 1024 }
1021 if (!dart.notNull(this[_inCallback])) 1025 if (!dart.notNull(this[_inCallback]))
1022 this[_pending] = null; 1026 this[_pending] = null;
1023 this[_cancelFuture] = this[_onCancel](); 1027 this[_cancelFuture] = this[_onCancel]();
1024 } 1028 }
1025 [_incrementPauseCount]() { 1029 [_incrementPauseCount]() {
1026 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription[_STATE_PAUSE_COUNT]) | dart.notNull(_BufferingStreamSubscription[_ STATE_INPUT_PAUSED]); 1030 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription[_STATE_PAUSE_COUNT]) | dart.notNull(_BufferingStreamSubscription[_ STATE_INPUT_PAUSED]);
1027 } 1031 }
1028 [_decrementPauseCount]() { 1032 [_decrementPauseCount]() {
1029 dart.assert(this[_isPaused]); 1033 dart.assert(this[_isPaused]);
1030 this[_state] = _BufferingStreamSubscription[_STATE_PAUSE_COUNT]; 1034 this[_state] = dart.notNull(this[_state]) - dart.notNull(_BufferingStrea mSubscription[_STATE_PAUSE_COUNT]);
1031 } 1035 }
1032 [_add](data) { 1036 [_add](data) {
1033 dart.assert(!dart.notNull(this[_isClosed])); 1037 dart.assert(!dart.notNull(this[_isClosed]));
1034 if (this[_isCanceled]) 1038 if (this[_isCanceled])
1035 return; 1039 return;
1036 if (this[_canFire]) { 1040 if (this[_canFire]) {
1037 this[_sendData](data); 1041 this[_sendData](data);
1038 } else { 1042 } else {
1039 this[_addPending](new _DelayedData(data)); 1043 this[_addPending](new _DelayedData(data));
1040 } 1044 }
1041 } 1045 }
1042 [_addError](error, stackTrace) { 1046 [_addError](error, stackTrace) {
1043 if (this[_isCanceled]) 1047 if (this[_isCanceled])
1044 return; 1048 return;
1045 if (this[_canFire]) { 1049 if (this[_canFire]) {
1046 this[_sendError](error, stackTrace); 1050 this[_sendError](error, stackTrace);
1047 } else { 1051 } else {
1048 this[_addPending](new _DelayedError(error, stackTrace)); 1052 this[_addPending](new _DelayedError(error, stackTrace));
1049 } 1053 }
1050 } 1054 }
1051 [_close]() { 1055 [_close]() {
1052 dart.assert(!dart.notNull(this[_isClosed])); 1056 dart.assert(!dart.notNull(this[_isClosed]));
1053 if (this[_isCanceled]) 1057 if (this[_isCanceled])
1054 return; 1058 return;
1055 this[_state] = _BufferingStreamSubscription[_STATE_CLOSED]; 1059 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_CLOSED]);
1056 if (this[_canFire]) { 1060 if (this[_canFire]) {
1057 this[_sendDone](); 1061 this[_sendDone]();
1058 } else { 1062 } else {
1059 this[_addPending](new _DelayedDone()); 1063 this[_addPending](new _DelayedDone());
1060 } 1064 }
1061 } 1065 }
1062 [_onPause]() { 1066 [_onPause]() {
1063 dart.assert(this[_isInputPaused]); 1067 dart.assert(this[_isInputPaused]);
1064 } 1068 }
1065 [_onResume]() { 1069 [_onResume]() {
1066 dart.assert(!dart.notNull(this[_isInputPaused])); 1070 dart.assert(!dart.notNull(this[_isInputPaused]));
1067 } 1071 }
1068 [_onCancel]() { 1072 [_onCancel]() {
1069 dart.assert(this[_isCanceled]); 1073 dart.assert(this[_isCanceled]);
1070 return null; 1074 return null;
1071 } 1075 }
1072 [_addPending](event) { 1076 [_addPending](event) {
1073 let pending = dart.as(this[_pending], _StreamImplEvents); 1077 let pending = dart.as(this[_pending], _StreamImplEvents);
1074 if (this[_pending] == null) 1078 if (this[_pending] == null)
1075 pending = this[_pending] = new _StreamImplEvents(); 1079 pending = this[_pending] = new _StreamImplEvents();
1076 pending.add(event); 1080 pending.add(event);
1077 if (!dart.notNull(this[_hasPending])) { 1081 if (!dart.notNull(this[_hasPending])) {
1078 this[_state] = _BufferingStreamSubscription[_STATE_HAS_PENDING]; 1082 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_HAS_PENDING]);
1079 if (!dart.notNull(this[_isPaused])) { 1083 if (!dart.notNull(this[_isPaused])) {
1080 this[_pending].schedule(this); 1084 this[_pending].schedule(this);
1081 } 1085 }
1082 } 1086 }
1083 } 1087 }
1084 [_sendData](data) { 1088 [_sendData](data) {
1085 dart.assert(!dart.notNull(this[_isCanceled])); 1089 dart.assert(!dart.notNull(this[_isCanceled]));
1086 dart.assert(!dart.notNull(this[_isPaused])); 1090 dart.assert(!dart.notNull(this[_isPaused]));
1087 dart.assert(!dart.notNull(this[_inCallback])); 1091 dart.assert(!dart.notNull(this[_inCallback]));
1088 let wasInputPaused = this[_isInputPaused]; 1092 let wasInputPaused = this[_isInputPaused];
1089 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1093 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_IN_CALLBACK]);
1090 this[_zone].runUnaryGuarded(this[_onData], data); 1094 this[_zone].runUnaryGuarded(this[_onData], data);
1091 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CALL BACK]); 1095 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription[_STATE_IN_CALLBACK]);
1092 this[_checkState](wasInputPaused); 1096 this[_checkState](wasInputPaused);
1093 } 1097 }
1094 [_sendError](error, stackTrace) { 1098 [_sendError](error, stackTrace) {
1095 dart.assert(!dart.notNull(this[_isCanceled])); 1099 dart.assert(!dart.notNull(this[_isCanceled]));
1096 dart.assert(!dart.notNull(this[_isPaused])); 1100 dart.assert(!dart.notNull(this[_isPaused]));
1097 dart.assert(!dart.notNull(this[_inCallback])); 1101 dart.assert(!dart.notNull(this[_inCallback]));
1098 let wasInputPaused = this[_isInputPaused]; 1102 let wasInputPaused = this[_isInputPaused];
1099 // Function sendError: () → void 1103 // Function sendError: () → void
1100 function sendError() { 1104 function sendError() {
1101 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel])) 1105 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel]))
1102 return; 1106 return;
1103 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1107 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_IN_CALLBACK]);
1104 if (dart.is(this[_onError], ZoneBinaryCallback)) { 1108 if (dart.is(this[_onError], ZoneBinaryCallback)) {
1105 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.throw_("Un implemented type (dynamic, dynamic) → dynamic")), error, stackTrace); 1109 this[_zone].runBinaryGuarded(dart.as(this[_onError], dart.throw_("Un implemented type (dynamic, dynamic) → dynamic")), error, stackTrace);
1106 } else { 1110 } else {
1107 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.throw_("Uni mplemented type (dynamic) → dynamic")), error); 1111 this[_zone].runUnaryGuarded(dart.as(this[_onError], dart.throw_("Uni mplemented type (dynamic) → dynamic")), error);
1108 } 1112 }
1109 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1113 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_IN_CALLBACK]);
1110 } 1114 }
1111 if (this[_cancelOnError]) { 1115 if (this[_cancelOnError]) {
1112 this[_state] = _BufferingStreamSubscription[_STATE_WAIT_FOR_CANCEL]; 1116 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_WAIT_FOR_CANCEL]);
1113 this[_cancel](); 1117 this[_cancel]();
1114 if (dart.is(this[_cancelFuture], Future)) { 1118 if (dart.is(this[_cancelFuture], Future)) {
1115 this[_cancelFuture].whenComplete(sendError); 1119 this[_cancelFuture].whenComplete(sendError);
1116 } else { 1120 } else {
1117 sendError(); 1121 sendError();
1118 } 1122 }
1119 } else { 1123 } else {
1120 sendError(); 1124 sendError();
1121 this[_checkState](wasInputPaused); 1125 this[_checkState](wasInputPaused);
1122 } 1126 }
1123 } 1127 }
1124 [_sendDone]() { 1128 [_sendDone]() {
1125 dart.assert(!dart.notNull(this[_isCanceled])); 1129 dart.assert(!dart.notNull(this[_isCanceled]));
1126 dart.assert(!dart.notNull(this[_isPaused])); 1130 dart.assert(!dart.notNull(this[_isPaused]));
1127 dart.assert(!dart.notNull(this[_inCallback])); 1131 dart.assert(!dart.notNull(this[_inCallback]));
1128 // Function sendDone: () → void 1132 // Function sendDone: () → void
1129 function sendDone() { 1133 function sendDone() {
1130 if (!dart.notNull(this[_waitsForCancel])) 1134 if (!dart.notNull(this[_waitsForCancel]))
1131 return; 1135 return;
1132 this[_state] = dart.notNull(_BufferingStreamSubscription[_STATE_CANCEL ED]) | dart.notNull(_BufferingStreamSubscription[_STATE_CLOSED]) | dart.notNull( _BufferingStreamSubscription[_STATE_IN_CALLBACK]); 1136 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription[_STATE_CANCELED]) | dart.notNull(_BufferingStreamSubscription[_S TATE_CLOSED]) | dart.notNull(_BufferingStreamSubscription[_STATE_IN_CALLBACK]);
1133 this[_zone].runGuarded(this[_onDone]); 1137 this[_zone].runGuarded(this[_onDone]);
1134 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1138 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_IN_CALLBACK]);
1135 } 1139 }
1136 this[_cancel](); 1140 this[_cancel]();
1137 this[_state] = _BufferingStreamSubscription[_STATE_WAIT_FOR_CANCEL]; 1141 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_WAIT_FOR_CANCEL]);
1138 if (dart.is(this[_cancelFuture], Future)) { 1142 if (dart.is(this[_cancelFuture], Future)) {
1139 this[_cancelFuture].whenComplete(sendDone); 1143 this[_cancelFuture].whenComplete(sendDone);
1140 } else { 1144 } else {
1141 sendDone(); 1145 sendDone();
1142 } 1146 }
1143 } 1147 }
1144 [_guardCallback](callback) { 1148 [_guardCallback](callback) {
1145 dart.assert(!dart.notNull(this[_inCallback])); 1149 dart.assert(!dart.notNull(this[_inCallback]));
1146 let wasInputPaused = this[_isInputPaused]; 1150 let wasInputPaused = this[_isInputPaused];
1147 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1151 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription[_STATE_IN_CALLBACK]);
1148 dart.dinvokef(callback); 1152 dart.dinvokef(callback);
1149 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CALL BACK]); 1153 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription[_STATE_IN_CALLBACK]);
1150 this[_checkState](wasInputPaused); 1154 this[_checkState](wasInputPaused);
1151 } 1155 }
1152 [_checkState](wasInputPaused) { 1156 [_checkState](wasInputPaused) {
1153 dart.assert(!dart.notNull(this[_inCallback])); 1157 dart.assert(!dart.notNull(this[_inCallback]));
1154 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp ty)) { 1158 if (dart.notNull(this[_hasPending]) && dart.notNull(this[_pending].isEmp ty)) {
1155 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_HAS_P ENDING]); 1159 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_HAS_PENDING]);
1156 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) { 1160 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) {
1157 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_INP UT_PAUSED]); 1161 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Buffering StreamSubscription[_STATE_INPUT_PAUSED]);
1158 } 1162 }
1159 } 1163 }
1160 while (true) { 1164 while (true) {
1161 if (this[_isCanceled]) { 1165 if (this[_isCanceled]) {
1162 this[_pending] = null; 1166 this[_pending] = null;
1163 return; 1167 return;
1164 } 1168 }
1165 let isInputPaused = this[_isInputPaused]; 1169 let isInputPaused = this[_isInputPaused];
1166 if (wasInputPaused == isInputPaused) 1170 if (wasInputPaused == isInputPaused)
1167 break; 1171 break;
1168 this[_state] = _BufferingStreamSubscription[_STATE_IN_CALLBACK]; 1172 this[_state] = dart.notNull(this[_state]) ^ dart.notNull(_BufferingStr eamSubscription[_STATE_IN_CALLBACK]);
1169 if (isInputPaused) { 1173 if (isInputPaused) {
1170 this[_onPause](); 1174 this[_onPause]();
1171 } else { 1175 } else {
1172 this[_onResume](); 1176 this[_onResume]();
1173 } 1177 }
1174 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_IN_CA LLBACK]); 1178 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription[_STATE_IN_CALLBACK]);
1175 wasInputPaused = isInputPaused; 1179 wasInputPaused = isInputPaused;
1176 } 1180 }
1177 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) { 1181 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) {
1178 this[_pending].schedule(this); 1182 this[_pending].schedule(this);
1179 } 1183 }
1180 } 1184 }
1181 } 1185 }
1182 _BufferingStreamSubscription[dart.implements] = () => [StreamSubscription$(T ), _EventSink$(T), _EventDispatch$(T)]; 1186 _BufferingStreamSubscription[dart.implements] = () => [StreamSubscription$(T ), _EventSink$(T), _EventDispatch$(T)];
1183 _BufferingStreamSubscription._STATE_CANCEL_ON_ERROR = 1; 1187 _BufferingStreamSubscription._STATE_CANCEL_ON_ERROR = 1;
1184 _BufferingStreamSubscription._STATE_CLOSED = 2; 1188 _BufferingStreamSubscription._STATE_CLOSED = 2;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError); 1224 super._ControllerSubscription(dart.as(controller, _StreamControllerLifec ycle$(T)), onData, onError, onDone, cancelOnError);
1221 this[_next] = this[_previous] = this; 1225 this[_next] = this[_previous] = this;
1222 } 1226 }
1223 get [_controller]() { 1227 get [_controller]() {
1224 return dart.as(super[_controller], _BroadcastStreamController); 1228 return dart.as(super[_controller], _BroadcastStreamController);
1225 } 1229 }
1226 [_expectsEvent](eventId) { 1230 [_expectsEvent](eventId) {
1227 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_EVENT_ID])) == eventId; 1231 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_EVENT_ID])) == eventId;
1228 } 1232 }
1229 [_toggleEventId]() { 1233 [_toggleEventId]() {
1230 this[_eventState] = _BroadcastSubscription[_STATE_EVENT_ID]; 1234 this[_eventState] = dart.notNull(this[_eventState]) ^ dart.notNull(_Broa dcastSubscription[_STATE_EVENT_ID]);
1231 } 1235 }
1232 get [_isFiring]() { 1236 get [_isFiring]() {
1233 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_FIRING])) != 0; 1237 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_FIRING])) != 0;
1234 } 1238 }
1235 [_setRemoveAfterFiring]() { 1239 [_setRemoveAfterFiring]() {
1236 dart.assert(this[_isFiring]); 1240 dart.assert(this[_isFiring]);
1237 this[_eventState] = _BroadcastSubscription[_STATE_REMOVE_AFTER_FIRING]; 1241 this[_eventState] = dart.notNull(this[_eventState]) | dart.notNull(_Broa dcastSubscription[_STATE_REMOVE_AFTER_FIRING]);
1238 } 1242 }
1239 get [_removeAfterFiring]() { 1243 get [_removeAfterFiring]() {
1240 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_REMOVE_AFTER_FIRING])) != 0; 1244 return (dart.notNull(this[_eventState]) & dart.notNull(_BroadcastSubscri ption[_STATE_REMOVE_AFTER_FIRING])) != 0;
1241 } 1245 }
1242 [_onPause]() {} 1246 [_onPause]() {}
1243 [_onResume]() {} 1247 [_onResume]() {}
1244 } 1248 }
1245 _BroadcastSubscription[dart.implements] = () => [_BroadcastSubscriptionLink] ; 1249 _BroadcastSubscription[dart.implements] = () => [_BroadcastSubscriptionLink] ;
1246 _BroadcastSubscription._STATE_EVENT_ID = 1; 1250 _BroadcastSubscription._STATE_EVENT_ID = 1;
1247 _BroadcastSubscription._STATE_FIRING = 2; 1251 _BroadcastSubscription._STATE_FIRING = 2;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 } 1389 }
1386 this[_sendError](error, stackTrace); 1390 this[_sendError](error, stackTrace);
1387 } 1391 }
1388 close() { 1392 close() {
1389 if (this.isClosed) { 1393 if (this.isClosed) {
1390 dart.assert(this[_doneFuture] != null); 1394 dart.assert(this[_doneFuture] != null);
1391 return this[_doneFuture]; 1395 return this[_doneFuture];
1392 } 1396 }
1393 if (!dart.notNull(this[_mayAddEvent])) 1397 if (!dart.notNull(this[_mayAddEvent]))
1394 throw this[_addEventError](); 1398 throw this[_addEventError]();
1395 this[_state] = _BroadcastStreamController[_STATE_CLOSED]; 1399 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController[_STATE_CLOSED]);
1396 let doneFuture = this[_ensureDoneFuture](); 1400 let doneFuture = this[_ensureDoneFuture]();
1397 this[_sendDone](); 1401 this[_sendDone]();
1398 return doneFuture; 1402 return doneFuture;
1399 } 1403 }
1400 get done() { 1404 get done() {
1401 return this[_ensureDoneFuture](); 1405 return this[_ensureDoneFuture]();
1402 } 1406 }
1403 addStream(stream, opts) { 1407 addStream(stream, opts) {
1404 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 1408 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
1405 if (!dart.notNull(this[_mayAddEvent])) 1409 if (!dart.notNull(this[_mayAddEvent]))
1406 throw this[_addEventError](); 1410 throw this[_addEventError]();
1407 this[_state] = _BroadcastStreamController[_STATE_ADDSTREAM]; 1411 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController[_STATE_ADDSTREAM]);
1408 this[_addStreamState] = dart.as(new _AddStreamState(this, stream, cancel OnError), _AddStreamState$(T)); 1412 this[_addStreamState] = dart.as(new _AddStreamState(this, stream, cancel OnError), _AddStreamState$(T));
1409 return this[_addStreamState].addStreamFuture; 1413 return this[_addStreamState].addStreamFuture;
1410 } 1414 }
1411 [_add](data) { 1415 [_add](data) {
1412 this[_sendData](data); 1416 this[_sendData](data);
1413 } 1417 }
1414 [_addError](error, stackTrace) { 1418 [_addError](error, stackTrace) {
1415 this[_sendError](error, stackTrace); 1419 this[_sendError](error, stackTrace);
1416 } 1420 }
1417 [_close]() { 1421 [_close]() {
1418 dart.assert(this[_isAddingStream]); 1422 dart.assert(this[_isAddingStream]);
1419 let addState = this[_addStreamState]; 1423 let addState = this[_addStreamState];
1420 this[_addStreamState] = null; 1424 this[_addStreamState] = null;
1421 this[_state] = ~dart.notNull(_BroadcastStreamController[_STATE_ADDSTREAM ]); 1425 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre amController[_STATE_ADDSTREAM]);
1422 addState.complete(); 1426 addState.complete();
1423 } 1427 }
1424 [_forEachListener](action) { 1428 [_forEachListener](action) {
1425 if (this[_isFiring]) { 1429 if (this[_isFiring]) {
1426 throw new core.StateError("Cannot fire new event. Controller is alread y firing an event"); 1430 throw new core.StateError("Cannot fire new event. Controller is alread y firing an event");
1427 } 1431 }
1428 if (this[_isEmpty]) 1432 if (this[_isEmpty])
1429 return; 1433 return;
1430 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr oller[_STATE_EVENT_ID]); 1434 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr oller[_STATE_EVENT_ID]);
1431 this[_state] = dart.notNull(_BroadcastStreamController[_STATE_EVENT_ID]) | dart.notNull(_BroadcastStreamController[_STATE_FIRING]); 1435 this[_state] = dart.notNull(this[_state]) ^ (dart.notNull(_BroadcastStre amController[_STATE_EVENT_ID]) | dart.notNull(_BroadcastStreamController[_STATE_ FIRING]));
1432 let link = this[_next]; 1436 let link = this[_next];
1433 while (!dart.notNull(core.identical(link, this))) { 1437 while (!dart.notNull(core.identical(link, this))) {
1434 let subscription = dart.as(link, _BroadcastSubscription$(T)); 1438 let subscription = dart.as(link, _BroadcastSubscription$(T));
1435 if (subscription[_expectsEvent](id)) { 1439 if (subscription[_expectsEvent](id)) {
1436 subscription[_eventState] = _BroadcastSubscription[_STATE_FIRING]; 1440 subscription[_eventState] = dart.notNull(subscription[_eventState]) | dart.notNull(_BroadcastSubscription[_STATE_FIRING]);
1437 action(subscription); 1441 action(subscription);
1438 subscription[_toggleEventId](); 1442 subscription[_toggleEventId]();
1439 link = subscription[_next]; 1443 link = subscription[_next];
1440 if (subscription[_removeAfterFiring]) { 1444 if (subscription[_removeAfterFiring]) {
1441 this[_removeListener](subscription); 1445 this[_removeListener](subscription);
1442 } 1446 }
1443 subscription[_eventState] = ~dart.notNull(_BroadcastSubscription[_ST ATE_FIRING]); 1447 subscription[_eventState] = dart.notNull(subscription[_eventState]) & ~dart.notNull(_BroadcastSubscription[_STATE_FIRING]);
1444 } else { 1448 } else {
1445 link = subscription[_next]; 1449 link = subscription[_next];
1446 } 1450 }
1447 } 1451 }
1448 this[_state] = ~dart.notNull(_BroadcastStreamController[_STATE_FIRING]); 1452 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre amController[_STATE_FIRING]);
1449 if (this[_isEmpty]) { 1453 if (this[_isEmpty]) {
1450 this[_callOnCancel](); 1454 this[_callOnCancel]();
1451 } 1455 }
1452 } 1456 }
1453 [_callOnCancel]() { 1457 [_callOnCancel]() {
1454 dart.assert(this[_isEmpty]); 1458 dart.assert(this[_isEmpty]);
1455 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo mplete])) { 1459 if (dart.notNull(this.isClosed) && dart.notNull(this[_doneFuture][_mayCo mplete])) {
1456 this[_doneFuture][_asyncComplete](null); 1460 this[_doneFuture][_asyncComplete](null);
1457 } 1461 }
1458 _runGuarded(this[_onCancel]); 1462 _runGuarded(this[_onCancel]);
(...skipping 10 matching lines...) Expand all
1469 let _BroadcastStreamController = _BroadcastStreamController$(); 1473 let _BroadcastStreamController = _BroadcastStreamController$();
1470 let _SyncBroadcastStreamController$ = dart.generic(function(T) { 1474 let _SyncBroadcastStreamController$ = dart.generic(function(T) {
1471 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) { 1475 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) {
1472 _SyncBroadcastStreamController(onListen, onCancel) { 1476 _SyncBroadcastStreamController(onListen, onCancel) {
1473 super._BroadcastStreamController(onListen, onCancel); 1477 super._BroadcastStreamController(onListen, onCancel);
1474 } 1478 }
1475 [_sendData](data) { 1479 [_sendData](data) {
1476 if (this[_isEmpty]) 1480 if (this[_isEmpty])
1477 return; 1481 return;
1478 if (this[_hasOneListener]) { 1482 if (this[_hasOneListener]) {
1479 this[_state] = _BroadcastStreamController[_STATE_FIRING]; 1483 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController[_STATE_FIRING]);
1480 let subscription = dart.as(this[_next], _BroadcastSubscription); 1484 let subscription = dart.as(this[_next], _BroadcastSubscription);
1481 subscription[_add](data); 1485 subscription[_add](data);
1482 this[_state] = ~dart.notNull(_BroadcastStreamController[_STATE_FIRING] ); 1486 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastSt reamController[_STATE_FIRING]);
1483 if (this[_isEmpty]) { 1487 if (this[_isEmpty]) {
1484 this[_callOnCancel](); 1488 this[_callOnCancel]();
1485 } 1489 }
1486 return; 1490 return;
1487 } 1491 }
1488 this[_forEachListener]((subscription) => { 1492 this[_forEachListener](subscription => {
1489 subscription[_add](data); 1493 subscription[_add](data);
1490 }); 1494 });
1491 } 1495 }
1492 [_sendError](error, stackTrace) { 1496 [_sendError](error, stackTrace) {
1493 if (this[_isEmpty]) 1497 if (this[_isEmpty])
1494 return; 1498 return;
1495 this[_forEachListener]((subscription) => { 1499 this[_forEachListener](subscription => {
1496 subscription[_addError](error, stackTrace); 1500 subscription[_addError](error, stackTrace);
1497 }); 1501 });
1498 } 1502 }
1499 [_sendDone]() { 1503 [_sendDone]() {
1500 if (!dart.notNull(this[_isEmpty])) { 1504 if (!dart.notNull(this[_isEmpty])) {
1501 this[_forEachListener](dart.as((subscription) => { 1505 this[_forEachListener](dart.as(subscription => {
1502 subscription[_close](); 1506 subscription[_close]();
1503 }, dart.throw_("Unimplemented type (_BufferingStreamSubscription<T>) → void"))); 1507 }, dart.throw_("Unimplemented type (_BufferingStreamSubscription<T>) → void")));
1504 } else { 1508 } else {
1505 dart.assert(this[_doneFuture] != null); 1509 dart.assert(this[_doneFuture] != null);
1506 dart.assert(this[_doneFuture][_mayComplete]); 1510 dart.assert(this[_doneFuture][_mayComplete]);
1507 this[_doneFuture][_asyncComplete](null); 1511 this[_doneFuture][_asyncComplete](null);
1508 } 1512 }
1509 } 1513 }
1510 } 1514 }
1511 return _SyncBroadcastStreamController; 1515 return _SyncBroadcastStreamController;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 if (!dart.notNull(this[_mayAddEvent])) 1584 if (!dart.notNull(this[_mayAddEvent]))
1581 throw this[_addEventError](); 1585 throw this[_addEventError]();
1582 this[_sendError](error, stackTrace); 1586 this[_sendError](error, stackTrace);
1583 while (this[_hasPending]) { 1587 while (this[_hasPending]) {
1584 this[_pending].handleNext(this); 1588 this[_pending].handleNext(this);
1585 } 1589 }
1586 } 1590 }
1587 close() { 1591 close() {
1588 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { 1592 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) {
1589 this[_addPendingEvent](new _DelayedDone()); 1593 this[_addPendingEvent](new _DelayedDone());
1590 this[_state] = _BroadcastStreamController[_STATE_CLOSED]; 1594 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController[_STATE_CLOSED]);
1591 return super.done; 1595 return super.done;
1592 } 1596 }
1593 let result = super.close(); 1597 let result = super.close();
1594 dart.assert(!dart.notNull(this[_hasPending])); 1598 dart.assert(!dart.notNull(this[_hasPending]));
1595 return result; 1599 return result;
1596 } 1600 }
1597 [_callOnCancel]() { 1601 [_callOnCancel]() {
1598 if (this[_hasPending]) { 1602 if (this[_hasPending]) {
1599 this[_pending].clear(); 1603 this[_pending].clear();
1600 this[_pending] = null; 1604 this[_pending] = null;
(...skipping 19 matching lines...) Expand all
1620 if (resumeSignal === void 0) 1624 if (resumeSignal === void 0)
1621 resumeSignal = null; 1625 resumeSignal = null;
1622 if (resumeSignal != null) 1626 if (resumeSignal != null)
1623 resumeSignal.then(this[_resume]); 1627 resumeSignal.then(this[_resume]);
1624 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1; 1628 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
1625 } 1629 }
1626 resume() { 1630 resume() {
1627 this[_resume](null); 1631 this[_resume](null);
1628 } 1632 }
1629 [_resume](_) { 1633 [_resume](_) {
1630 if (dart.notNull(this[_pauseCount]) > 0) 1634 if (dart.notNull(this[_pauseCount]) > 0) {
1631 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1; 1635 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1;
1636 }
1632 } 1637 }
1633 cancel() { 1638 cancel() {
1634 return new _Future.immediate(null); 1639 return new _Future.immediate(null);
1635 } 1640 }
1636 get isPaused() { 1641 get isPaused() {
1637 return dart.notNull(this[_pauseCount]) > 0; 1642 return dart.notNull(this[_pauseCount]) > 0;
1638 } 1643 }
1639 asFuture(value) { 1644 asFuture(value) {
1640 if (value === void 0) 1645 if (value === void 0)
1641 value = null; 1646 value = null;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 result[_completeError](theError, dart.as(theStackTrace, core.Stack Trace)); 1769 result[_completeError](theError, dart.as(theStackTrace, core.Stack Trace));
1765 } else { 1770 } else {
1766 error = theError; 1771 error = theError;
1767 stackTrace = dart.as(theStackTrace, core.StackTrace); 1772 stackTrace = dart.as(theStackTrace, core.StackTrace);
1768 } 1773 }
1769 } else if (remaining == 0 && !dart.notNull(eagerError)) { 1774 } else if (remaining == 0 && !dart.notNull(eagerError)) {
1770 result[_completeError](error, stackTrace); 1775 result[_completeError](error, stackTrace);
1771 } 1776 }
1772 } 1777 }
1773 for (let future of futures) { 1778 for (let future of futures) {
1774 let pos = ((x) => remaining = dart.notNull(x) + 1, x)(remaining); 1779 let pos = remaining;
1775 future.then((value) => { 1780 remaining = dart.notNull(pos) + 1;
1781 future.then(value => {
1776 remaining = dart.notNull(remaining) - 1; 1782 remaining = dart.notNull(remaining) - 1;
1777 if (values != null) { 1783 if (values != null) {
1778 values[core.$set](pos, value); 1784 values[core.$set](pos, value);
1779 if (remaining == 0) { 1785 if (remaining == 0) {
1780 result[_completeWithValue](values); 1786 result[_completeWithValue](values);
1781 } 1787 }
1782 } else { 1788 } else {
1783 if (dart.notNull(cleanUp != null) && dart.notNull(value != null)) { 1789 if (dart.notNull(cleanUp != null) && dart.notNull(value != null)) {
1784 new Future.sync(() => { 1790 new Future.sync(() => {
1785 dart.dinvokef(cleanUp, value); 1791 dart.dinvokef(cleanUp, value);
1786 }); 1792 });
1787 } 1793 }
1788 if (remaining == 0 && !dart.notNull(eagerError)) { 1794 if (remaining == 0 && !dart.notNull(eagerError)) {
1789 result[_completeError](error, stackTrace); 1795 result[_completeError](error, stackTrace);
1790 } 1796 }
1791 } 1797 }
1792 }, {onError: handleError}); 1798 }, {onError: handleError});
1793 } 1799 }
1794 if (remaining == 0) { 1800 if (remaining == 0) {
1795 return dart.as(new Future.value(/* Unimplemented const */new core.List .from([])), Future$(core.List)); 1801 return dart.as(new Future.value(/* Unimplemented const */new core.List .from([])), Future$(core.List));
1796 } 1802 }
1797 values = new core.List(remaining); 1803 values = new core.List(remaining);
1798 return result; 1804 return result;
1799 } 1805 }
1800 static forEach(input, f) { 1806 static forEach(input, f) {
1801 let iterator = input[core.$iterator]; 1807 let iterator = input[core.$iterator];
1802 return Future.doWhile(() => { 1808 return Future.doWhile(() => {
1803 if (!dart.notNull(iterator.moveNext())) 1809 if (!dart.notNull(iterator.moveNext()))
1804 return false; 1810 return false;
1805 return new Future.sync(() => dart.dinvokef(f, iterator.current)).then( (_) => true); 1811 return new Future.sync(() => dart.dinvokef(f, iterator.current)).then( _ => true);
1806 }); 1812 });
1807 } 1813 }
1808 static doWhile(f) { 1814 static doWhile(f) {
1809 let doneSignal = new _Future(); 1815 let doneSignal = new _Future();
1810 let nextIteration = null; 1816 let nextIteration = null;
1811 nextIteration = Zone.current.bindUnaryCallback((keepGoing) => { 1817 nextIteration = Zone.current.bindUnaryCallback(keepGoing => {
1812 if (keepGoing) { 1818 if (keepGoing) {
1813 new Future.sync(f).then(dart.as(nextIteration, dart.throw_("Unimplem ented type (dynamic) → dynamic")), {onError: doneSignal[_completeError]}); 1819 new Future.sync(f).then(dart.as(nextIteration, dart.throw_("Unimplem ented type (dynamic) → dynamic")), {onError: doneSignal[_completeError]});
1814 } else { 1820 } else {
1815 doneSignal[_complete](null); 1821 doneSignal[_complete](null);
1816 } 1822 }
1817 }, {runGuarded: true}); 1823 }, {runGuarded: true});
1818 dart.dinvokef(nextIteration, true); 1824 dart.dinvokef(nextIteration, true);
1819 return doneSignal; 1825 return doneSignal;
1820 } 1826 }
1821 } 1827 }
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 current[_nextListener] = prev; 2173 current[_nextListener] = prev;
2168 prev = current; 2174 prev = current;
2169 current = next; 2175 current = next;
2170 } 2176 }
2171 return prev; 2177 return prev;
2172 } 2178 }
2173 static [_chainForeignFuture](source, target) { 2179 static [_chainForeignFuture](source, target) {
2174 dart.assert(!dart.notNull(target[_isComplete])); 2180 dart.assert(!dart.notNull(target[_isComplete]));
2175 dart.assert(!dart.is(source, _Future)); 2181 dart.assert(!dart.is(source, _Future));
2176 target[_isChained] = true; 2182 target[_isChained] = true;
2177 source.then((value) => { 2183 source.then(value => {
2178 dart.assert(target[_isChained]); 2184 dart.assert(target[_isChained]);
2179 target[_completeWithValue](value); 2185 target[_completeWithValue](value);
2180 }, { 2186 }, {
2181 onError: (error, stackTrace) => { 2187 onError: (error, stackTrace) => {
2182 if (stackTrace === void 0) 2188 if (stackTrace === void 0)
2183 stackTrace = null; 2189 stackTrace = null;
2184 dart.assert(target[_isChained]); 2190 dart.assert(target[_isChained]);
2185 target[_completeError](error, dart.as(stackTrace, core.StackTrace)); 2191 target[_completeError](error, dart.as(stackTrace, core.StackTrace));
2186 } 2192 }
2187 }); 2193 });
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 listenerValueOrError = new AsyncError(e, s); 2361 listenerValueOrError = new AsyncError(e, s);
2356 } 2362 }
2357 listenerHasValue = false; 2363 listenerHasValue = false;
2358 return; 2364 return;
2359 } 2365 }
2360 2366
2361 if (dart.is(completeResult, Future)) { 2367 if (dart.is(completeResult, Future)) {
2362 let result = listener.result; 2368 let result = listener.result;
2363 result[_isChained] = true; 2369 result[_isChained] = true;
2364 isPropagationAborted = true; 2370 isPropagationAborted = true;
2365 dart.dinvoke(completeResult, 'then', (ignored) => { 2371 dart.dinvoke(completeResult, 'then', ignored => {
2366 _Future[_propagateToListeners](source, new _FutureListener.cha in(result)); 2372 _Future[_propagateToListeners](source, new _FutureListener.cha in(result));
2367 }, { 2373 }, {
2368 onError: (error, stackTrace) => { 2374 onError: (error, stackTrace) => {
2369 if (stackTrace === void 0) 2375 if (stackTrace === void 0)
2370 stackTrace = null; 2376 stackTrace = null;
2371 if (!dart.is(completeResult, _Future)) { 2377 if (!dart.is(completeResult, _Future)) {
2372 completeResult = new _Future(); 2378 completeResult = new _Future();
2373 dart.dinvoke(completeResult, '_setError', error, stackTrac e); 2379 dart.dinvoke(completeResult, '_setError', error, stackTrac e);
2374 } 2380 }
2375 _Future[_propagateToListeners](dart.as(completeResult, _Futu re), new _FutureListener.chain(result)); 2381 _Future[_propagateToListeners](dart.as(completeResult, _Futu re), new _FutureListener.chain(result));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 timer = new Timer(timeLimit, () => { 2442 timer = new Timer(timeLimit, () => {
2437 try { 2443 try {
2438 result[_complete](zone.run(onTimeout)); 2444 result[_complete](zone.run(onTimeout));
2439 } catch (e) { 2445 } catch (e) {
2440 let s = dart.stackTrace(e); 2446 let s = dart.stackTrace(e);
2441 result[_completeError](e, s); 2447 result[_completeError](e, s);
2442 } 2448 }
2443 2449
2444 }); 2450 });
2445 } 2451 }
2446 this.then((v) => { 2452 this.then(v => {
2447 if (timer.isActive) { 2453 if (timer.isActive) {
2448 timer.cancel(); 2454 timer.cancel();
2449 result[_completeWithValue](v); 2455 result[_completeWithValue](v);
2450 } 2456 }
2451 }, { 2457 }, {
2452 onError: (e, s) => { 2458 onError: (e, s) => {
2453 if (timer.isActive) { 2459 if (timer.isActive) {
2454 timer.cancel(); 2460 timer.cancel();
2455 result[_completeError](e, dart.as(s, core.StackTrace)); 2461 result[_completeError](e, dart.as(s, core.StackTrace));
2456 } 2462 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 // Function internalCallback: (dynamic) → dynamic 2571 // Function internalCallback: (dynamic) → dynamic
2566 function internalCallback(_) { 2572 function internalCallback(_) {
2567 _isolate_helper.leaveJsAsync(); 2573 _isolate_helper.leaveJsAsync();
2568 let f = storedCallback; 2574 let f = storedCallback;
2569 storedCallback = null; 2575 storedCallback = null;
2570 dart.dinvokef(f); 2576 dart.dinvokef(f);
2571 } 2577 }
2572 ; 2578 ;
2573 let observer = new self.MutationObserver(_js_helper.convertDartClosureTo JS(internalCallback, 1)); 2579 let observer = new self.MutationObserver(_js_helper.convertDartClosureTo JS(internalCallback, 1));
2574 observer.observe(div, {childList: true}); 2580 observer.observe(div, {childList: true});
2575 return (callback) => { 2581 return callback => {
2576 dart.assert(storedCallback == null); 2582 dart.assert(storedCallback == null);
2577 _isolate_helper.enterJsAsync(); 2583 _isolate_helper.enterJsAsync();
2578 storedCallback = callback; 2584 storedCallback = callback;
2579 div.firstChild ? div.removeChild(span) : div.appendChild(span); 2585 div.firstChild ? div.removeChild(span) : div.appendChild(span);
2580 }; 2586 };
2581 } else if (self.setImmediate != null) { 2587 } else if (self.setImmediate != null) {
2582 return _AsyncRun[_scheduleImmediateWithSetImmediate]; 2588 return _AsyncRun[_scheduleImmediateWithSetImmediate];
2583 } 2589 }
2584 return _AsyncRun[_scheduleImmediateWithTimer]; 2590 return _AsyncRun[_scheduleImmediateWithTimer];
2585 } 2591 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 return new core.StateError("Cannot add event while adding a stream"); 2823 return new core.StateError("Cannot add event while adding a stream");
2818 } 2824 }
2819 addStream(source, opts) { 2825 addStream(source, opts) {
2820 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 2826 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
2821 if (!dart.notNull(this[_mayAddEvent])) 2827 if (!dart.notNull(this[_mayAddEvent]))
2822 throw this[_badEventState](); 2828 throw this[_badEventState]();
2823 if (this[_isCanceled]) 2829 if (this[_isCanceled])
2824 return new _Future.immediate(null); 2830 return new _Future.immediate(null);
2825 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError); 2831 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError);
2826 this[_varData] = addState; 2832 this[_varData] = addState;
2827 this[_state] = _StreamController[_STATE_ADDSTREAM]; 2833 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er[_STATE_ADDSTREAM]);
2828 return addState.addStreamFuture; 2834 return addState.addStreamFuture;
2829 } 2835 }
2830 get done() { 2836 get done() {
2831 return this[_ensureDoneFuture](); 2837 return this[_ensureDoneFuture]();
2832 } 2838 }
2833 [_ensureDoneFuture]() { 2839 [_ensureDoneFuture]() {
2834 if (this[_doneFuture] == null) { 2840 if (this[_doneFuture] == null) {
2835 this[_doneFuture] = this[_isCanceled] ? Future[_nullFuture] : new _Fut ure(); 2841 this[_doneFuture] = this[_isCanceled] ? Future[_nullFuture] : new _Fut ure();
2836 } 2842 }
2837 return this[_doneFuture]; 2843 return this[_doneFuture];
(...skipping 19 matching lines...) Expand all
2857 close() { 2863 close() {
2858 if (this.isClosed) { 2864 if (this.isClosed) {
2859 return this[_ensureDoneFuture](); 2865 return this[_ensureDoneFuture]();
2860 } 2866 }
2861 if (!dart.notNull(this[_mayAddEvent])) 2867 if (!dart.notNull(this[_mayAddEvent]))
2862 throw this[_badEventState](); 2868 throw this[_badEventState]();
2863 this[_closeUnchecked](); 2869 this[_closeUnchecked]();
2864 return this[_ensureDoneFuture](); 2870 return this[_ensureDoneFuture]();
2865 } 2871 }
2866 [_closeUnchecked]() { 2872 [_closeUnchecked]() {
2867 this[_state] = _StreamController[_STATE_CLOSED]; 2873 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er[_STATE_CLOSED]);
2868 if (this.hasListener) { 2874 if (this.hasListener) {
2869 this[_sendDone](); 2875 this[_sendDone]();
2870 } else if (this[_isInitialState]) { 2876 } else if (this[_isInitialState]) {
2871 this[_ensurePendingEvents]().add(new _DelayedDone()); 2877 this[_ensurePendingEvents]().add(new _DelayedDone());
2872 } 2878 }
2873 } 2879 }
2874 [_add](value) { 2880 [_add](value) {
2875 if (this.hasListener) { 2881 if (this.hasListener) {
2876 this[_sendData](value); 2882 this[_sendData](value);
2877 } else if (this[_isInitialState]) { 2883 } else if (this[_isInitialState]) {
2878 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value)); 2884 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value));
2879 } 2885 }
2880 } 2886 }
2881 [_addError](error, stackTrace) { 2887 [_addError](error, stackTrace) {
2882 if (this.hasListener) { 2888 if (this.hasListener) {
2883 this[_sendError](error, stackTrace); 2889 this[_sendError](error, stackTrace);
2884 } else if (this[_isInitialState]) { 2890 } else if (this[_isInitialState]) {
2885 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace)) ; 2891 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace)) ;
2886 } 2892 }
2887 } 2893 }
2888 [_close]() { 2894 [_close]() {
2889 dart.assert(this[_isAddingStream]); 2895 dart.assert(this[_isAddingStream]);
2890 let addState = dart.as(this[_varData], _StreamControllerAddStreamState); 2896 let addState = dart.as(this[_varData], _StreamControllerAddStreamState);
2891 this[_varData] = addState.varData; 2897 this[_varData] = addState.varData;
2892 this[_state] = ~dart.notNull(_StreamController[_STATE_ADDSTREAM]); 2898 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_StreamControl ler[_STATE_ADDSTREAM]);
2893 addState.complete(); 2899 addState.complete();
2894 } 2900 }
2895 [_subscribe](onData, onError, onDone, cancelOnError) { 2901 [_subscribe](onData, onError, onDone, cancelOnError) {
2896 if (!dart.notNull(this[_isInitialState])) { 2902 if (!dart.notNull(this[_isInitialState])) {
2897 throw new core.StateError("Stream has already been listened to."); 2903 throw new core.StateError("Stream has already been listened to.");
2898 } 2904 }
2899 let subscription = new _ControllerSubscription(this, onData, onError, on Done, cancelOnError); 2905 let subscription = new _ControllerSubscription(this, onData, onError, on Done, cancelOnError);
2900 let pendingEvents = this[_pendingEvents]; 2906 let pendingEvents = this[_pendingEvents];
2901 this[_state] = _StreamController[_STATE_SUBSCRIBED]; 2907 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er[_STATE_SUBSCRIBED]);
2902 if (this[_isAddingStream]) { 2908 if (this[_isAddingStream]) {
2903 let addState = dart.as(this[_varData], _StreamControllerAddStreamState ); 2909 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
2904 addState.varData = subscription; 2910 addState.varData = subscription;
2905 addState.resume(); 2911 addState.resume();
2906 } else { 2912 } else {
2907 this[_varData] = subscription; 2913 this[_varData] = subscription;
2908 } 2914 }
2909 subscription[_setPendingEvents](pendingEvents); 2915 subscription[_setPendingEvents](pendingEvents);
2910 subscription[_guardCallback]((() => { 2916 subscription[_guardCallback]((() => {
2911 _runGuarded(this[_onListen]); 2917 _runGuarded(this[_onListen]);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 class _GeneratedStreamImpl extends _StreamImpl$(T) { 3161 class _GeneratedStreamImpl extends _StreamImpl$(T) {
3156 _GeneratedStreamImpl(pending$) { 3162 _GeneratedStreamImpl(pending$) {
3157 this[_pending] = pending$; 3163 this[_pending] = pending$;
3158 this[_isUsed] = false; 3164 this[_isUsed] = false;
3159 super._StreamImpl(); 3165 super._StreamImpl();
3160 } 3166 }
3161 [_createSubscription](onData, onError, onDone, cancelOnError) { 3167 [_createSubscription](onData, onError, onDone, cancelOnError) {
3162 if (this[_isUsed]) 3168 if (this[_isUsed])
3163 throw new core.StateError("Stream has already been listened to."); 3169 throw new core.StateError("Stream has already been listened to.");
3164 this[_isUsed] = true; 3170 this[_isUsed] = true;
3165 return ((_$) => { 3171 let _$ = new _BufferingStreamSubscription(onData, onError, onDone, cance lOnError);
3166 _$[_setPendingEvents](this[_pending]()); 3172 _$[_setPendingEvents](this[_pending]());
3167 return _$; 3173 return _$;
3168 }).bind(this)(new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError));
3169 } 3174 }
3170 } 3175 }
3171 return _GeneratedStreamImpl; 3176 return _GeneratedStreamImpl;
3172 }); 3177 });
3173 let _GeneratedStreamImpl = _GeneratedStreamImpl$(); 3178 let _GeneratedStreamImpl = _GeneratedStreamImpl$();
3174 let _iterator = Symbol('_iterator'); 3179 let _iterator = Symbol('_iterator');
3175 let _STATE_UNSCHEDULED = Symbol('_STATE_UNSCHEDULED'); 3180 let _STATE_UNSCHEDULED = Symbol('_STATE_UNSCHEDULED');
3176 let _STATE_SCHEDULED = Symbol('_STATE_SCHEDULED'); 3181 let _STATE_SCHEDULED = Symbol('_STATE_SCHEDULED');
3177 let _eventScheduled = Symbol('_eventScheduled'); 3182 let _eventScheduled = Symbol('_eventScheduled');
3178 class _PendingEvents extends core.Object { 3183 class _PendingEvents extends core.Object {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
3382 get [_isScheduled]() { 3387 get [_isScheduled]() {
3383 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n[_SCHEDULED])) != 0; 3388 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n[_SCHEDULED])) != 0;
3384 } 3389 }
3385 get isPaused() { 3390 get isPaused() {
3386 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n[_PAUSED]); 3391 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n[_PAUSED]);
3387 } 3392 }
3388 [_schedule]() { 3393 [_schedule]() {
3389 if (this[_isScheduled]) 3394 if (this[_isScheduled])
3390 return; 3395 return;
3391 this[_zone].scheduleMicrotask(this[_sendDone]); 3396 this[_zone].scheduleMicrotask(this[_sendDone]);
3392 this[_state] = _DoneStreamSubscription[_SCHEDULED]; 3397 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription[_SCHEDULED]);
3393 } 3398 }
3394 onData(handleData) {} 3399 onData(handleData) {}
3395 onError(handleError) {} 3400 onError(handleError) {}
3396 onDone(handleDone) { 3401 onDone(handleDone) {
3397 this[_onDone] = handleDone; 3402 this[_onDone] = handleDone;
3398 } 3403 }
3399 pause(resumeSignal) { 3404 pause(resumeSignal) {
3400 if (resumeSignal === void 0) 3405 if (resumeSignal === void 0)
3401 resumeSignal = null; 3406 resumeSignal = null;
3402 this[_state] = _DoneStreamSubscription[_PAUSED]; 3407 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs cription[_PAUSED]);
3403 if (resumeSignal != null) 3408 if (resumeSignal != null)
3404 resumeSignal.whenComplete(this.resume); 3409 resumeSignal.whenComplete(this.resume);
3405 } 3410 }
3406 resume() { 3411 resume() {
3407 if (this.isPaused) { 3412 if (this.isPaused) {
3408 this[_state] = _DoneStreamSubscription[_PAUSED]; 3413 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu bscription[_PAUSED]);
3409 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { 3414 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) {
3410 this[_schedule](); 3415 this[_schedule]();
3411 } 3416 }
3412 } 3417 }
3413 } 3418 }
3414 cancel() { 3419 cancel() {
3415 return null; 3420 return null;
3416 } 3421 }
3417 asFuture(futureValue) { 3422 asFuture(futureValue) {
3418 if (futureValue === void 0) 3423 if (futureValue === void 0)
3419 futureValue = null; 3424 futureValue = null;
3420 let result = new _Future(); 3425 let result = new _Future();
3421 this[_onDone] = () => { 3426 this[_onDone] = () => {
3422 result[_completeWithValue](null); 3427 result[_completeWithValue](null);
3423 }; 3428 };
3424 return result; 3429 return result;
3425 } 3430 }
3426 [_sendDone]() { 3431 [_sendDone]() {
3427 this[_state] = ~dart.notNull(_DoneStreamSubscription[_SCHEDULED]); 3432 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_DoneStreamSub scription[_SCHEDULED]);
3428 if (this.isPaused) 3433 if (this.isPaused)
3429 return; 3434 return;
3430 this[_state] = _DoneStreamSubscription[_DONE_SENT]; 3435 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription[_DONE_SENT]);
3431 if (this[_onDone] != null) 3436 if (this[_onDone] != null)
3432 this[_zone].runGuarded(this[_onDone]); 3437 this[_zone].runGuarded(this[_onDone]);
3433 } 3438 }
3434 } 3439 }
3435 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)]; 3440 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)];
3436 _DoneStreamSubscription._DONE_SENT = 1; 3441 _DoneStreamSubscription._DONE_SENT = 1;
3437 _DoneStreamSubscription._SCHEDULED = 2; 3442 _DoneStreamSubscription._SCHEDULED = 2;
3438 _DoneStreamSubscription._PAUSED = 4; 3443 _DoneStreamSubscription._PAUSED = 4;
3439 return _DoneStreamSubscription; 3444 return _DoneStreamSubscription;
3440 }); 3445 });
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 class _TakeStream extends _ForwardingStream$(T, T) { 3955 class _TakeStream extends _ForwardingStream$(T, T) {
3951 _TakeStream(source, count) { 3956 _TakeStream(source, count) {
3952 this[_remaining] = count; 3957 this[_remaining] = count;
3953 super._ForwardingStream(source); 3958 super._ForwardingStream(source);
3954 if (!(typeof count == 'number')) 3959 if (!(typeof count == 'number'))
3955 throw new core.ArgumentError(count); 3960 throw new core.ArgumentError(count);
3956 } 3961 }
3957 [_handleData](inputEvent, sink) { 3962 [_handleData](inputEvent, sink) {
3958 if (dart.notNull(this[_remaining]) > 0) { 3963 if (dart.notNull(this[_remaining]) > 0) {
3959 sink[_add](inputEvent); 3964 sink[_add](inputEvent);
3960 this[_remaining] = 1; 3965 this[_remaining] = dart.notNull(this[_remaining]) - 1;
3961 if (this[_remaining] == 0) { 3966 if (this[_remaining] == 0) {
3962 sink[_close](); 3967 sink[_close]();
3963 } 3968 }
3964 } 3969 }
3965 } 3970 }
3966 } 3971 }
3967 return _TakeStream; 3972 return _TakeStream;
3968 }); 3973 });
3969 let _TakeStream = _TakeStream$(); 3974 let _TakeStream = _TakeStream$();
3970 let _TakeWhileStream$ = dart.generic(function(T) { 3975 let _TakeWhileStream$ = dart.generic(function(T) {
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
4283 let _HandlerEventSink = _HandlerEventSink$(); 4288 let _HandlerEventSink = _HandlerEventSink$();
4284 let _defaultHandleData = Symbol('_defaultHandleData'); 4289 let _defaultHandleData = Symbol('_defaultHandleData');
4285 let _defaultHandleError = Symbol('_defaultHandleError'); 4290 let _defaultHandleError = Symbol('_defaultHandleError');
4286 let _defaultHandleDone = Symbol('_defaultHandleDone'); 4291 let _defaultHandleDone = Symbol('_defaultHandleDone');
4287 let _StreamHandlerTransformer$ = dart.generic(function(S, T) { 4292 let _StreamHandlerTransformer$ = dart.generic(function(S, T) {
4288 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) { 4293 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) {
4289 _StreamHandlerTransformer(opts) { 4294 _StreamHandlerTransformer(opts) {
4290 let handleData = opts && 'handleData' in opts ? opts.handleData : null; 4295 let handleData = opts && 'handleData' in opts ? opts.handleData : null;
4291 let handleError = opts && 'handleError' in opts ? opts.handleError : nul l; 4296 let handleError = opts && 'handleError' in opts ? opts.handleError : nul l;
4292 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null; 4297 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null;
4293 super._StreamSinkTransformer(dart.as((outputSink) => { 4298 super._StreamSinkTransformer(dart.as(outputSink => {
4294 if (handleData == null) 4299 if (handleData == null)
4295 handleData = dart.as(_StreamHandlerTransformer[_defaultHandleData], dart.throw_("Unimplemented type (S, EventSink<T>) → void")); 4300 handleData = dart.as(_StreamHandlerTransformer[_defaultHandleData], dart.throw_("Unimplemented type (S, EventSink<T>) → void"));
4296 if (handleError == null) 4301 if (handleError == null)
4297 handleError = dart.as(_StreamHandlerTransformer[_defaultHandleError] , dart.throw_("Unimplemented type (Object, StackTrace, EventSink<T>) → void")); 4302 handleError = dart.as(_StreamHandlerTransformer[_defaultHandleError] , dart.throw_("Unimplemented type (Object, StackTrace, EventSink<T>) → void"));
4298 if (handleDone == null) 4303 if (handleDone == null)
4299 handleDone = _StreamHandlerTransformer[_defaultHandleDone]; 4304 handleDone = _StreamHandlerTransformer[_defaultHandleDone];
4300 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD one, outputSink); 4305 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD one, outputSink);
4301 }, _SinkMapper)); 4306 }, _SinkMapper));
4302 } 4307 }
4303 bind(stream) { 4308 bind(stream) {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
4663 if (runGuarded) { 4668 if (runGuarded) {
4664 return (() => this.runGuarded(registered)).bind(this); 4669 return (() => this.runGuarded(registered)).bind(this);
4665 } else { 4670 } else {
4666 return (() => this.run(registered)).bind(this); 4671 return (() => this.run(registered)).bind(this);
4667 } 4672 }
4668 } 4673 }
4669 bindUnaryCallback(f, opts) { 4674 bindUnaryCallback(f, opts) {
4670 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; 4675 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
4671 let registered = this.registerUnaryCallback(f); 4676 let registered = this.registerUnaryCallback(f);
4672 if (runGuarded) { 4677 if (runGuarded) {
4673 return ((arg) => this.runUnaryGuarded(registered, arg)).bind(this); 4678 return (arg => this.runUnaryGuarded(registered, arg)).bind(this);
4674 } else { 4679 } else {
4675 return ((arg) => this.runUnary(registered, arg)).bind(this); 4680 return (arg => this.runUnary(registered, arg)).bind(this);
4676 } 4681 }
4677 } 4682 }
4678 bindBinaryCallback(f, opts) { 4683 bindBinaryCallback(f, opts) {
4679 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; 4684 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
4680 let registered = this.registerBinaryCallback(f); 4685 let registered = this.registerBinaryCallback(f);
4681 if (runGuarded) { 4686 if (runGuarded) {
4682 return ((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).b ind(this); 4687 return ((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).b ind(this);
4683 } else { 4688 } else {
4684 return ((arg1, arg2) => this.runBinary(registered, arg1, arg2)).bind(thi s); 4689 return ((arg1, arg2) => this.runBinary(registered, arg1, arg2)).bind(thi s);
4685 } 4690 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
5028 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; 5033 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
5029 if (runGuarded) { 5034 if (runGuarded) {
5030 return (() => this.runGuarded(f)).bind(this); 5035 return (() => this.runGuarded(f)).bind(this);
5031 } else { 5036 } else {
5032 return (() => this.run(f)).bind(this); 5037 return (() => this.run(f)).bind(this);
5033 } 5038 }
5034 } 5039 }
5035 bindUnaryCallback(f, opts) { 5040 bindUnaryCallback(f, opts) {
5036 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; 5041 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
5037 if (runGuarded) { 5042 if (runGuarded) {
5038 return ((arg) => this.runUnaryGuarded(f, arg)).bind(this); 5043 return (arg => this.runUnaryGuarded(f, arg)).bind(this);
5039 } else { 5044 } else {
5040 return ((arg) => this.runUnary(f, arg)).bind(this); 5045 return (arg => this.runUnary(f, arg)).bind(this);
5041 } 5046 }
5042 } 5047 }
5043 bindBinaryCallback(f, opts) { 5048 bindBinaryCallback(f, opts) {
5044 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; 5049 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
5045 if (runGuarded) { 5050 if (runGuarded) {
5046 return ((arg1, arg2) => this.runBinaryGuarded(f, arg1, arg2)).bind(this) ; 5051 return ((arg1, arg2) => this.runBinaryGuarded(f, arg1, arg2)).bind(this) ;
5047 } else { 5052 } else {
5048 return ((arg1, arg2) => this.runBinary(f, arg1, arg2)).bind(this); 5053 return ((arg1, arg2) => this.runBinary(f, arg1, arg2)).bind(this);
5049 } 5054 }
5050 } 5055 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5196 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5192 exports.CreateTimerHandler = CreateTimerHandler; 5197 exports.CreateTimerHandler = CreateTimerHandler;
5193 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5198 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5194 exports.PrintHandler = PrintHandler; 5199 exports.PrintHandler = PrintHandler;
5195 exports.ForkHandler = ForkHandler; 5200 exports.ForkHandler = ForkHandler;
5196 exports.ZoneSpecification = ZoneSpecification; 5201 exports.ZoneSpecification = ZoneSpecification;
5197 exports.ZoneDelegate = ZoneDelegate; 5202 exports.ZoneDelegate = ZoneDelegate;
5198 exports.Zone = Zone; 5203 exports.Zone = Zone;
5199 exports.runZoned = runZoned; 5204 exports.runZoned = runZoned;
5200 })(async || (async = {})); 5205 })(async || (async = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698