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

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

Issue 1142293002: Use dart.tearoff helper at tearoff sites (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Use dart.bind instead of dart.tearoff Created 5 years, 7 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 = dart.defineLibrary(async, {}); 1 var async = dart.defineLibrary(async, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 var _internal = dart.import(_internal); 3 var _internal = dart.import(_internal);
4 var _js_helper = dart.lazyImport(_js_helper); 4 var _js_helper = dart.lazyImport(_js_helper);
5 var _isolate_helper = dart.lazyImport(_isolate_helper); 5 var _isolate_helper = dart.lazyImport(_isolate_helper);
6 var collection = dart.import(collection); 6 var collection = dart.import(collection);
7 (function(exports, core, _internal, _js_helper, _isolate_helper, collection) { 7 (function(exports, core, _internal, _js_helper, _isolate_helper, collection) {
8 'use strict'; 8 'use strict';
9 function _invokeErrorHandler(errorHandler, error, stackTrace) { 9 function _invokeErrorHandler(errorHandler, error, stackTrace) {
10 if (dart.is(errorHandler, ZoneBinaryCallback)) { 10 if (dart.is(errorHandler, ZoneBinaryCallback)) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 map(convert) { 154 map(convert) {
155 dart.as(convert, dart.functionType(dart.dynamic, [T])); 155 dart.as(convert, dart.functionType(dart.dynamic, [T]));
156 return new (_MapStream$(T, dart.dynamic))(this, convert); 156 return new (_MapStream$(T, dart.dynamic))(this, convert);
157 } 157 }
158 asyncMap(convert) { 158 asyncMap(convert) {
159 dart.as(convert, dart.functionType(dart.dynamic, [T])); 159 dart.as(convert, dart.functionType(dart.dynamic, [T]));
160 let controller = null; 160 let controller = null;
161 let subscription = null; 161 let subscription = null;
162 let onListen = (() => { 162 let onListen = (() => {
163 let add = controller.add.bind(controller); 163 let add = dart.bind(controller, 'add');
164 dart.assert(dart.is(controller, _StreamController) || dart.is(controll er, _BroadcastStreamController)); 164 dart.assert(dart.is(controller, _StreamController) || dart.is(controll er, _BroadcastStreamController));
165 let eventSink = controller; 165 let eventSink = controller;
166 let addError = eventSink[_addError]; 166 let addError = eventSink[_addError];
167 subscription = this.listen(dart.fn(event => { 167 subscription = this.listen(dart.fn(event => {
168 dart.as(event, T); 168 dart.as(event, T);
169 let newValue = null; 169 let newValue = null;
170 try { 170 try {
171 newValue = convert(event); 171 newValue = convert(event);
172 } catch (e) { 172 } catch (e) {
173 let s = dart.stackTrace(e); 173 let s = dart.stackTrace(e);
174 controller.addError(e, s); 174 controller.addError(e, s);
175 return; 175 return;
176 } 176 }
177 177
178 if (dart.is(newValue, Future)) { 178 if (dart.is(newValue, Future)) {
179 subscription.pause(); 179 subscription.pause();
180 dart.dsend(dart.dsend(newValue, 'then', add, {onError: addError}), 'whenComplete', dart.bind(subscription, 'resume')); 180 dart.dsend(dart.dsend(newValue, 'then', add, {onError: addError}), 'whenComplete', dart.bind(subscription, 'resume'));
181 } else { 181 } else {
182 controller.add(newValue); 182 controller.add(newValue);
183 } 183 }
184 }, dart.dynamic, [T]), {onError: dart.as(addError, core.Function), onD one: controller.close.bind(controller)}); 184 }, dart.dynamic, [T]), {onError: dart.as(addError, core.Function), onD one: dart.bind(controller, 'close')});
185 }).bind(this); 185 }).bind(this);
186 dart.fn(onListen, dart.void, []); 186 dart.fn(onListen, dart.void, []);
187 if (this.isBroadcast) { 187 if (this.isBroadcast) {
188 controller = new StreamController.broadcast({onListen: onListen, onCan cel: dart.fn(() => { 188 controller = new StreamController.broadcast({onListen: onListen, onCan cel: dart.fn(() => {
189 subscription.cancel(); 189 subscription.cancel();
190 }), sync: true}); 190 }), sync: true});
191 } else { 191 } else {
192 controller = new StreamController({onListen: onListen, onPause: dart.f n(() => { 192 controller = new StreamController({onListen: onListen, onPause: dart.f n(() => {
193 subscription.pause(); 193 subscription.pause();
194 }), onResume: dart.fn(() => { 194 }), onResume: dart.fn(() => {
(...skipping 19 matching lines...) Expand all
214 } catch (e) { 214 } catch (e) {
215 let s = dart.stackTrace(e); 215 let s = dart.stackTrace(e);
216 controller.addError(e, s); 216 controller.addError(e, s);
217 return; 217 return;
218 } 218 }
219 219
220 if (newStream != null) { 220 if (newStream != null) {
221 subscription.pause(); 221 subscription.pause();
222 controller.addStream(newStream).whenComplete(dart.bind(subscriptio n, 'resume')); 222 controller.addStream(newStream).whenComplete(dart.bind(subscriptio n, 'resume'));
223 } 223 }
224 }, dart.dynamic, [T]), {onError: dart.as(eventSink[_addError], core.Fu nction), onDone: controller.close.bind(controller)}); 224 }, dart.dynamic, [T]), {onError: dart.as(eventSink[_addError], core.Fu nction), onDone: dart.bind(controller, 'close')});
225 }).bind(this); 225 }).bind(this);
226 dart.fn(onListen, dart.void, []); 226 dart.fn(onListen, dart.void, []);
227 if (this.isBroadcast) { 227 if (this.isBroadcast) {
228 controller = new StreamController.broadcast({onListen: onListen, onCan cel: dart.fn(() => { 228 controller = new StreamController.broadcast({onListen: onListen, onCan cel: dart.fn(() => {
229 subscription.cancel(); 229 subscription.cancel();
230 }), sync: true}); 230 }), sync: true});
231 } else { 231 } else {
232 controller = new StreamController({onListen: onListen, onPause: dart.f n(() => { 232 controller = new StreamController({onListen: onListen, onPause: dart.f n(() => {
233 subscription.pause(); 233 subscription.pause();
234 }), onResume: dart.fn(() => { 234 }), onResume: dart.fn(() => {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 dart.as(element, T); 266 dart.as(element, T);
267 if (seenFirst) { 267 if (seenFirst) {
268 _runUserCode(dart.fn(() => combine(value, element), T, []), dart.fn( newValue => { 268 _runUserCode(dart.fn(() => combine(value, element), T, []), dart.fn( newValue => {
269 dart.as(newValue, T); 269 dart.as(newValue, T);
270 value = newValue; 270 value = newValue;
271 }, dart.dynamic, [T]), dart.as(_cancelAndErrorClosure(subscription, result), __CastType14)); 271 }, dart.dynamic, [T]), dart.as(_cancelAndErrorClosure(subscription, result), __CastType14));
272 } else { 272 } else {
273 value = element; 273 value = element;
274 seenFirst = true; 274 seenFirst = true;
275 } 275 }
276 }, dart.dynamic, [T]), {onError: result[_completeError].bind(result), on Done: dart.fn(() => { 276 }, dart.dynamic, [T]), {onError: dart.bind(result, _completeError), onDo ne: dart.fn(() => {
277 if (!dart.notNull(seenFirst)) { 277 if (!dart.notNull(seenFirst)) {
278 try { 278 try {
279 throw _internal.IterableElementError.noElement(); 279 throw _internal.IterableElementError.noElement();
280 } catch (e) { 280 } catch (e) {
281 let s = dart.stackTrace(e); 281 let s = dart.stackTrace(e);
282 _completeWithErrorCallback(result, e, s); 282 _completeWithErrorCallback(result, e, s);
283 } 283 }
284 284
285 } else { 285 } else {
286 result[_complete](value); 286 result[_complete](value);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 contains(needle) { 335 contains(needle) {
336 let future = new (_Future$(core.bool))(); 336 let future = new (_Future$(core.bool))();
337 let subscription = null; 337 let subscription = null;
338 subscription = this.listen(dart.fn(element => { 338 subscription = this.listen(dart.fn(element => {
339 dart.as(element, T); 339 dart.as(element, T);
340 _runUserCode(dart.fn(() => dart.equals(element, needle), core.bool, [] ), dart.fn(isMatch => { 340 _runUserCode(dart.fn(() => dart.equals(element, needle), core.bool, [] ), dart.fn(isMatch => {
341 if (isMatch) { 341 if (isMatch) {
342 _cancelAndValue(subscription, future, true); 342 _cancelAndValue(subscription, future, true);
343 } 343 }
344 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) ); 344 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) );
345 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 345 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
346 future[_complete](false); 346 future[_complete](false);
347 }), cancelOnError: true}); 347 }), cancelOnError: true});
348 return future; 348 return future;
349 } 349 }
350 forEach(action) { 350 forEach(action) {
351 dart.as(action, dart.functionType(dart.void, [T])); 351 dart.as(action, dart.functionType(dart.void, [T]));
352 let future = new _Future(); 352 let future = new _Future();
353 let subscription = null; 353 let subscription = null;
354 subscription = this.listen(dart.fn(element => { 354 subscription = this.listen(dart.fn(element => {
355 dart.as(element, T); 355 dart.as(element, T);
356 _runUserCode(dart.fn(() => action(element), dart.void, []), dart.fn(_ => { 356 _runUserCode(dart.fn(() => action(element), dart.void, []), dart.fn(_ => {
357 }), dart.as(_cancelAndErrorClosure(subscription, future), dart.functio nType(dart.dynamic, [dart.dynamic, core.StackTrace]))); 357 }), dart.as(_cancelAndErrorClosure(subscription, future), dart.functio nType(dart.dynamic, [dart.dynamic, core.StackTrace])));
358 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 358 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
359 future[_complete](null); 359 future[_complete](null);
360 }), cancelOnError: true}); 360 }), cancelOnError: true});
361 return future; 361 return future;
362 } 362 }
363 every(test) { 363 every(test) {
364 dart.as(test, dart.functionType(core.bool, [T])); 364 dart.as(test, dart.functionType(core.bool, [T]));
365 let future = new (_Future$(core.bool))(); 365 let future = new (_Future$(core.bool))();
366 let subscription = null; 366 let subscription = null;
367 subscription = this.listen(dart.fn(element => { 367 subscription = this.listen(dart.fn(element => {
368 dart.as(element, T); 368 dart.as(element, T);
369 _runUserCode(dart.fn(() => test(element), core.bool, []), dart.fn(isMa tch => { 369 _runUserCode(dart.fn(() => test(element), core.bool, []), dart.fn(isMa tch => {
370 if (!dart.notNull(isMatch)) { 370 if (!dart.notNull(isMatch)) {
371 _cancelAndValue(subscription, future, false); 371 _cancelAndValue(subscription, future, false);
372 } 372 }
373 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) ); 373 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) );
374 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 374 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
375 future[_complete](true); 375 future[_complete](true);
376 }), cancelOnError: true}); 376 }), cancelOnError: true});
377 return future; 377 return future;
378 } 378 }
379 any(test) { 379 any(test) {
380 dart.as(test, dart.functionType(core.bool, [T])); 380 dart.as(test, dart.functionType(core.bool, [T]));
381 let future = new (_Future$(core.bool))(); 381 let future = new (_Future$(core.bool))();
382 let subscription = null; 382 let subscription = null;
383 subscription = this.listen(dart.fn(element => { 383 subscription = this.listen(dart.fn(element => {
384 dart.as(element, T); 384 dart.as(element, T);
385 _runUserCode(dart.fn(() => test(element), core.bool, []), dart.fn(isMa tch => { 385 _runUserCode(dart.fn(() => test(element), core.bool, []), dart.fn(isMa tch => {
386 if (isMatch) { 386 if (isMatch) {
387 _cancelAndValue(subscription, future, true); 387 _cancelAndValue(subscription, future, true);
388 } 388 }
389 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) ); 389 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) );
390 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 390 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
391 future[_complete](false); 391 future[_complete](false);
392 }), cancelOnError: true}); 392 }), cancelOnError: true});
393 return future; 393 return future;
394 } 394 }
395 get length() { 395 get length() {
396 let future = new (_Future$(core.int))(); 396 let future = new (_Future$(core.int))();
397 let count = 0; 397 let count = 0;
398 this.listen(dart.fn(_ => { 398 this.listen(dart.fn(_ => {
399 count = dart.notNull(count) + 1; 399 count = dart.notNull(count) + 1;
400 }), {onError: future[_completeError].bind(future), onDone: dart.fn(() => { 400 }), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
401 future[_complete](count); 401 future[_complete](count);
402 }), cancelOnError: true}); 402 }), cancelOnError: true});
403 return future; 403 return future;
404 } 404 }
405 get isEmpty() { 405 get isEmpty() {
406 let future = new (_Future$(core.bool))(); 406 let future = new (_Future$(core.bool))();
407 let subscription = null; 407 let subscription = null;
408 subscription = this.listen(dart.fn(_ => { 408 subscription = this.listen(dart.fn(_ => {
409 _cancelAndValue(subscription, future, false); 409 _cancelAndValue(subscription, future, false);
410 }), {onError: future[_completeError].bind(future), onDone: dart.fn(() => { 410 }), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
411 future[_complete](true); 411 future[_complete](true);
412 }), cancelOnError: true}); 412 }), cancelOnError: true});
413 return future; 413 return future;
414 } 414 }
415 toList() { 415 toList() {
416 let result = dart.setType([], core.List$(T)); 416 let result = dart.setType([], core.List$(T));
417 let future = new (_Future$(core.List$(T)))(); 417 let future = new (_Future$(core.List$(T)))();
418 this.listen(dart.fn(data => { 418 this.listen(dart.fn(data => {
419 dart.as(data, T); 419 dart.as(data, T);
420 result[core.$add](data); 420 result[core.$add](data);
421 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 421 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
422 future[_complete](result); 422 future[_complete](result);
423 }), cancelOnError: true}); 423 }), cancelOnError: true});
424 return future; 424 return future;
425 } 425 }
426 toSet() { 426 toSet() {
427 let result = new (core.Set$(T))(); 427 let result = new (core.Set$(T))();
428 let future = new (_Future$(core.Set$(T)))(); 428 let future = new (_Future$(core.Set$(T)))();
429 this.listen(dart.fn(data => { 429 this.listen(dart.fn(data => {
430 dart.as(data, T); 430 dart.as(data, T);
431 result.add(data); 431 result.add(data);
432 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 432 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
433 future[_complete](result); 433 future[_complete](result);
434 }), cancelOnError: true}); 434 }), cancelOnError: true});
435 return future; 435 return future;
436 } 436 }
437 drain(futureValue) { 437 drain(futureValue) {
438 if (futureValue === void 0) 438 if (futureValue === void 0)
439 futureValue = null; 439 futureValue = null;
440 return this.listen(null, {cancelOnError: true}).asFuture(futureValue); 440 return this.listen(null, {cancelOnError: true}).asFuture(futureValue);
441 } 441 }
442 take(count) { 442 take(count) {
(...skipping 15 matching lines...) Expand all
458 equals = null; 458 equals = null;
459 dart.as(equals, dart.functionType(core.bool, [T, T])); 459 dart.as(equals, dart.functionType(core.bool, [T, T]));
460 return new (_DistinctStream$(T))(this, equals); 460 return new (_DistinctStream$(T))(this, equals);
461 } 461 }
462 get first() { 462 get first() {
463 let future = new (_Future$(T))(); 463 let future = new (_Future$(T))();
464 let subscription = null; 464 let subscription = null;
465 subscription = this.listen(dart.fn(value => { 465 subscription = this.listen(dart.fn(value => {
466 dart.as(value, T); 466 dart.as(value, T);
467 _cancelAndValue(subscription, future, value); 467 _cancelAndValue(subscription, future, value);
468 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 468 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
469 try { 469 try {
470 throw _internal.IterableElementError.noElement(); 470 throw _internal.IterableElementError.noElement();
471 } catch (e) { 471 } catch (e) {
472 let s = dart.stackTrace(e); 472 let s = dart.stackTrace(e);
473 _completeWithErrorCallback(future, e, s); 473 _completeWithErrorCallback(future, e, s);
474 } 474 }
475 475
476 }), cancelOnError: true}); 476 }), cancelOnError: true});
477 return future; 477 return future;
478 } 478 }
479 get last() { 479 get last() {
480 let future = new (_Future$(T))(); 480 let future = new (_Future$(T))();
481 let result = null; 481 let result = null;
482 let foundResult = false; 482 let foundResult = false;
483 let subscription = null; 483 let subscription = null;
484 subscription = this.listen(dart.fn(value => { 484 subscription = this.listen(dart.fn(value => {
485 dart.as(value, T); 485 dart.as(value, T);
486 foundResult = true; 486 foundResult = true;
487 result = value; 487 result = value;
488 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 488 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
489 if (foundResult) { 489 if (foundResult) {
490 future[_complete](result); 490 future[_complete](result);
491 return; 491 return;
492 } 492 }
493 try { 493 try {
494 throw _internal.IterableElementError.noElement(); 494 throw _internal.IterableElementError.noElement();
495 } catch (e) { 495 } catch (e) {
496 let s = dart.stackTrace(e); 496 let s = dart.stackTrace(e);
497 _completeWithErrorCallback(future, e, s); 497 _completeWithErrorCallback(future, e, s);
498 } 498 }
(...skipping 13 matching lines...) Expand all
512 throw _internal.IterableElementError.tooMany(); 512 throw _internal.IterableElementError.tooMany();
513 } catch (e) { 513 } catch (e) {
514 let s = dart.stackTrace(e); 514 let s = dart.stackTrace(e);
515 _cancelAndErrorWithReplacement(subscription, future, e, s); 515 _cancelAndErrorWithReplacement(subscription, future, e, s);
516 } 516 }
517 517
518 return; 518 return;
519 } 519 }
520 foundResult = true; 520 foundResult = true;
521 result = value; 521 result = value;
522 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 522 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
523 if (foundResult) { 523 if (foundResult) {
524 future[_complete](result); 524 future[_complete](result);
525 return; 525 return;
526 } 526 }
527 try { 527 try {
528 throw _internal.IterableElementError.noElement(); 528 throw _internal.IterableElementError.noElement();
529 } catch (e) { 529 } catch (e) {
530 let s = dart.stackTrace(e); 530 let s = dart.stackTrace(e);
531 _completeWithErrorCallback(future, e, s); 531 _completeWithErrorCallback(future, e, s);
532 } 532 }
533 533
534 }), cancelOnError: true}); 534 }), cancelOnError: true});
535 return future; 535 return future;
536 } 536 }
537 firstWhere(test, opts) { 537 firstWhere(test, opts) {
538 dart.as(test, dart.functionType(core.bool, [T])); 538 dart.as(test, dart.functionType(core.bool, [T]));
539 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null; 539 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null;
540 dart.as(defaultValue, dart.functionType(core.Object, [])); 540 dart.as(defaultValue, dart.functionType(core.Object, []));
541 let future = new _Future(); 541 let future = new _Future();
542 let subscription = null; 542 let subscription = null;
543 subscription = this.listen(dart.fn(value => { 543 subscription = this.listen(dart.fn(value => {
544 dart.as(value, T); 544 dart.as(value, T);
545 _runUserCode(dart.fn(() => test(value), core.bool, []), dart.fn(isMatc h => { 545 _runUserCode(dart.fn(() => test(value), core.bool, []), dart.fn(isMatc h => {
546 if (isMatch) { 546 if (isMatch) {
547 _cancelAndValue(subscription, future, value); 547 _cancelAndValue(subscription, future, value);
548 } 548 }
549 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) ); 549 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) );
550 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 550 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
551 if (defaultValue != null) { 551 if (defaultValue != null) {
552 _runUserCode(defaultValue, future[_complete].bind(future), future[ _completeError].bind(future)); 552 _runUserCode(defaultValue, dart.bind(future, _complete), dart.bind (future, _completeError));
553 return; 553 return;
554 } 554 }
555 try { 555 try {
556 throw _internal.IterableElementError.noElement(); 556 throw _internal.IterableElementError.noElement();
557 } catch (e) { 557 } catch (e) {
558 let s = dart.stackTrace(e); 558 let s = dart.stackTrace(e);
559 _completeWithErrorCallback(future, e, s); 559 _completeWithErrorCallback(future, e, s);
560 } 560 }
561 561
562 }), cancelOnError: true}); 562 }), cancelOnError: true});
563 return future; 563 return future;
564 } 564 }
565 lastWhere(test, opts) { 565 lastWhere(test, opts) {
566 dart.as(test, dart.functionType(core.bool, [T])); 566 dart.as(test, dart.functionType(core.bool, [T]));
567 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null; 567 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : null;
568 dart.as(defaultValue, dart.functionType(core.Object, [])); 568 dart.as(defaultValue, dart.functionType(core.Object, []));
569 let future = new _Future(); 569 let future = new _Future();
570 let result = null; 570 let result = null;
571 let foundResult = false; 571 let foundResult = false;
572 let subscription = null; 572 let subscription = null;
573 subscription = this.listen(dart.fn(value => { 573 subscription = this.listen(dart.fn(value => {
574 dart.as(value, T); 574 dart.as(value, T);
575 _runUserCode(dart.fn(() => true == test(value), core.bool, []), dart.f n(isMatch => { 575 _runUserCode(dart.fn(() => true == test(value), core.bool, []), dart.f n(isMatch => {
576 if (isMatch) { 576 if (isMatch) {
577 foundResult = true; 577 foundResult = true;
578 result = value; 578 result = value;
579 } 579 }
580 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) ); 580 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) );
581 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 581 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
582 if (foundResult) { 582 if (foundResult) {
583 future[_complete](result); 583 future[_complete](result);
584 return; 584 return;
585 } 585 }
586 if (defaultValue != null) { 586 if (defaultValue != null) {
587 _runUserCode(defaultValue, future[_complete].bind(future), future[ _completeError].bind(future)); 587 _runUserCode(defaultValue, dart.bind(future, _complete), dart.bind (future, _completeError));
588 return; 588 return;
589 } 589 }
590 try { 590 try {
591 throw _internal.IterableElementError.noElement(); 591 throw _internal.IterableElementError.noElement();
592 } catch (e) { 592 } catch (e) {
593 let s = dart.stackTrace(e); 593 let s = dart.stackTrace(e);
594 _completeWithErrorCallback(future, e, s); 594 _completeWithErrorCallback(future, e, s);
595 } 595 }
596 596
597 }), cancelOnError: true}); 597 }), cancelOnError: true});
(...skipping 16 matching lines...) Expand all
614 let s = dart.stackTrace(e); 614 let s = dart.stackTrace(e);
615 _cancelAndErrorWithReplacement(subscription, future, e, s); 615 _cancelAndErrorWithReplacement(subscription, future, e, s);
616 } 616 }
617 617
618 return; 618 return;
619 } 619 }
620 foundResult = true; 620 foundResult = true;
621 result = value; 621 result = value;
622 } 622 }
623 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) ); 623 }, dart.dynamic, [core.bool]), dart.as(_cancelAndErrorClosure(subscrip tion, future), dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])) );
624 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn(() => { 624 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
625 if (foundResult) { 625 if (foundResult) {
626 future[_complete](result); 626 future[_complete](result);
627 return; 627 return;
628 } 628 }
629 try { 629 try {
630 throw _internal.IterableElementError.noElement(); 630 throw _internal.IterableElementError.noElement();
631 } catch (e) { 631 } catch (e) {
632 let s = dart.stackTrace(e); 632 let s = dart.stackTrace(e);
633 _completeWithErrorCallback(future, e, s); 633 _completeWithErrorCallback(future, e, s);
634 } 634 }
635 635
636 }), cancelOnError: true}); 636 }), cancelOnError: true});
637 return future; 637 return future;
638 } 638 }
639 elementAt(index) { 639 elementAt(index) {
640 if (!(typeof index == 'number') || dart.notNull(index) < 0) 640 if (!(typeof index == 'number') || dart.notNull(index) < 0)
641 throw new core.ArgumentError(index); 641 throw new core.ArgumentError(index);
642 let future = new (_Future$(T))(); 642 let future = new (_Future$(T))();
643 let subscription = null; 643 let subscription = null;
644 let elementIndex = 0; 644 let elementIndex = 0;
645 subscription = this.listen(dart.fn(value => { 645 subscription = this.listen(dart.fn(value => {
646 dart.as(value, T); 646 dart.as(value, T);
647 if (index == elementIndex) { 647 if (index == elementIndex) {
648 _cancelAndValue(subscription, future, value); 648 _cancelAndValue(subscription, future, value);
649 return; 649 return;
650 } 650 }
651 elementIndex = dart.notNull(elementIndex) + 1; 651 elementIndex = dart.notNull(elementIndex) + 1;
652 }, dart.dynamic, [T]), {onError: future[_completeError].bind(future), on Done: dart.fn((() => { 652 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn((() => {
653 future[_completeError](new core.RangeError.index(index, this, "index ", null, elementIndex)); 653 future[_completeError](new core.RangeError.index(index, this, "index ", null, elementIndex));
654 }).bind(this)), cancelOnError: true}); 654 }).bind(this)), cancelOnError: true});
655 return future; 655 return future;
656 } 656 }
657 timeout(timeLimit, opts) { 657 timeout(timeLimit, opts) {
658 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; 658 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null;
659 dart.as(onTimeout, dart.functionType(dart.void, [EventSink])); 659 dart.as(onTimeout, dart.functionType(dart.void, [EventSink]));
660 let controller = null; 660 let controller = null;
661 let subscription = null; 661 let subscription = null;
662 let timer = null; 662 let timer = null;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 } 929 }
930 pause(resumeSignal) { 930 pause(resumeSignal) {
931 if (resumeSignal === void 0) 931 if (resumeSignal === void 0)
932 resumeSignal = null; 932 resumeSignal = null;
933 if (this[_isCanceled]) 933 if (this[_isCanceled])
934 return; 934 return;
935 let wasPaused = this[_isPaused]; 935 let wasPaused = this[_isPaused];
936 let wasInputPaused = this[_isInputPaused]; 936 let wasInputPaused = this[_isInputPaused];
937 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription $()._STATE_INPUT_PAUSED); 937 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription $()._STATE_INPUT_PAUSED);
938 if (resumeSignal != null) 938 if (resumeSignal != null)
939 resumeSignal.whenComplete(this.resume.bind(this)); 939 resumeSignal.whenComplete(dart.bind(this, 'resume'));
940 if (!dart.notNull(wasPaused) && dart.notNull(this[_pending] != null)) 940 if (!dart.notNull(wasPaused) && dart.notNull(this[_pending] != null))
941 this[_pending].cancelSchedule(); 941 this[_pending].cancelSchedule();
942 if (!dart.notNull(wasInputPaused) && !dart.notNull(this[_inCallback])) 942 if (!dart.notNull(wasInputPaused) && !dart.notNull(this[_inCallback]))
943 this[_guardCallback](this[_onPause].bind(this)); 943 this[_guardCallback](dart.bind(this, _onPause));
944 } 944 }
945 resume() { 945 resume() {
946 if (this[_isCanceled]) 946 if (this[_isCanceled])
947 return; 947 return;
948 if (this[_isPaused]) { 948 if (this[_isPaused]) {
949 this[_decrementPauseCount](); 949 this[_decrementPauseCount]();
950 if (!dart.notNull(this[_isPaused])) { 950 if (!dart.notNull(this[_isPaused])) {
951 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) { 951 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) {
952 this[_pending].schedule(this); 952 this[_pending].schedule(this);
953 } else { 953 } else {
954 dart.assert(this[_mayResumeInput]); 954 dart.assert(this[_mayResumeInput]);
955 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi ngStreamSubscription$()._STATE_INPUT_PAUSED); 955 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi ngStreamSubscription$()._STATE_INPUT_PAUSED);
956 if (!dart.notNull(this[_inCallback])) 956 if (!dart.notNull(this[_inCallback]))
957 this[_guardCallback](this[_onResume].bind(this)); 957 this[_guardCallback](dart.bind(this, _onResume));
958 } 958 }
959 } 959 }
960 } 960 }
961 } 961 }
962 cancel() { 962 cancel() {
963 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription$()._STATE_WAIT_FOR_CANCEL); 963 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription$()._STATE_WAIT_FOR_CANCEL);
964 if (this[_isCanceled]) 964 if (this[_isCanceled])
965 return this[_cancelFuture]; 965 return this[_cancelFuture];
966 this[_cancel](); 966 this[_cancel]();
967 return this[_cancelFuture]; 967 return this[_cancelFuture];
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 dart.as(handleData, dart.functionType(dart.void, [T])); 1723 dart.as(handleData, dart.functionType(dart.void, [T]));
1724 } 1724 }
1725 onError(handleError) {} 1725 onError(handleError) {}
1726 onDone(handleDone) { 1726 onDone(handleDone) {
1727 dart.as(handleDone, dart.functionType(dart.void, [])); 1727 dart.as(handleDone, dart.functionType(dart.void, []));
1728 } 1728 }
1729 pause(resumeSignal) { 1729 pause(resumeSignal) {
1730 if (resumeSignal === void 0) 1730 if (resumeSignal === void 0)
1731 resumeSignal = null; 1731 resumeSignal = null;
1732 if (resumeSignal != null) 1732 if (resumeSignal != null)
1733 resumeSignal.then(this[_resume].bind(this)); 1733 resumeSignal.then(dart.bind(this, _resume));
1734 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1; 1734 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
1735 } 1735 }
1736 resume() { 1736 resume() {
1737 this[_resume](null); 1737 this[_resume](null);
1738 } 1738 }
1739 [_resume](_) { 1739 [_resume](_) {
1740 if (dart.notNull(this[_pauseCount]) > 0) { 1740 if (dart.notNull(this[_pauseCount]) > 0) {
1741 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1; 1741 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1;
1742 } 1742 }
1743 } 1743 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 return false; 1941 return false;
1942 return new (Future$()).sync(dart.fn(() => dart.dcall(f, iterator.curre nt))).then(dart.fn(_ => true, core.bool, [dart.dynamic])); 1942 return new (Future$()).sync(dart.fn(() => dart.dcall(f, iterator.curre nt))).then(dart.fn(_ => true, core.bool, [dart.dynamic]));
1943 })); 1943 }));
1944 } 1944 }
1945 static doWhile(f) { 1945 static doWhile(f) {
1946 dart.as(f, dart.functionType(dart.dynamic, [])); 1946 dart.as(f, dart.functionType(dart.dynamic, []));
1947 let doneSignal = new _Future(); 1947 let doneSignal = new _Future();
1948 let nextIteration = null; 1948 let nextIteration = null;
1949 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => { 1949 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => {
1950 if (keepGoing) { 1950 if (keepGoing) {
1951 new (Future$()).sync(f).then(dart.as(nextIteration, __CastType4), {o nError: doneSignal[_completeError].bind(doneSignal)}); 1951 new (Future$()).sync(f).then(dart.as(nextIteration, __CastType4), {o nError: dart.bind(doneSignal, _completeError)});
1952 } else { 1952 } else {
1953 doneSignal[_complete](null); 1953 doneSignal[_complete](null);
1954 } 1954 }
1955 }, dart.dynamic, [core.bool]), {runGuarded: true}); 1955 }, dart.dynamic, [core.bool]), {runGuarded: true});
1956 dart.dcall(nextIteration, true); 1956 dart.dcall(nextIteration, true);
1957 return doneSignal; 1957 return doneSignal;
1958 } 1958 }
1959 } 1959 }
1960 dart.defineNamedConstructor(Future, 'microtask'); 1960 dart.defineNamedConstructor(Future, 'microtask');
1961 dart.defineNamedConstructor(Future, 'sync'); 1961 dart.defineNamedConstructor(Future, 'sync');
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 addStream: dart.functionType(Future, [Stream$(T)], {ancelOnErro: core.bo ol}) 3383 addStream: dart.functionType(Future, [Stream$(T)], {ancelOnErro: core.bo ol})
3384 }) 3384 })
3385 }); 3385 });
3386 return _StreamSinkWrapper; 3386 return _StreamSinkWrapper;
3387 }); 3387 });
3388 let _StreamSinkWrapper = _StreamSinkWrapper$(); 3388 let _StreamSinkWrapper = _StreamSinkWrapper$();
3389 let _AddStreamState$ = dart.generic(function(T) { 3389 let _AddStreamState$ = dart.generic(function(T) {
3390 class _AddStreamState extends core.Object { 3390 class _AddStreamState extends core.Object {
3391 _AddStreamState(controller, source, cancelOnError) { 3391 _AddStreamState(controller, source, cancelOnError) {
3392 this.addStreamFuture = new _Future(); 3392 this.addStreamFuture = new _Future();
3393 this.addSubscription = source.listen(controller[_add].bind(controller), {onError: cancelOnError ? dart.as(_AddStreamState$().makeErrorHandler(controller ), core.Function) : controller[_addError].bind(controller), onDone: controller[_ close].bind(controller), cancelOnError: cancelOnError}); 3393 this.addSubscription = source.listen(dart.bind(controller, _add), {onErr or: cancelOnError ? dart.as(_AddStreamState$().makeErrorHandler(controller), cor e.Function) : dart.bind(controller, _addError), onDone: dart.bind(controller, _c lose), cancelOnError: cancelOnError});
3394 } 3394 }
3395 static makeErrorHandler(controller) { 3395 static makeErrorHandler(controller) {
3396 return dart.fn((e, s) => { 3396 return dart.fn((e, s) => {
3397 controller[_addError](e, s); 3397 controller[_addError](e, s);
3398 controller[_close](); 3398 controller[_close]();
3399 }, dart.dynamic, [dart.dynamic, core.StackTrace]); 3399 }, dart.dynamic, [dart.dynamic, core.StackTrace]);
3400 } 3400 }
3401 pause() { 3401 pause() {
3402 this.addSubscription.pause(); 3402 this.addSubscription.pause();
3403 } 3403 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
3738 } 3738 }
3739 get [_isScheduled]() { 3739 get [_isScheduled]() {
3740 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n$()._SCHEDULED)) != 0; 3740 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n$()._SCHEDULED)) != 0;
3741 } 3741 }
3742 get isPaused() { 3742 get isPaused() {
3743 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n$()._PAUSED); 3743 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n$()._PAUSED);
3744 } 3744 }
3745 [_schedule]() { 3745 [_schedule]() {
3746 if (this[_isScheduled]) 3746 if (this[_isScheduled])
3747 return; 3747 return;
3748 this[_zone].scheduleMicrotask(this[_sendDone].bind(this)); 3748 this[_zone].scheduleMicrotask(dart.bind(this, _sendDone));
3749 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription$()._SCHEDULED); 3749 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription$()._SCHEDULED);
3750 } 3750 }
3751 onData(handleData) { 3751 onData(handleData) {
3752 dart.as(handleData, dart.functionType(dart.void, [T])); 3752 dart.as(handleData, dart.functionType(dart.void, [T]));
3753 } 3753 }
3754 onError(handleError) {} 3754 onError(handleError) {}
3755 onDone(handleDone) { 3755 onDone(handleDone) {
3756 dart.as(handleDone, dart.functionType(dart.void, [])); 3756 dart.as(handleDone, dart.functionType(dart.void, []));
3757 this[_onDone] = handleDone; 3757 this[_onDone] = handleDone;
3758 } 3758 }
3759 pause(resumeSignal) { 3759 pause(resumeSignal) {
3760 if (resumeSignal === void 0) 3760 if (resumeSignal === void 0)
3761 resumeSignal = null; 3761 resumeSignal = null;
3762 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs cription$()._PAUSED); 3762 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs cription$()._PAUSED);
3763 if (resumeSignal != null) 3763 if (resumeSignal != null)
3764 resumeSignal.whenComplete(this.resume.bind(this)); 3764 resumeSignal.whenComplete(dart.bind(this, 'resume'));
3765 } 3765 }
3766 resume() { 3766 resume() {
3767 if (this.isPaused) { 3767 if (this.isPaused) {
3768 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu bscription$()._PAUSED); 3768 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu bscription$()._PAUSED);
3769 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { 3769 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) {
3770 this[_schedule](); 3770 this[_schedule]();
3771 } 3771 }
3772 } 3772 }
3773 } 3773 }
3774 cancel() { 3774 cancel() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3822 let _AsBroadcastStream$ = dart.generic(function(T) { 3822 let _AsBroadcastStream$ = dart.generic(function(T) {
3823 class _AsBroadcastStream extends Stream$(T) { 3823 class _AsBroadcastStream extends Stream$(T) {
3824 _AsBroadcastStream(source, onListenHandler, onCancelHandler) { 3824 _AsBroadcastStream(source, onListenHandler, onCancelHandler) {
3825 this[_source] = source; 3825 this[_source] = source;
3826 this[_onListenHandler] = dart.as(Zone.current.registerUnaryCallback(onLi stenHandler), _broadcastCallback); 3826 this[_onListenHandler] = dart.as(Zone.current.registerUnaryCallback(onLi stenHandler), _broadcastCallback);
3827 this[_onCancelHandler] = dart.as(Zone.current.registerUnaryCallback(onCa ncelHandler), _broadcastCallback); 3827 this[_onCancelHandler] = dart.as(Zone.current.registerUnaryCallback(onCa ncelHandler), _broadcastCallback);
3828 this[_zone] = Zone.current; 3828 this[_zone] = Zone.current;
3829 this[_controller] = null; 3829 this[_controller] = null;
3830 this[_subscription] = null; 3830 this[_subscription] = null;
3831 super.Stream(); 3831 super.Stream();
3832 this[_controller] = new (_AsBroadcastStreamController$(T))(this[_onListe n].bind(this), this[_onCancel].bind(this)); 3832 this[_controller] = new (_AsBroadcastStreamController$(T))(dart.bind(thi s, _onListen), dart.bind(this, _onCancel));
3833 } 3833 }
3834 get isBroadcast() { 3834 get isBroadcast() {
3835 return true; 3835 return true;
3836 } 3836 }
3837 listen(onData, opts) { 3837 listen(onData, opts) {
3838 dart.as(onData, dart.functionType(dart.void, [T])); 3838 dart.as(onData, dart.functionType(dart.void, [T]));
3839 let onError = opts && 'onError' in opts ? opts.onError : null; 3839 let onError = opts && 'onError' in opts ? opts.onError : null;
3840 let onDone = opts && 'onDone' in opts ? opts.onDone : null; 3840 let onDone = opts && 'onDone' in opts ? opts.onDone : null;
3841 dart.as(onDone, dart.functionType(dart.void, [])); 3841 dart.as(onDone, dart.functionType(dart.void, []));
3842 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null; 3842 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3958 let _current = Symbol('_current'); 3958 let _current = Symbol('_current');
3959 let _futureOrPrefetch = Symbol('_futureOrPrefetch'); 3959 let _futureOrPrefetch = Symbol('_futureOrPrefetch');
3960 let _clear = Symbol('_clear'); 3960 let _clear = Symbol('_clear');
3961 let _StreamIteratorImpl$ = dart.generic(function(T) { 3961 let _StreamIteratorImpl$ = dart.generic(function(T) {
3962 class _StreamIteratorImpl extends core.Object { 3962 class _StreamIteratorImpl extends core.Object {
3963 _StreamIteratorImpl(stream) { 3963 _StreamIteratorImpl(stream) {
3964 this[_subscription] = null; 3964 this[_subscription] = null;
3965 this[_current] = null; 3965 this[_current] = null;
3966 this[_futureOrPrefetch] = null; 3966 this[_futureOrPrefetch] = null;
3967 this[_state] = _StreamIteratorImpl$()._STATE_FOUND; 3967 this[_state] = _StreamIteratorImpl$()._STATE_FOUND;
3968 this[_subscription] = stream.listen(this[_onData].bind(this), {onError: this[_onError].bind(this), onDone: this[_onDone].bind(this), cancelOnError: true }); 3968 this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true });
3969 } 3969 }
3970 get current() { 3970 get current() {
3971 return this[_current]; 3971 return this[_current];
3972 } 3972 }
3973 moveNext() { 3973 moveNext() {
3974 if (this[_state] == _StreamIteratorImpl$()._STATE_DONE) { 3974 if (this[_state] == _StreamIteratorImpl$()._STATE_DONE) {
3975 return new (_Future$(core.bool)).immediate(false); 3975 return new (_Future$(core.bool)).immediate(false);
3976 } 3976 }
3977 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) { 3977 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) {
3978 throw new core.StateError("Already waiting for next."); 3978 throw new core.StateError("Already waiting for next.");
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 }); 4192 });
4193 return _ForwardingStream; 4193 return _ForwardingStream;
4194 }); 4194 });
4195 let _ForwardingStream = _ForwardingStream$(); 4195 let _ForwardingStream = _ForwardingStream$();
4196 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) { 4196 let _ForwardingStreamSubscription$ = dart.generic(function(S, T) {
4197 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T) { 4197 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T) {
4198 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr or) { 4198 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr or) {
4199 this[_stream] = stream; 4199 this[_stream] = stream;
4200 this[_subscription] = null; 4200 this[_subscription] = null;
4201 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 4201 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
4202 this[_subscription] = this[_stream][_source].listen(this[_handleData].bi nd(this), {onError: this[_handleError].bind(this), onDone: this[_handleDone].bin d(this)}); 4202 this[_subscription] = this[_stream][_source].listen(dart.bind(this, _han dleData), {onError: dart.bind(this, _handleError), onDone: dart.bind(this, _hand leDone)});
4203 } 4203 }
4204 [_add](data) { 4204 [_add](data) {
4205 dart.as(data, T); 4205 dart.as(data, T);
4206 if (this[_isClosed]) 4206 if (this[_isClosed])
4207 return; 4207 return;
4208 super[_add](data); 4208 super[_add](data);
4209 } 4209 }
4210 [_addError](error, stackTrace) { 4210 [_addError](error, stackTrace) {
4211 if (this[_isClosed]) 4211 if (this[_isClosed])
4212 return; 4212 return;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
4609 let _transformerSink = Symbol('_transformerSink'); 4609 let _transformerSink = Symbol('_transformerSink');
4610 let _isSubscribed = Symbol('_isSubscribed'); 4610 let _isSubscribed = Symbol('_isSubscribed');
4611 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) { 4611 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) {
4612 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio n$(T) { 4612 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio n$(T) {
4613 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone , cancelOnError) { 4613 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone , cancelOnError) {
4614 this[_transformerSink] = null; 4614 this[_transformerSink] = null;
4615 this[_subscription] = null; 4615 this[_subscription] = null;
4616 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 4616 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
4617 let eventSink = new (_EventSinkWrapper$(T))(this); 4617 let eventSink = new (_EventSinkWrapper$(T))(this);
4618 this[_transformerSink] = mapper(eventSink); 4618 this[_transformerSink] = mapper(eventSink);
4619 this[_subscription] = source.listen(this[_handleData].bind(this), {onErr or: this[_handleError].bind(this), onDone: this[_handleDone].bind(this)}); 4619 this[_subscription] = source.listen(dart.bind(this, _handleData), {onErr or: dart.bind(this, _handleError), onDone: dart.bind(this, _handleDone)});
4620 } 4620 }
4621 get [_isSubscribed]() { 4621 get [_isSubscribed]() {
4622 return this[_subscription] != null; 4622 return this[_subscription] != null;
4623 } 4623 }
4624 [_add](data) { 4624 [_add](data) {
4625 dart.as(data, T); 4625 dart.as(data, T);
4626 if (this[_isClosed]) { 4626 if (this[_isClosed]) {
4627 throw new core.StateError("Stream is already closed"); 4627 throw new core.StateError("Stream is already closed");
4628 } 4628 }
4629 super[_add](data); 4629 super[_add](data);
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5831 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5832 exports.CreateTimerHandler = CreateTimerHandler; 5832 exports.CreateTimerHandler = CreateTimerHandler;
5833 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5833 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5834 exports.PrintHandler = PrintHandler; 5834 exports.PrintHandler = PrintHandler;
5835 exports.ForkHandler = ForkHandler; 5835 exports.ForkHandler = ForkHandler;
5836 exports.ZoneSpecification = ZoneSpecification; 5836 exports.ZoneSpecification = ZoneSpecification;
5837 exports.ZoneDelegate = ZoneDelegate; 5837 exports.ZoneDelegate = ZoneDelegate;
5838 exports.Zone = Zone; 5838 exports.Zone = Zone;
5839 exports.runZoned = runZoned; 5839 exports.runZoned = runZoned;
5840 })(async, core, _internal, _js_helper, _isolate_helper, collection); 5840 })(async, core, _internal, _js_helper, _isolate_helper, collection);
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