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

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

Issue 1524843002: JS: Format if statements with no else on a single line (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebased Created 5 years 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/_utils.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 dart_library.library('dart/async', null, /* Imports */[ 1 dart_library.library('dart/async', null, /* Imports */[
2 "dart/_runtime", 2 "dart/_runtime",
3 'dart/core', 3 'dart/core',
4 'dart/_internal', 4 'dart/_internal',
5 'dart/collection' 5 'dart/collection'
6 ], /* Lazy imports */[ 6 ], /* Lazy imports */[
7 'dart/_isolate_helper' 7 'dart/_isolate_helper'
8 ], function(exports, dart, core, _internal, collection, _isolate_helper) { 8 ], function(exports, dart, core, _internal, collection, _isolate_helper) {
9 'use strict'; 9 'use strict';
10 let dartx = dart.dartx; 10 let dartx = dart.dartx;
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 AsyncError[dart.implements] = () => [core.Error]; 36 AsyncError[dart.implements] = () => [core.Error];
37 dart.setSignature(AsyncError, { 37 dart.setSignature(AsyncError, {
38 constructors: () => ({AsyncError: [AsyncError, [dart.dynamic, core.StackTrac e]]}) 38 constructors: () => ({AsyncError: [AsyncError, [dart.dynamic, core.StackTrac e]]})
39 }); 39 });
40 class _UncaughtAsyncError extends AsyncError { 40 class _UncaughtAsyncError extends AsyncError {
41 _UncaughtAsyncError(error, stackTrace) { 41 _UncaughtAsyncError(error, stackTrace) {
42 super.AsyncError(error, _UncaughtAsyncError._getBestStackTrace(error, stac kTrace)); 42 super.AsyncError(error, _UncaughtAsyncError._getBestStackTrace(error, stac kTrace));
43 } 43 }
44 static _getBestStackTrace(error, stackTrace) { 44 static _getBestStackTrace(error, stackTrace) {
45 if (stackTrace != null) 45 if (stackTrace != null) return stackTrace;
46 return stackTrace;
47 if (dart.is(error, core.Error)) { 46 if (dart.is(error, core.Error)) {
48 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace); 47 return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace);
49 } 48 }
50 return null; 49 return null;
51 } 50 }
52 toString() { 51 toString() {
53 let result = `Uncaught Error: ${this.error}`; 52 let result = `Uncaught Error: ${this.error}`;
54 if (this.stackTrace != null) { 53 if (this.stackTrace != null) {
55 result = dart.notNull(result) + `\nStack Trace:\n${this.stackTrace}`; 54 result = dart.notNull(result) + `\nStack Trace:\n${this.stackTrace}`;
56 } 55 }
(...skipping 24 matching lines...) Expand all
81 }), {onError: dart.fn((error, stackTrace) => { 80 }), {onError: dart.fn((error, stackTrace) => {
82 controller[_addError](error, dart.as(stackTrace, core.StackTrace)); 81 controller[_addError](error, dart.as(stackTrace, core.StackTrace));
83 controller[_closeUnchecked](); 82 controller[_closeUnchecked]();
84 })}); 83 })});
85 return controller.stream; 84 return controller.stream;
86 } 85 }
87 static fromIterable(data) { 86 static fromIterable(data) {
88 return new (_GeneratedStreamImpl$(T))(dart.fn(() => new (_IterablePendin gEvents$(T))(data), _IterablePendingEvents$(T), [])); 87 return new (_GeneratedStreamImpl$(T))(dart.fn(() => new (_IterablePendin gEvents$(T))(data), _IterablePendingEvents$(T), []));
89 } 88 }
90 static periodic(period, computation) { 89 static periodic(period, computation) {
91 if (computation === void 0) 90 if (computation === void 0) computation = null;
92 computation = null; 91 if (computation == null) computation = dart.fn(i => null, dart.bottom, [ dart.dynamic]);
93 if (computation == null)
94 computation = dart.fn(i => null, dart.bottom, [dart.dynamic]);
95 let timer = null; 92 let timer = null;
96 let computationCount = 0; 93 let computationCount = 0;
97 let controller = null; 94 let controller = null;
98 let watch = new core.Stopwatch(); 95 let watch = new core.Stopwatch();
99 function sendEvent() { 96 function sendEvent() {
100 watch.reset(); 97 watch.reset();
101 let data = computation((() => { 98 let data = computation((() => {
102 let x = computationCount; 99 let x = computationCount;
103 computationCount = dart.notNull(x) + 1; 100 computationCount = dart.notNull(x) + 1;
104 return x; 101 return x;
(...skipping 18 matching lines...) Expand all
123 }), onResume: dart.fn(() => { 120 }), onResume: dart.fn(() => {
124 dart.assert(timer == null); 121 dart.assert(timer == null);
125 let elapsed = watch.elapsed; 122 let elapsed = watch.elapsed;
126 watch.start(); 123 watch.start();
127 timer = Timer.new(period['-'](elapsed), dart.fn(() => { 124 timer = Timer.new(period['-'](elapsed), dart.fn(() => {
128 timer = null; 125 timer = null;
129 startPeriodicTimer(); 126 startPeriodicTimer();
130 sendEvent(); 127 sendEvent();
131 })); 128 }));
132 }), onCancel: dart.fn(() => { 129 }), onCancel: dart.fn(() => {
133 if (timer != null) 130 if (timer != null) timer.cancel();
134 timer.cancel();
135 timer = null; 131 timer = null;
136 })}); 132 })});
137 return controller.stream; 133 return controller.stream;
138 } 134 }
139 static eventTransformed(source, mapSink) { 135 static eventTransformed(source, mapSink) {
140 return new (_BoundSinkStream$(dart.dynamic, T))(source, dart.as(mapSink, _SinkMapper)); 136 return new (_BoundSinkStream$(dart.dynamic, T))(source, dart.as(mapSink, _SinkMapper));
141 } 137 }
142 get isBroadcast() { 138 get isBroadcast() {
143 return false; 139 return false;
144 } 140 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 value = newValue; 297 value = newValue;
302 }), dart.as(_cancelAndErrorClosure(subscription, result), dart.functio nType(dart.dynamic, [dart.dynamic, core.StackTrace]))); 298 }), dart.as(_cancelAndErrorClosure(subscription, result), dart.functio nType(dart.dynamic, [dart.dynamic, core.StackTrace])));
303 }, dart.dynamic, [T]), {onError: dart.fn((e, st) => { 299 }, dart.dynamic, [T]), {onError: dart.fn((e, st) => {
304 result[_completeError](e, dart.as(st, core.StackTrace)); 300 result[_completeError](e, dart.as(st, core.StackTrace));
305 }), onDone: dart.fn(() => { 301 }), onDone: dart.fn(() => {
306 result[_complete](value); 302 result[_complete](value);
307 }), cancelOnError: true}); 303 }), cancelOnError: true});
308 return result; 304 return result;
309 } 305 }
310 join(separator) { 306 join(separator) {
311 if (separator === void 0) 307 if (separator === void 0) separator = "";
312 separator = "";
313 let result = new (_Future$(core.String))(); 308 let result = new (_Future$(core.String))();
314 let buffer = new core.StringBuffer(); 309 let buffer = new core.StringBuffer();
315 let subscription = null; 310 let subscription = null;
316 let first = true; 311 let first = true;
317 subscription = this.listen(dart.fn(element => { 312 subscription = this.listen(dart.fn(element => {
318 dart.as(element, T); 313 dart.as(element, T);
319 if (!dart.notNull(first)) { 314 if (!dart.notNull(first)) {
320 buffer.write(separator); 315 buffer.write(separator);
321 } 316 }
322 first = false; 317 first = false;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 let future = new (_Future$(core.Set$(T)))(); 425 let future = new (_Future$(core.Set$(T)))();
431 this.listen(dart.fn(data => { 426 this.listen(dart.fn(data => {
432 dart.as(data, T); 427 dart.as(data, T);
433 result.add(data); 428 result.add(data);
434 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => { 429 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
435 future[_complete](result); 430 future[_complete](result);
436 }), cancelOnError: true}); 431 }), cancelOnError: true});
437 return future; 432 return future;
438 } 433 }
439 drain(futureValue) { 434 drain(futureValue) {
440 if (futureValue === void 0) 435 if (futureValue === void 0) futureValue = null;
441 futureValue = null;
442 return this.listen(null, {cancelOnError: true}).asFuture(futureValue); 436 return this.listen(null, {cancelOnError: true}).asFuture(futureValue);
443 } 437 }
444 take(count) { 438 take(count) {
445 return new (_TakeStream$(T))(this, count); 439 return new (_TakeStream$(T))(this, count);
446 } 440 }
447 takeWhile(test) { 441 takeWhile(test) {
448 dart.as(test, dart.functionType(core.bool, [T])); 442 dart.as(test, dart.functionType(core.bool, [T]));
449 return new (_TakeWhileStream$(T))(this, test); 443 return new (_TakeWhileStream$(T))(this, test);
450 } 444 }
451 skip(count) { 445 skip(count) {
452 return new (_SkipStream$(T))(this, count); 446 return new (_SkipStream$(T))(this, count);
453 } 447 }
454 skipWhile(test) { 448 skipWhile(test) {
455 dart.as(test, dart.functionType(core.bool, [T])); 449 dart.as(test, dart.functionType(core.bool, [T]));
456 return new (_SkipWhileStream$(T))(this, test); 450 return new (_SkipWhileStream$(T))(this, test);
457 } 451 }
458 distinct(equals) { 452 distinct(equals) {
459 if (equals === void 0) 453 if (equals === void 0) equals = null;
460 equals = null;
461 dart.as(equals, dart.functionType(core.bool, [T, T])); 454 dart.as(equals, dart.functionType(core.bool, [T, T]));
462 return new (_DistinctStream$(T))(this, equals); 455 return new (_DistinctStream$(T))(this, equals);
463 } 456 }
464 get first() { 457 get first() {
465 let future = new (_Future$(T))(); 458 let future = new (_Future$(T))();
466 let subscription = null; 459 let subscription = null;
467 subscription = this.listen(dart.fn(value => { 460 subscription = this.listen(dart.fn(value => {
468 dart.as(value, T); 461 dart.as(value, T);
469 _cancelAndValue(subscription, future, value); 462 _cancelAndValue(subscription, future, value);
470 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => { 463 }, dart.dynamic, [T]), {onError: dart.bind(future, _completeError), onDo ne: dart.fn(() => {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 dart.throw(_internal.IterableElementError.noElement()); 625 dart.throw(_internal.IterableElementError.noElement());
633 } catch (e) { 626 } catch (e) {
634 let s = dart.stackTrace(e); 627 let s = dart.stackTrace(e);
635 _completeWithErrorCallback(future, e, s); 628 _completeWithErrorCallback(future, e, s);
636 } 629 }
637 630
638 }), cancelOnError: true}); 631 }), cancelOnError: true});
639 return future; 632 return future;
640 } 633 }
641 elementAt(index) { 634 elementAt(index) {
642 if (!(typeof index == 'number') || dart.notNull(index) < 0) 635 if (!(typeof index == 'number') || dart.notNull(index) < 0) dart.throw(n ew core.ArgumentError(index));
643 dart.throw(new core.ArgumentError(index));
644 let future = new (_Future$(T))(); 636 let future = new (_Future$(T))();
645 let subscription = null; 637 let subscription = null;
646 let elementIndex = 0; 638 let elementIndex = 0;
647 subscription = this.listen(dart.fn(value => { 639 subscription = this.listen(dart.fn(value => {
648 dart.as(value, T); 640 dart.as(value, T);
649 if (index == elementIndex) { 641 if (index == elementIndex) {
650 _cancelAndValue(subscription, future, value); 642 _cancelAndValue(subscription, future, value);
651 return; 643 return;
652 } 644 }
653 elementIndex = dart.notNull(elementIndex) + 1; 645 elementIndex = dart.notNull(elementIndex) + 1;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 } 799 }
808 [_createSubscription](onData, onError, onDone, cancelOnError) { 800 [_createSubscription](onData, onError, onDone, cancelOnError) {
809 dart.as(onData, dart.functionType(dart.void, [T])); 801 dart.as(onData, dart.functionType(dart.void, [T]));
810 dart.as(onDone, dart.functionType(dart.void, [])); 802 dart.as(onDone, dart.functionType(dart.void, []));
811 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr ror); 803 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr ror);
812 } 804 }
813 get hashCode() { 805 get hashCode() {
814 return dart.notNull(dart.hashCode(this[_controller])) ^ 892482866; 806 return dart.notNull(dart.hashCode(this[_controller])) ^ 892482866;
815 } 807 }
816 ['=='](other) { 808 ['=='](other) {
817 if (dart.notNull(core.identical(this, other))) 809 if (dart.notNull(core.identical(this, other))) return true;
818 return true; 810 if (!dart.is(other, _ControllerStream$())) return false;
819 if (!dart.is(other, _ControllerStream$()))
820 return false;
821 let otherStream = dart.as(other, _ControllerStream$()); 811 let otherStream = dart.as(other, _ControllerStream$());
822 return core.identical(otherStream[_controller], this[_controller]); 812 return core.identical(otherStream[_controller], this[_controller]);
823 } 813 }
824 } 814 }
825 dart.setSignature(_ControllerStream, { 815 dart.setSignature(_ControllerStream, {
826 constructors: () => ({_ControllerStream: [_ControllerStream$(T), [_StreamC ontrollerLifecycle$(T)]]}), 816 constructors: () => ({_ControllerStream: [_ControllerStream$(T), [_StreamC ontrollerLifecycle$(T)]]}),
827 methods: () => ({ 817 methods: () => ({
828 [_createSubscription]: [StreamSubscription$(T), [dart.functionType(dart. void, [T]), core.Function, dart.functionType(dart.void, []), core.bool]], 818 [_createSubscription]: [StreamSubscription$(T), [dart.functionType(dart. void, [T]), core.Function, dart.functionType(dart.void, []), core.bool]],
829 '==': [core.bool, [core.Object]] 819 '==': [core.bool, [core.Object]]
830 }) 820 })
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 this[_onError] = null; 886 this[_onError] = null;
897 this[_onDone] = null; 887 this[_onDone] = null;
898 this[_cancelFuture] = null; 888 this[_cancelFuture] = null;
899 this[_pending] = null; 889 this[_pending] = null;
900 this.onData(onData); 890 this.onData(onData);
901 this.onError(onError); 891 this.onError(onError);
902 this.onDone(onDone); 892 this.onDone(onDone);
903 } 893 }
904 [_setPendingEvents](pendingEvents) { 894 [_setPendingEvents](pendingEvents) {
905 dart.assert(this[_pending] == null); 895 dart.assert(this[_pending] == null);
906 if (pendingEvents == null) 896 if (pendingEvents == null) return;
907 return;
908 this[_pending] = pendingEvents; 897 this[_pending] = pendingEvents;
909 if (!dart.notNull(pendingEvents.isEmpty)) { 898 if (!dart.notNull(pendingEvents.isEmpty)) {
910 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_HAS_PENDING); 899 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_HAS_PENDING);
911 this[_pending].schedule(this); 900 this[_pending].schedule(this);
912 } 901 }
913 } 902 }
914 [_extractPending]() { 903 [_extractPending]() {
915 dart.assert(this[_isCanceled]); 904 dart.assert(this[_isCanceled]);
916 let events = this[_pending]; 905 let events = this[_pending];
917 this[_pending] = null; 906 this[_pending] = null;
918 return events; 907 return events;
919 } 908 }
920 onData(handleData) { 909 onData(handleData) {
921 dart.as(handleData, dart.functionType(dart.void, [T])); 910 dart.as(handleData, dart.functionType(dart.void, [T]));
922 if (handleData == null) 911 if (handleData == null) handleData = dart.as(_nullDataHandler, __CastTyp e20);
923 handleData = dart.as(_nullDataHandler, __CastType20);
924 this[_onData] = dart.as(this[_zone].registerUnaryCallback(handleData), _ DataHandler$(T)); 912 this[_onData] = dart.as(this[_zone].registerUnaryCallback(handleData), _ DataHandler$(T));
925 } 913 }
926 onError(handleError) { 914 onError(handleError) {
927 if (handleError == null) 915 if (handleError == null) handleError = _nullErrorHandler;
928 handleError = _nullErrorHandler;
929 this[_onError] = _registerErrorHandler(handleError, this[_zone]); 916 this[_onError] = _registerErrorHandler(handleError, this[_zone]);
930 } 917 }
931 onDone(handleDone) { 918 onDone(handleDone) {
932 dart.as(handleDone, dart.functionType(dart.void, [])); 919 dart.as(handleDone, dart.functionType(dart.void, []));
933 if (handleDone == null) 920 if (handleDone == null) handleDone = _nullDoneHandler;
934 handleDone = _nullDoneHandler;
935 this[_onDone] = this[_zone].registerCallback(handleDone); 921 this[_onDone] = this[_zone].registerCallback(handleDone);
936 } 922 }
937 pause(resumeSignal) { 923 pause(resumeSignal) {
938 if (resumeSignal === void 0) 924 if (resumeSignal === void 0) resumeSignal = null;
939 resumeSignal = null; 925 if (dart.notNull(this[_isCanceled])) return;
940 if (dart.notNull(this[_isCanceled]))
941 return;
942 let wasPaused = this[_isPaused]; 926 let wasPaused = this[_isPaused];
943 let wasInputPaused = this[_isInputPaused]; 927 let wasInputPaused = this[_isInputPaused];
944 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription $()._STATE_INPUT_PAUSED); 928 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription $()._STATE_INPUT_PAUSED);
945 if (resumeSignal != null) 929 if (resumeSignal != null) resumeSignal.whenComplete(dart.bind(this, 'res ume'));
946 resumeSignal.whenComplete(dart.bind(this, 'resume')); 930 if (!dart.notNull(wasPaused) && this[_pending] != null) this[_pending].c ancelSchedule();
947 if (!dart.notNull(wasPaused) && this[_pending] != null) 931 if (!dart.notNull(wasInputPaused) && !dart.notNull(this[_inCallback])) t his[_guardCallback](dart.bind(this, _onPause));
948 this[_pending].cancelSchedule();
949 if (!dart.notNull(wasInputPaused) && !dart.notNull(this[_inCallback]))
950 this[_guardCallback](dart.bind(this, _onPause));
951 } 932 }
952 resume() { 933 resume() {
953 if (dart.notNull(this[_isCanceled])) 934 if (dart.notNull(this[_isCanceled])) return;
954 return;
955 if (dart.notNull(this[_isPaused])) { 935 if (dart.notNull(this[_isPaused])) {
956 this[_decrementPauseCount](); 936 this[_decrementPauseCount]();
957 if (!dart.notNull(this[_isPaused])) { 937 if (!dart.notNull(this[_isPaused])) {
958 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) { 938 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_pending]. isEmpty)) {
959 this[_pending].schedule(this); 939 this[_pending].schedule(this);
960 } else { 940 } else {
961 dart.assert(this[_mayResumeInput]); 941 dart.assert(this[_mayResumeInput]);
962 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi ngStreamSubscription$()._STATE_INPUT_PAUSED); 942 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Bufferi ngStreamSubscription$()._STATE_INPUT_PAUSED);
963 if (!dart.notNull(this[_inCallback])) 943 if (!dart.notNull(this[_inCallback])) this[_guardCallback](dart.bi nd(this, _onResume));
964 this[_guardCallback](dart.bind(this, _onResume));
965 } 944 }
966 } 945 }
967 } 946 }
968 } 947 }
969 cancel() { 948 cancel() {
970 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription$()._STATE_WAIT_FOR_CANCEL); 949 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription$()._STATE_WAIT_FOR_CANCEL);
971 if (dart.notNull(this[_isCanceled])) 950 if (dart.notNull(this[_isCanceled])) return this[_cancelFuture];
972 return this[_cancelFuture];
973 this[_cancel](); 951 this[_cancel]();
974 return this[_cancelFuture]; 952 return this[_cancelFuture];
975 } 953 }
976 asFuture(futureValue) { 954 asFuture(futureValue) {
977 if (futureValue === void 0) 955 if (futureValue === void 0) futureValue = null;
978 futureValue = null;
979 let result = new (_Future$(T))(); 956 let result = new (_Future$(T))();
980 this[_onDone] = dart.fn(() => { 957 this[_onDone] = dart.fn(() => {
981 result[_complete](futureValue); 958 result[_complete](futureValue);
982 }); 959 });
983 this[_onError] = dart.fn(((error, stackTrace) => { 960 this[_onError] = dart.fn(((error, stackTrace) => {
984 this.cancel(); 961 this.cancel();
985 result[_completeError](error, dart.as(stackTrace, core.StackTrace)); 962 result[_completeError](error, dart.as(stackTrace, core.StackTrace));
986 }).bind(this)); 963 }).bind(this));
987 return result; 964 return result;
988 } 965 }
(...skipping 28 matching lines...) Expand all
1017 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr iption$()._STATE_CANCEL_ON_ERROR)) != 0; 994 return (dart.notNull(this[_state]) & dart.notNull(_BufferingStreamSubscr iption$()._STATE_CANCEL_ON_ERROR)) != 0;
1018 } 995 }
1019 get isPaused() { 996 get isPaused() {
1020 return this[_isPaused]; 997 return this[_isPaused];
1021 } 998 }
1022 [_cancel]() { 999 [_cancel]() {
1023 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_CANCELED); 1000 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_CANCELED);
1024 if (dart.notNull(this[_hasPending])) { 1001 if (dart.notNull(this[_hasPending])) {
1025 this[_pending].cancelSchedule(); 1002 this[_pending].cancelSchedule();
1026 } 1003 }
1027 if (!dart.notNull(this[_inCallback])) 1004 if (!dart.notNull(this[_inCallback])) this[_pending] = null;
1028 this[_pending] = null;
1029 this[_cancelFuture] = this[_onCancel](); 1005 this[_cancelFuture] = this[_onCancel]();
1030 } 1006 }
1031 [_incrementPauseCount]() { 1007 [_incrementPauseCount]() {
1032 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription $()._STATE_INPUT_PAUSED); 1008 this[_state] = dart.notNull(this[_state]) + dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT) | dart.notNull(_BufferingStreamSubscription $()._STATE_INPUT_PAUSED);
1033 } 1009 }
1034 [_decrementPauseCount]() { 1010 [_decrementPauseCount]() {
1035 dart.assert(this[_isPaused]); 1011 dart.assert(this[_isPaused]);
1036 this[_state] = dart.notNull(this[_state]) - dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT); 1012 this[_state] = dart.notNull(this[_state]) - dart.notNull(_BufferingStrea mSubscription$()._STATE_PAUSE_COUNT);
1037 } 1013 }
1038 [_add](data) { 1014 [_add](data) {
1039 dart.as(data, T); 1015 dart.as(data, T);
1040 dart.assert(!dart.notNull(this[_isClosed])); 1016 dart.assert(!dart.notNull(this[_isClosed]));
1041 if (dart.notNull(this[_isCanceled])) 1017 if (dart.notNull(this[_isCanceled])) return;
1042 return;
1043 if (dart.notNull(this[_canFire])) { 1018 if (dart.notNull(this[_canFire])) {
1044 this[_sendData](data); 1019 this[_sendData](data);
1045 } else { 1020 } else {
1046 this[_addPending](new _DelayedData(data)); 1021 this[_addPending](new _DelayedData(data));
1047 } 1022 }
1048 } 1023 }
1049 [_addError](error, stackTrace) { 1024 [_addError](error, stackTrace) {
1050 if (dart.notNull(this[_isCanceled])) 1025 if (dart.notNull(this[_isCanceled])) return;
1051 return;
1052 if (dart.notNull(this[_canFire])) { 1026 if (dart.notNull(this[_canFire])) {
1053 this[_sendError](error, stackTrace); 1027 this[_sendError](error, stackTrace);
1054 } else { 1028 } else {
1055 this[_addPending](new _DelayedError(error, stackTrace)); 1029 this[_addPending](new _DelayedError(error, stackTrace));
1056 } 1030 }
1057 } 1031 }
1058 [_close]() { 1032 [_close]() {
1059 dart.assert(!dart.notNull(this[_isClosed])); 1033 dart.assert(!dart.notNull(this[_isClosed]));
1060 if (dart.notNull(this[_isCanceled])) 1034 if (dart.notNull(this[_isCanceled])) return;
1061 return;
1062 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_CLOSED); 1035 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_CLOSED);
1063 if (dart.notNull(this[_canFire])) { 1036 if (dart.notNull(this[_canFire])) {
1064 this[_sendDone](); 1037 this[_sendDone]();
1065 } else { 1038 } else {
1066 this[_addPending](dart.const(new _DelayedDone())); 1039 this[_addPending](dart.const(new _DelayedDone()));
1067 } 1040 }
1068 } 1041 }
1069 [_onPause]() { 1042 [_onPause]() {
1070 dart.assert(this[_isInputPaused]); 1043 dart.assert(this[_isInputPaused]);
1071 } 1044 }
1072 [_onResume]() { 1045 [_onResume]() {
1073 dart.assert(!dart.notNull(this[_isInputPaused])); 1046 dart.assert(!dart.notNull(this[_isInputPaused]));
1074 } 1047 }
1075 [_onCancel]() { 1048 [_onCancel]() {
1076 dart.assert(this[_isCanceled]); 1049 dart.assert(this[_isCanceled]);
1077 return null; 1050 return null;
1078 } 1051 }
1079 [_addPending](event) { 1052 [_addPending](event) {
1080 let pending = dart.as(this[_pending], _StreamImplEvents); 1053 let pending = dart.as(this[_pending], _StreamImplEvents);
1081 if (this[_pending] == null) 1054 if (this[_pending] == null) pending = this[_pending] = new _StreamImplEv ents();
1082 pending = this[_pending] = new _StreamImplEvents();
1083 pending.add(event); 1055 pending.add(event);
1084 if (!dart.notNull(this[_hasPending])) { 1056 if (!dart.notNull(this[_hasPending])) {
1085 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_HAS_PENDING); 1057 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_HAS_PENDING);
1086 if (!dart.notNull(this[_isPaused])) { 1058 if (!dart.notNull(this[_isPaused])) {
1087 this[_pending].schedule(this); 1059 this[_pending].schedule(this);
1088 } 1060 }
1089 } 1061 }
1090 } 1062 }
1091 [_sendData](data) { 1063 [_sendData](data) {
1092 dart.as(data, T); 1064 dart.as(data, T);
1093 dart.assert(!dart.notNull(this[_isCanceled])); 1065 dart.assert(!dart.notNull(this[_isCanceled]));
1094 dart.assert(!dart.notNull(this[_isPaused])); 1066 dart.assert(!dart.notNull(this[_isPaused]));
1095 dart.assert(!dart.notNull(this[_inCallback])); 1067 dart.assert(!dart.notNull(this[_inCallback]));
1096 let wasInputPaused = this[_isInputPaused]; 1068 let wasInputPaused = this[_isInputPaused];
1097 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_IN_CALLBACK); 1069 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_IN_CALLBACK);
1098 this[_zone].runUnaryGuarded(this[_onData], data); 1070 this[_zone].runUnaryGuarded(this[_onData], data);
1099 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription$()._STATE_IN_CALLBACK); 1071 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStre amSubscription$()._STATE_IN_CALLBACK);
1100 this[_checkState](wasInputPaused); 1072 this[_checkState](wasInputPaused);
1101 } 1073 }
1102 [_sendError](error, stackTrace) { 1074 [_sendError](error, stackTrace) {
1103 dart.assert(!dart.notNull(this[_isCanceled])); 1075 dart.assert(!dart.notNull(this[_isCanceled]));
1104 dart.assert(!dart.notNull(this[_isPaused])); 1076 dart.assert(!dart.notNull(this[_isPaused]));
1105 dart.assert(!dart.notNull(this[_inCallback])); 1077 dart.assert(!dart.notNull(this[_inCallback]));
1106 let wasInputPaused = this[_isInputPaused]; 1078 let wasInputPaused = this[_isInputPaused];
1107 const sendError = (function() { 1079 const sendError = (function() {
1108 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel])) 1080 if (dart.notNull(this[_isCanceled]) && !dart.notNull(this[_waitsForCan cel])) return;
1109 return;
1110 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_IN_CALLBACK); 1081 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_IN_CALLBACK);
1111 if (dart.is(this[_onError], ZoneBinaryCallback)) { 1082 if (dart.is(this[_onError], ZoneBinaryCallback)) {
1112 this[_zone].runBinaryGuarded(dart.as(this[_onError], __CastType22), error, stackTrace); 1083 this[_zone].runBinaryGuarded(dart.as(this[_onError], __CastType22), error, stackTrace);
1113 } else { 1084 } else {
1114 this[_zone].runUnaryGuarded(dart.as(this[_onError], __CastType25), e rror); 1085 this[_zone].runUnaryGuarded(dart.as(this[_onError], __CastType25), e rror);
1115 } 1086 }
1116 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription$()._STATE_IN_CALLBACK); 1087 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription$()._STATE_IN_CALLBACK);
1117 }).bind(this); 1088 }).bind(this);
1118 dart.fn(sendError, dart.void, []); 1089 dart.fn(sendError, dart.void, []);
1119 if (dart.notNull(this[_cancelOnError])) { 1090 if (dart.notNull(this[_cancelOnError])) {
1120 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_WAIT_FOR_CANCEL); 1091 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_WAIT_FOR_CANCEL);
1121 this[_cancel](); 1092 this[_cancel]();
1122 if (dart.is(this[_cancelFuture], Future)) { 1093 if (dart.is(this[_cancelFuture], Future)) {
1123 this[_cancelFuture].whenComplete(sendError); 1094 this[_cancelFuture].whenComplete(sendError);
1124 } else { 1095 } else {
1125 sendError(); 1096 sendError();
1126 } 1097 }
1127 } else { 1098 } else {
1128 sendError(); 1099 sendError();
1129 this[_checkState](wasInputPaused); 1100 this[_checkState](wasInputPaused);
1130 } 1101 }
1131 } 1102 }
1132 [_sendDone]() { 1103 [_sendDone]() {
1133 dart.assert(!dart.notNull(this[_isCanceled])); 1104 dart.assert(!dart.notNull(this[_isCanceled]));
1134 dart.assert(!dart.notNull(this[_isPaused])); 1105 dart.assert(!dart.notNull(this[_isPaused]));
1135 dart.assert(!dart.notNull(this[_inCallback])); 1106 dart.assert(!dart.notNull(this[_inCallback]));
1136 const sendDone = (function() { 1107 const sendDone = (function() {
1137 if (!dart.notNull(this[_waitsForCancel])) 1108 if (!dart.notNull(this[_waitsForCancel])) return;
1138 return;
1139 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_CANCELED) | dart.notNull(_BufferingStreamSubscription$ ()._STATE_CLOSED) | dart.notNull(_BufferingStreamSubscription$()._STATE_IN_CALLB ACK); 1109 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStr eamSubscription$()._STATE_CANCELED) | dart.notNull(_BufferingStreamSubscription$ ()._STATE_CLOSED) | dart.notNull(_BufferingStreamSubscription$()._STATE_IN_CALLB ACK);
1140 this[_zone].runGuarded(this[_onDone]); 1110 this[_zone].runGuarded(this[_onDone]);
1141 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription$()._STATE_IN_CALLBACK); 1111 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription$()._STATE_IN_CALLBACK);
1142 }).bind(this); 1112 }).bind(this);
1143 dart.fn(sendDone, dart.void, []); 1113 dart.fn(sendDone, dart.void, []);
1144 this[_cancel](); 1114 this[_cancel]();
1145 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_WAIT_FOR_CANCEL); 1115 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStrea mSubscription$()._STATE_WAIT_FOR_CANCEL);
1146 if (dart.is(this[_cancelFuture], Future)) { 1116 if (dart.is(this[_cancelFuture], Future)) {
1147 this[_cancelFuture].whenComplete(sendDone); 1117 this[_cancelFuture].whenComplete(sendDone);
1148 } else { 1118 } else {
(...skipping 15 matching lines...) Expand all
1164 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) { 1134 if (dart.notNull(this[_isInputPaused]) && dart.notNull(this[_mayResume Input])) {
1165 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Buffering StreamSubscription$()._STATE_INPUT_PAUSED); 1135 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_Buffering StreamSubscription$()._STATE_INPUT_PAUSED);
1166 } 1136 }
1167 } 1137 }
1168 while (true) { 1138 while (true) {
1169 if (dart.notNull(this[_isCanceled])) { 1139 if (dart.notNull(this[_isCanceled])) {
1170 this[_pending] = null; 1140 this[_pending] = null;
1171 return; 1141 return;
1172 } 1142 }
1173 let isInputPaused = this[_isInputPaused]; 1143 let isInputPaused = this[_isInputPaused];
1174 if (wasInputPaused == isInputPaused) 1144 if (wasInputPaused == isInputPaused) break;
1175 break;
1176 this[_state] = dart.notNull(this[_state]) ^ dart.notNull(_BufferingStr eamSubscription$()._STATE_IN_CALLBACK); 1145 this[_state] = dart.notNull(this[_state]) ^ dart.notNull(_BufferingStr eamSubscription$()._STATE_IN_CALLBACK);
1177 if (dart.notNull(isInputPaused)) { 1146 if (dart.notNull(isInputPaused)) {
1178 this[_onPause](); 1147 this[_onPause]();
1179 } else { 1148 } else {
1180 this[_onResume](); 1149 this[_onResume]();
1181 } 1150 }
1182 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription$()._STATE_IN_CALLBACK); 1151 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingSt reamSubscription$()._STATE_IN_CALLBACK);
1183 wasInputPaused = isInputPaused; 1152 wasInputPaused = isInputPaused;
1184 } 1153 }
1185 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) { 1154 if (dart.notNull(this[_hasPending]) && !dart.notNull(this[_isPaused])) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 get [_isFiring]() { 1311 get [_isFiring]() {
1343 return (dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContro ller$()._STATE_FIRING)) != 0; 1312 return (dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContro ller$()._STATE_FIRING)) != 0;
1344 } 1313 }
1345 get [_isAddingStream]() { 1314 get [_isAddingStream]() {
1346 return (dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContro ller$()._STATE_ADDSTREAM)) != 0; 1315 return (dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContro ller$()._STATE_ADDSTREAM)) != 0;
1347 } 1316 }
1348 get [_mayAddEvent]() { 1317 get [_mayAddEvent]() {
1349 return dart.notNull(this[_state]) < dart.notNull(_BroadcastStreamControl ler$()._STATE_CLOSED); 1318 return dart.notNull(this[_state]) < dart.notNull(_BroadcastStreamControl ler$()._STATE_CLOSED);
1350 } 1319 }
1351 [_ensureDoneFuture]() { 1320 [_ensureDoneFuture]() {
1352 if (this[_doneFuture] != null) 1321 if (this[_doneFuture] != null) return this[_doneFuture];
1353 return this[_doneFuture];
1354 return this[_doneFuture] = new _Future(); 1322 return this[_doneFuture] = new _Future();
1355 } 1323 }
1356 get [_isEmpty]() { 1324 get [_isEmpty]() {
1357 return core.identical(this[_next], this); 1325 return core.identical(this[_next], this);
1358 } 1326 }
1359 [_addListener](subscription) { 1327 [_addListener](subscription) {
1360 dart.as(subscription, _BroadcastSubscription$(T)); 1328 dart.as(subscription, _BroadcastSubscription$(T));
1361 dart.assert(core.identical(subscription[_next], subscription)); 1329 dart.assert(core.identical(subscription[_next], subscription));
1362 subscription[_previous] = this[_previous]; 1330 subscription[_previous] = this[_previous];
1363 subscription[_next] = this; 1331 subscription[_next] = this;
1364 this[_previous][_next] = subscription; 1332 this[_previous][_next] = subscription;
1365 this[_previous] = subscription; 1333 this[_previous] = subscription;
1366 subscription[_eventState] = dart.notNull(this[_state]) & dart.notNull(_B roadcastStreamController$()._STATE_EVENT_ID); 1334 subscription[_eventState] = dart.notNull(this[_state]) & dart.notNull(_B roadcastStreamController$()._STATE_EVENT_ID);
1367 } 1335 }
1368 [_removeListener](subscription) { 1336 [_removeListener](subscription) {
1369 dart.as(subscription, _BroadcastSubscription$(T)); 1337 dart.as(subscription, _BroadcastSubscription$(T));
1370 dart.assert(core.identical(subscription[_controller], this)); 1338 dart.assert(core.identical(subscription[_controller], this));
1371 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti on))); 1339 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti on)));
1372 let previous = subscription[_previous]; 1340 let previous = subscription[_previous];
1373 let next = subscription[_next]; 1341 let next = subscription[_next];
1374 previous[_next] = next; 1342 previous[_next] = next;
1375 next[_previous] = previous; 1343 next[_previous] = previous;
1376 subscription[_next] = subscription[_previous] = subscription; 1344 subscription[_next] = subscription[_previous] = subscription;
1377 } 1345 }
1378 [_subscribe](onData, onError, onDone, cancelOnError) { 1346 [_subscribe](onData, onError, onDone, cancelOnError) {
1379 dart.as(onData, dart.functionType(dart.void, [T])); 1347 dart.as(onData, dart.functionType(dart.void, [T]));
1380 dart.as(onDone, dart.functionType(dart.void, [])); 1348 dart.as(onDone, dart.functionType(dart.void, []));
1381 if (dart.notNull(this.isClosed)) { 1349 if (dart.notNull(this.isClosed)) {
1382 if (onDone == null) 1350 if (onDone == null) onDone = _nullDoneHandler;
1383 onDone = _nullDoneHandler;
1384 return new (_DoneStreamSubscription$(T))(onDone); 1351 return new (_DoneStreamSubscription$(T))(onDone);
1385 } 1352 }
1386 let subscription = new (_BroadcastSubscription$(T))(this, onData, onErro r, onDone, cancelOnError); 1353 let subscription = new (_BroadcastSubscription$(T))(this, onData, onErro r, onDone, cancelOnError);
1387 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T))); 1354 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T)));
1388 if (dart.notNull(core.identical(this[_next], this[_previous]))) { 1355 if (dart.notNull(core.identical(this[_next], this[_previous]))) {
1389 _runGuarded(this[_onListen]); 1356 _runGuarded(this[_onListen]);
1390 } 1357 }
1391 return dart.as(subscription, StreamSubscription$(T)); 1358 return dart.as(subscription, StreamSubscription$(T));
1392 } 1359 }
1393 [_recordCancel](sub) { 1360 [_recordCancel](sub) {
1394 dart.as(sub, StreamSubscription$(T)); 1361 dart.as(sub, StreamSubscription$(T));
1395 let subscription = dart.as(sub, _BroadcastSubscription$(T)); 1362 let subscription = dart.as(sub, _BroadcastSubscription$(T));
1396 if (dart.notNull(core.identical(subscription[_next], subscription))) 1363 if (dart.notNull(core.identical(subscription[_next], subscription))) ret urn null;
1397 return null;
1398 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti on))); 1364 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti on)));
1399 if (dart.notNull(subscription[_isFiring])) { 1365 if (dart.notNull(subscription[_isFiring])) {
1400 subscription[_setRemoveAfterFiring](); 1366 subscription[_setRemoveAfterFiring]();
1401 } else { 1367 } else {
1402 dart.assert(!dart.notNull(core.identical(subscription[_next], subscrip tion))); 1368 dart.assert(!dart.notNull(core.identical(subscription[_next], subscrip tion)));
1403 this[_removeListener](subscription); 1369 this[_removeListener](subscription);
1404 if (!dart.notNull(this[_isFiring]) && dart.notNull(this[_isEmpty])) { 1370 if (!dart.notNull(this[_isFiring]) && dart.notNull(this[_isEmpty])) {
1405 this[_callOnCancel](); 1371 this[_callOnCancel]();
1406 } 1372 }
1407 } 1373 }
1408 return null; 1374 return null;
1409 } 1375 }
1410 [_recordPause](subscription) { 1376 [_recordPause](subscription) {
1411 dart.as(subscription, StreamSubscription$(T)); 1377 dart.as(subscription, StreamSubscription$(T));
1412 } 1378 }
1413 [_recordResume](subscription) { 1379 [_recordResume](subscription) {
1414 dart.as(subscription, StreamSubscription$(T)); 1380 dart.as(subscription, StreamSubscription$(T));
1415 } 1381 }
1416 [_addEventError]() { 1382 [_addEventError]() {
1417 if (dart.notNull(this.isClosed)) { 1383 if (dart.notNull(this.isClosed)) {
1418 return new core.StateError("Cannot add new events after calling close" ); 1384 return new core.StateError("Cannot add new events after calling close" );
1419 } 1385 }
1420 dart.assert(this[_isAddingStream]); 1386 dart.assert(this[_isAddingStream]);
1421 return new core.StateError("Cannot add new events while doing an addStre am"); 1387 return new core.StateError("Cannot add new events while doing an addStre am");
1422 } 1388 }
1423 add(data) { 1389 add(data) {
1424 dart.as(data, T); 1390 dart.as(data, T);
1425 if (!dart.notNull(this[_mayAddEvent])) 1391 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_addEventError]() );
1426 dart.throw(this[_addEventError]());
1427 this[_sendData](data); 1392 this[_sendData](data);
1428 } 1393 }
1429 addError(error, stackTrace) { 1394 addError(error, stackTrace) {
1430 if (stackTrace === void 0) 1395 if (stackTrace === void 0) stackTrace = null;
1431 stackTrace = null;
1432 error = _nonNullError(error); 1396 error = _nonNullError(error);
1433 if (!dart.notNull(this[_mayAddEvent])) 1397 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_addEventError]() );
1434 dart.throw(this[_addEventError]());
1435 let replacement = Zone.current.errorCallback(error, stackTrace); 1398 let replacement = Zone.current.errorCallback(error, stackTrace);
1436 if (replacement != null) { 1399 if (replacement != null) {
1437 error = _nonNullError(replacement.error); 1400 error = _nonNullError(replacement.error);
1438 stackTrace = replacement.stackTrace; 1401 stackTrace = replacement.stackTrace;
1439 } 1402 }
1440 this[_sendError](error, stackTrace); 1403 this[_sendError](error, stackTrace);
1441 } 1404 }
1442 close() { 1405 close() {
1443 if (dart.notNull(this.isClosed)) { 1406 if (dart.notNull(this.isClosed)) {
1444 dart.assert(this[_doneFuture] != null); 1407 dart.assert(this[_doneFuture] != null);
1445 return this[_doneFuture]; 1408 return this[_doneFuture];
1446 } 1409 }
1447 if (!dart.notNull(this[_mayAddEvent])) 1410 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_addEventError]() );
1448 dart.throw(this[_addEventError]());
1449 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController$()._STATE_CLOSED); 1411 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController$()._STATE_CLOSED);
1450 let doneFuture = this[_ensureDoneFuture](); 1412 let doneFuture = this[_ensureDoneFuture]();
1451 this[_sendDone](); 1413 this[_sendDone]();
1452 return doneFuture; 1414 return doneFuture;
1453 } 1415 }
1454 get done() { 1416 get done() {
1455 return this[_ensureDoneFuture](); 1417 return this[_ensureDoneFuture]();
1456 } 1418 }
1457 addStream(stream, opts) { 1419 addStream(stream, opts) {
1458 dart.as(stream, Stream$(T)); 1420 dart.as(stream, Stream$(T));
1459 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 1421 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
1460 if (!dart.notNull(this[_mayAddEvent])) 1422 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_addEventError]() );
1461 dart.throw(this[_addEventError]());
1462 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController$()._STATE_ADDSTREAM); 1423 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStrea mController$()._STATE_ADDSTREAM);
1463 this[_addStreamState] = new (_AddStreamState$(T))(this, stream, cancelOn Error); 1424 this[_addStreamState] = new (_AddStreamState$(T))(this, stream, cancelOn Error);
1464 return this[_addStreamState].addStreamFuture; 1425 return this[_addStreamState].addStreamFuture;
1465 } 1426 }
1466 [_add](data) { 1427 [_add](data) {
1467 dart.as(data, T); 1428 dart.as(data, T);
1468 this[_sendData](data); 1429 this[_sendData](data);
1469 } 1430 }
1470 [_addError](error, stackTrace) { 1431 [_addError](error, stackTrace) {
1471 this[_sendError](error, stackTrace); 1432 this[_sendError](error, stackTrace);
1472 } 1433 }
1473 [_close]() { 1434 [_close]() {
1474 dart.assert(this[_isAddingStream]); 1435 dart.assert(this[_isAddingStream]);
1475 let addState = this[_addStreamState]; 1436 let addState = this[_addStreamState];
1476 this[_addStreamState] = null; 1437 this[_addStreamState] = null;
1477 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre amController$()._STATE_ADDSTREAM); 1438 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastStre amController$()._STATE_ADDSTREAM);
1478 addState.complete(); 1439 addState.complete();
1479 } 1440 }
1480 [_forEachListener](action) { 1441 [_forEachListener](action) {
1481 dart.as(action, dart.functionType(dart.void, [_BufferingStreamSubscripti on$(T)])); 1442 dart.as(action, dart.functionType(dart.void, [_BufferingStreamSubscripti on$(T)]));
1482 if (dart.notNull(this[_isFiring])) { 1443 if (dart.notNull(this[_isFiring])) {
1483 dart.throw(new core.StateError("Cannot fire new event. Controller is a lready firing an event")); 1444 dart.throw(new core.StateError("Cannot fire new event. Controller is a lready firing an event"));
1484 } 1445 }
1485 if (dart.notNull(this[_isEmpty])) 1446 if (dart.notNull(this[_isEmpty])) return;
1486 return;
1487 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr oller$()._STATE_EVENT_ID); 1447 let id = dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContr oller$()._STATE_EVENT_ID);
1488 this[_state] = dart.notNull(this[_state]) ^ (dart.notNull(_BroadcastStre amController$()._STATE_EVENT_ID) | dart.notNull(_BroadcastStreamController$()._S TATE_FIRING)); 1448 this[_state] = dart.notNull(this[_state]) ^ (dart.notNull(_BroadcastStre amController$()._STATE_EVENT_ID) | dart.notNull(_BroadcastStreamController$()._S TATE_FIRING));
1489 let link = this[_next]; 1449 let link = this[_next];
1490 while (!dart.notNull(core.identical(link, this))) { 1450 while (!dart.notNull(core.identical(link, this))) {
1491 let subscription = dart.as(link, _BroadcastSubscription$(T)); 1451 let subscription = dart.as(link, _BroadcastSubscription$(T));
1492 if (dart.notNull(subscription[_expectsEvent](id))) { 1452 if (dart.notNull(subscription[_expectsEvent](id))) {
1493 subscription[_eventState] = dart.notNull(subscription[_eventState]) | dart.notNull(_BroadcastSubscription._STATE_FIRING); 1453 subscription[_eventState] = dart.notNull(subscription[_eventState]) | dart.notNull(_BroadcastSubscription._STATE_FIRING);
1494 action(subscription); 1454 action(subscription);
1495 subscription[_toggleEventId](); 1455 subscription[_toggleEventId]();
1496 link = subscription[_next]; 1456 link = subscription[_next];
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 _BroadcastStreamController._STATE_FIRING = 2; 1506 _BroadcastStreamController._STATE_FIRING = 2;
1547 _BroadcastStreamController._STATE_CLOSED = 4; 1507 _BroadcastStreamController._STATE_CLOSED = 4;
1548 _BroadcastStreamController._STATE_ADDSTREAM = 8; 1508 _BroadcastStreamController._STATE_ADDSTREAM = 8;
1549 const _SyncBroadcastStreamController$ = dart.generic(function(T) { 1509 const _SyncBroadcastStreamController$ = dart.generic(function(T) {
1550 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) { 1510 class _SyncBroadcastStreamController extends _BroadcastStreamController$(T) {
1551 _SyncBroadcastStreamController(onListen, onCancel) { 1511 _SyncBroadcastStreamController(onListen, onCancel) {
1552 super._BroadcastStreamController(onListen, onCancel); 1512 super._BroadcastStreamController(onListen, onCancel);
1553 } 1513 }
1554 [_sendData](data) { 1514 [_sendData](data) {
1555 dart.as(data, T); 1515 dart.as(data, T);
1556 if (dart.notNull(this[_isEmpty])) 1516 if (dart.notNull(this[_isEmpty])) return;
1557 return;
1558 if (dart.notNull(this[_hasOneListener])) { 1517 if (dart.notNull(this[_hasOneListener])) {
1559 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController._STATE_FIRING); 1518 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController._STATE_FIRING);
1560 let subscription = dart.as(this[_next], _BroadcastSubscription); 1519 let subscription = dart.as(this[_next], _BroadcastSubscription);
1561 subscription[_add](data); 1520 subscription[_add](data);
1562 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastSt reamController._STATE_FIRING); 1521 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BroadcastSt reamController._STATE_FIRING);
1563 if (dart.notNull(this[_isEmpty])) { 1522 if (dart.notNull(this[_isEmpty])) {
1564 this[_callOnCancel](); 1523 this[_callOnCancel]();
1565 } 1524 }
1566 return; 1525 return;
1567 } 1526 }
1568 this[_forEachListener](dart.fn(subscription => { 1527 this[_forEachListener](dart.fn(subscription => {
1569 dart.as(subscription, _BufferingStreamSubscription$(T)); 1528 dart.as(subscription, _BufferingStreamSubscription$(T));
1570 subscription[_add](data); 1529 subscription[_add](data);
1571 }, dart.dynamic, [_BufferingStreamSubscription$(T)])); 1530 }, dart.dynamic, [_BufferingStreamSubscription$(T)]));
1572 } 1531 }
1573 [_sendError](error, stackTrace) { 1532 [_sendError](error, stackTrace) {
1574 if (dart.notNull(this[_isEmpty])) 1533 if (dart.notNull(this[_isEmpty])) return;
1575 return;
1576 this[_forEachListener](dart.fn(subscription => { 1534 this[_forEachListener](dart.fn(subscription => {
1577 dart.as(subscription, _BufferingStreamSubscription$(T)); 1535 dart.as(subscription, _BufferingStreamSubscription$(T));
1578 subscription[_addError](error, stackTrace); 1536 subscription[_addError](error, stackTrace);
1579 }, dart.dynamic, [_BufferingStreamSubscription$(T)])); 1537 }, dart.dynamic, [_BufferingStreamSubscription$(T)]));
1580 } 1538 }
1581 [_sendDone]() { 1539 [_sendDone]() {
1582 if (!dart.notNull(this[_isEmpty])) { 1540 if (!dart.notNull(this[_isEmpty])) {
1583 this[_forEachListener](dart.as(dart.fn(subscription => { 1541 this[_forEachListener](dart.as(dart.fn(subscription => {
1584 dart.as(subscription, _BroadcastSubscription$(T)); 1542 dart.as(subscription, _BroadcastSubscription$(T));
1585 subscription[_close](); 1543 subscription[_close]();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { 1623 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) {
1666 this[_addPendingEvent](new (_DelayedData$(T))(data)); 1624 this[_addPendingEvent](new (_DelayedData$(T))(data));
1667 return; 1625 return;
1668 } 1626 }
1669 super.add(data); 1627 super.add(data);
1670 while (dart.notNull(this[_hasPending])) { 1628 while (dart.notNull(this[_hasPending])) {
1671 this[_pending].handleNext(this); 1629 this[_pending].handleNext(this);
1672 } 1630 }
1673 } 1631 }
1674 addError(error, stackTrace) { 1632 addError(error, stackTrace) {
1675 if (stackTrace === void 0) 1633 if (stackTrace === void 0) stackTrace = null;
1676 stackTrace = null;
1677 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { 1634 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) {
1678 this[_addPendingEvent](new _DelayedError(error, stackTrace)); 1635 this[_addPendingEvent](new _DelayedError(error, stackTrace));
1679 return; 1636 return;
1680 } 1637 }
1681 if (!dart.notNull(this[_mayAddEvent])) 1638 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_addEventError]() );
1682 dart.throw(this[_addEventError]());
1683 this[_sendError](error, stackTrace); 1639 this[_sendError](error, stackTrace);
1684 while (dart.notNull(this[_hasPending])) { 1640 while (dart.notNull(this[_hasPending])) {
1685 this[_pending].handleNext(this); 1641 this[_pending].handleNext(this);
1686 } 1642 }
1687 } 1643 }
1688 close() { 1644 close() {
1689 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { 1645 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) {
1690 this[_addPendingEvent](dart.const(new _DelayedDone())); 1646 this[_addPendingEvent](dart.const(new _DelayedDone()));
1691 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController._STATE_CLOSED); 1647 this[_state] = dart.notNull(this[_state]) | dart.notNull(_BroadcastStr eamController._STATE_CLOSED);
1692 return super.done; 1648 return super.done;
(...skipping 29 matching lines...) Expand all
1722 this[_pauseCount] = 0; 1678 this[_pauseCount] = 0;
1723 } 1679 }
1724 onData(handleData) { 1680 onData(handleData) {
1725 dart.as(handleData, dart.functionType(dart.void, [T])); 1681 dart.as(handleData, dart.functionType(dart.void, [T]));
1726 } 1682 }
1727 onError(handleError) {} 1683 onError(handleError) {}
1728 onDone(handleDone) { 1684 onDone(handleDone) {
1729 dart.as(handleDone, dart.functionType(dart.void, [])); 1685 dart.as(handleDone, dart.functionType(dart.void, []));
1730 } 1686 }
1731 pause(resumeSignal) { 1687 pause(resumeSignal) {
1732 if (resumeSignal === void 0) 1688 if (resumeSignal === void 0) resumeSignal = null;
1733 resumeSignal = null; 1689 if (resumeSignal != null) resumeSignal.then(dart.bind(this, _resume));
1734 if (resumeSignal != null)
1735 resumeSignal.then(dart.bind(this, _resume));
1736 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1; 1690 this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
1737 } 1691 }
1738 resume() { 1692 resume() {
1739 this[_resume](null); 1693 this[_resume](null);
1740 } 1694 }
1741 [_resume](_) { 1695 [_resume](_) {
1742 if (dart.notNull(this[_pauseCount]) > 0) { 1696 if (dart.notNull(this[_pauseCount]) > 0) {
1743 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1; 1697 this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1;
1744 } 1698 }
1745 } 1699 }
1746 cancel() { 1700 cancel() {
1747 return new _Future.immediate(null); 1701 return new _Future.immediate(null);
1748 } 1702 }
1749 get isPaused() { 1703 get isPaused() {
1750 return dart.notNull(this[_pauseCount]) > 0; 1704 return dart.notNull(this[_pauseCount]) > 0;
1751 } 1705 }
1752 asFuture(value) { 1706 asFuture(value) {
1753 if (value === void 0) 1707 if (value === void 0) value = null;
1754 value = null;
1755 return new _Future(); 1708 return new _Future();
1756 } 1709 }
1757 } 1710 }
1758 _DoneSubscription[dart.implements] = () => [StreamSubscription$(T)]; 1711 _DoneSubscription[dart.implements] = () => [StreamSubscription$(T)];
1759 dart.setSignature(_DoneSubscription, { 1712 dart.setSignature(_DoneSubscription, {
1760 methods: () => ({ 1713 methods: () => ({
1761 onData: [dart.void, [dart.functionType(dart.void, [T])]], 1714 onData: [dart.void, [dart.functionType(dart.void, [T])]],
1762 onError: [dart.void, [core.Function]], 1715 onError: [dart.void, [core.Function]],
1763 onDone: [dart.void, [dart.functionType(dart.void, [])]], 1716 onDone: [dart.void, [dart.functionType(dart.void, [])]],
1764 pause: [dart.void, [], [Future]], 1717 pause: [dart.void, [], [Future]],
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 try { 1790 try {
1838 let result = computation(); 1791 let result = computation();
1839 return Future$(T).value(result); 1792 return Future$(T).value(result);
1840 } catch (error) { 1793 } catch (error) {
1841 let stackTrace = dart.stackTrace(error); 1794 let stackTrace = dart.stackTrace(error);
1842 return Future$(T).error(error, stackTrace); 1795 return Future$(T).error(error, stackTrace);
1843 } 1796 }
1844 1797
1845 } 1798 }
1846 static value(value) { 1799 static value(value) {
1847 if (value === void 0) 1800 if (value === void 0) value = null;
1848 value = null;
1849 return new (_Future$(T)).immediate(value); 1801 return new (_Future$(T)).immediate(value);
1850 } 1802 }
1851 static error(error, stackTrace) { 1803 static error(error, stackTrace) {
1852 if (stackTrace === void 0) 1804 if (stackTrace === void 0) stackTrace = null;
1853 stackTrace = null;
1854 error = _nonNullError(error); 1805 error = _nonNullError(error);
1855 if (!dart.notNull(core.identical(Zone.current, _ROOT_ZONE))) { 1806 if (!dart.notNull(core.identical(Zone.current, _ROOT_ZONE))) {
1856 let replacement = Zone.current.errorCallback(error, stackTrace); 1807 let replacement = Zone.current.errorCallback(error, stackTrace);
1857 if (replacement != null) { 1808 if (replacement != null) {
1858 error = _nonNullError(replacement.error); 1809 error = _nonNullError(replacement.error);
1859 stackTrace = replacement.stackTrace; 1810 stackTrace = replacement.stackTrace;
1860 } 1811 }
1861 } 1812 }
1862 return new (_Future$(T)).immediateError(error, stackTrace); 1813 return new (_Future$(T)).immediateError(error, stackTrace);
1863 } 1814 }
1864 static delayed(duration, computation) { 1815 static delayed(duration, computation) {
1865 if (computation === void 0) 1816 if (computation === void 0) computation = null;
1866 computation = null;
1867 let result = new (_Future$(T))(); 1817 let result = new (_Future$(T))();
1868 Timer.new(duration, dart.fn(() => { 1818 Timer.new(duration, dart.fn(() => {
1869 try { 1819 try {
1870 result[_complete](computation == null ? null : computation()); 1820 result[_complete](computation == null ? null : computation());
1871 } catch (e) { 1821 } catch (e) {
1872 let s = dart.stackTrace(e); 1822 let s = dart.stackTrace(e);
1873 _completeWithErrorCallback(result, e, s); 1823 _completeWithErrorCallback(result, e, s);
1874 } 1824 }
1875 1825
1876 })); 1826 }));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 if (remaining == 0) { 1884 if (remaining == 0) {
1935 return Future$(core.List).value(dart.const([])); 1885 return Future$(core.List).value(dart.const([]));
1936 } 1886 }
1937 values = core.List.new(remaining); 1887 values = core.List.new(remaining);
1938 return result; 1888 return result;
1939 } 1889 }
1940 static forEach(input, f) { 1890 static forEach(input, f) {
1941 dart.as(f, dart.functionType(dart.dynamic, [dart.dynamic])); 1891 dart.as(f, dart.functionType(dart.dynamic, [dart.dynamic]));
1942 let iterator = input[dartx.iterator]; 1892 let iterator = input[dartx.iterator];
1943 return Future$().doWhile(dart.fn(() => { 1893 return Future$().doWhile(dart.fn(() => {
1944 if (!dart.notNull(iterator.moveNext())) 1894 if (!dart.notNull(iterator.moveNext())) return false;
1945 return false;
1946 return Future$().sync(dart.fn(() => dart.dcall(f, iterator.current))). then(dart.fn(_ => true, core.bool, [dart.dynamic])); 1895 return Future$().sync(dart.fn(() => dart.dcall(f, iterator.current))). then(dart.fn(_ => true, core.bool, [dart.dynamic]));
1947 })); 1896 }));
1948 } 1897 }
1949 static doWhile(f) { 1898 static doWhile(f) {
1950 dart.as(f, dart.functionType(dart.dynamic, [])); 1899 dart.as(f, dart.functionType(dart.dynamic, []));
1951 let doneSignal = new _Future(); 1900 let doneSignal = new _Future();
1952 let nextIteration = null; 1901 let nextIteration = null;
1953 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => { 1902 nextIteration = Zone.current.bindUnaryCallback(dart.fn(keepGoing => {
1954 if (dart.notNull(keepGoing)) { 1903 if (dart.notNull(keepGoing)) {
1955 Future$().sync(f).then(dart.as(nextIteration, __CastType4), {onError : dart.bind(doneSignal, _completeError)}); 1904 Future$().sync(f).then(dart.as(nextIteration, __CastType4), {onError : dart.bind(doneSignal, _completeError)});
(...skipping 24 matching lines...) Expand all
1980 return Future; 1929 return Future;
1981 }); 1930 });
1982 let Future = Future$(); 1931 let Future = Future$();
1983 dart.defineLazyProperties(Future, { 1932 dart.defineLazyProperties(Future, {
1984 get _nullFuture() { 1933 get _nullFuture() {
1985 return new _Future.immediate(null); 1934 return new _Future.immediate(null);
1986 } 1935 }
1987 }); 1936 });
1988 class TimeoutException extends core.Object { 1937 class TimeoutException extends core.Object {
1989 TimeoutException(message, duration) { 1938 TimeoutException(message, duration) {
1990 if (duration === void 0) 1939 if (duration === void 0) duration = null;
1991 duration = null;
1992 this.message = message; 1940 this.message = message;
1993 this.duration = duration; 1941 this.duration = duration;
1994 } 1942 }
1995 toString() { 1943 toString() {
1996 let result = "TimeoutException"; 1944 let result = "TimeoutException";
1997 if (this.duration != null) 1945 if (this.duration != null) result = `TimeoutException after ${this.duratio n}`;
1998 result = `TimeoutException after ${this.duration}`; 1946 if (this.message != null) result = `${result}: ${this.message}`;
1999 if (this.message != null)
2000 result = `${result}: ${this.message}`;
2001 return result; 1947 return result;
2002 } 1948 }
2003 } 1949 }
2004 TimeoutException[dart.implements] = () => [core.Exception]; 1950 TimeoutException[dart.implements] = () => [core.Exception];
2005 dart.setSignature(TimeoutException, { 1951 dart.setSignature(TimeoutException, {
2006 constructors: () => ({TimeoutException: [TimeoutException, [core.String], [c ore.Duration]]}) 1952 constructors: () => ({TimeoutException: [TimeoutException, [core.String], [c ore.Duration]]})
2007 }); 1953 });
2008 const Completer$ = dart.generic(function(T) { 1954 const Completer$ = dart.generic(function(T) {
2009 class Completer extends core.Object { 1955 class Completer extends core.Object {
2010 static new() { 1956 static new() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 }); 1989 });
2044 let _FutureOnValue = _FutureOnValue$(); 1990 let _FutureOnValue = _FutureOnValue$();
2045 const _FutureErrorTest = dart.typedef('_FutureErrorTest', () => dart.functionT ype(core.bool, [dart.dynamic])); 1991 const _FutureErrorTest = dart.typedef('_FutureErrorTest', () => dart.functionT ype(core.bool, [dart.dynamic]));
2046 const _FutureAction = dart.typedef('_FutureAction', () => dart.functionType(da rt.dynamic, [])); 1992 const _FutureAction = dart.typedef('_FutureAction', () => dart.functionType(da rt.dynamic, []));
2047 const _Completer$ = dart.generic(function(T) { 1993 const _Completer$ = dart.generic(function(T) {
2048 class _Completer extends core.Object { 1994 class _Completer extends core.Object {
2049 _Completer() { 1995 _Completer() {
2050 this.future = new (_Future$(T))(); 1996 this.future = new (_Future$(T))();
2051 } 1997 }
2052 completeError(error, stackTrace) { 1998 completeError(error, stackTrace) {
2053 if (stackTrace === void 0) 1999 if (stackTrace === void 0) stackTrace = null;
2054 stackTrace = null;
2055 error = _nonNullError(error); 2000 error = _nonNullError(error);
2056 if (!dart.notNull(this.future[_mayComplete])) 2001 if (!dart.notNull(this.future[_mayComplete])) dart.throw(new core.StateE rror("Future already completed"));
2057 dart.throw(new core.StateError("Future already completed"));
2058 let replacement = Zone.current.errorCallback(error, stackTrace); 2002 let replacement = Zone.current.errorCallback(error, stackTrace);
2059 if (replacement != null) { 2003 if (replacement != null) {
2060 error = _nonNullError(replacement.error); 2004 error = _nonNullError(replacement.error);
2061 stackTrace = replacement.stackTrace; 2005 stackTrace = replacement.stackTrace;
2062 } 2006 }
2063 this[_completeError](error, stackTrace); 2007 this[_completeError](error, stackTrace);
2064 } 2008 }
2065 get isCompleted() { 2009 get isCompleted() {
2066 return !dart.notNull(this.future[_mayComplete]); 2010 return !dart.notNull(this.future[_mayComplete]);
2067 } 2011 }
2068 } 2012 }
2069 _Completer[dart.implements] = () => [Completer$(T)]; 2013 _Completer[dart.implements] = () => [Completer$(T)];
2070 dart.setSignature(_Completer, { 2014 dart.setSignature(_Completer, {
2071 methods: () => ({completeError: [dart.void, [core.Object], [core.StackTrac e]]}) 2015 methods: () => ({completeError: [dart.void, [core.Object], [core.StackTrac e]]})
2072 }); 2016 });
2073 return _Completer; 2017 return _Completer;
2074 }); 2018 });
2075 let _Completer = _Completer$(); 2019 let _Completer = _Completer$();
2076 const _asyncCompleteError = Symbol('_asyncCompleteError'); 2020 const _asyncCompleteError = Symbol('_asyncCompleteError');
2077 const _AsyncCompleter$ = dart.generic(function(T) { 2021 const _AsyncCompleter$ = dart.generic(function(T) {
2078 class _AsyncCompleter extends _Completer$(T) { 2022 class _AsyncCompleter extends _Completer$(T) {
2079 _AsyncCompleter() { 2023 _AsyncCompleter() {
2080 super._Completer(); 2024 super._Completer();
2081 } 2025 }
2082 complete(value) { 2026 complete(value) {
2083 if (value === void 0) 2027 if (value === void 0) value = null;
2084 value = null; 2028 if (!dart.notNull(this.future[_mayComplete])) dart.throw(new core.StateE rror("Future already completed"));
2085 if (!dart.notNull(this.future[_mayComplete]))
2086 dart.throw(new core.StateError("Future already completed"));
2087 this.future[_asyncComplete](value); 2029 this.future[_asyncComplete](value);
2088 } 2030 }
2089 [_completeError](error, stackTrace) { 2031 [_completeError](error, stackTrace) {
2090 this.future[_asyncCompleteError](error, stackTrace); 2032 this.future[_asyncCompleteError](error, stackTrace);
2091 } 2033 }
2092 } 2034 }
2093 dart.setSignature(_AsyncCompleter, { 2035 dart.setSignature(_AsyncCompleter, {
2094 methods: () => ({ 2036 methods: () => ({
2095 complete: [dart.void, [], [dart.dynamic]], 2037 complete: [dart.void, [], [dart.dynamic]],
2096 [_completeError]: [dart.void, [core.Object, core.StackTrace]] 2038 [_completeError]: [dart.void, [core.Object, core.StackTrace]]
2097 }) 2039 })
2098 }); 2040 });
2099 return _AsyncCompleter; 2041 return _AsyncCompleter;
2100 }); 2042 });
2101 let _AsyncCompleter = _AsyncCompleter$(); 2043 let _AsyncCompleter = _AsyncCompleter$();
2102 const _SyncCompleter$ = dart.generic(function(T) { 2044 const _SyncCompleter$ = dart.generic(function(T) {
2103 class _SyncCompleter extends _Completer$(T) { 2045 class _SyncCompleter extends _Completer$(T) {
2104 _SyncCompleter() { 2046 _SyncCompleter() {
2105 super._Completer(); 2047 super._Completer();
2106 } 2048 }
2107 complete(value) { 2049 complete(value) {
2108 if (value === void 0) 2050 if (value === void 0) value = null;
2109 value = null; 2051 if (!dart.notNull(this.future[_mayComplete])) dart.throw(new core.StateE rror("Future already completed"));
2110 if (!dart.notNull(this.future[_mayComplete]))
2111 dart.throw(new core.StateError("Future already completed"));
2112 this.future[_complete](value); 2052 this.future[_complete](value);
2113 } 2053 }
2114 [_completeError](error, stackTrace) { 2054 [_completeError](error, stackTrace) {
2115 this.future[_completeError](error, stackTrace); 2055 this.future[_completeError](error, stackTrace);
2116 } 2056 }
2117 } 2057 }
2118 dart.setSignature(_SyncCompleter, { 2058 dart.setSignature(_SyncCompleter, {
2119 methods: () => ({ 2059 methods: () => ({
2120 complete: [dart.void, [], [dart.dynamic]], 2060 complete: [dart.void, [], [dart.dynamic]],
2121 [_completeError]: [dart.void, [core.Object, core.StackTrace]] 2061 [_completeError]: [dart.void, [core.Object, core.StackTrace]]
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 this[_state] = _Future$()._INCOMPLETE; 2169 this[_state] = _Future$()._INCOMPLETE;
2230 this[_resultOrListeners] = null; 2170 this[_resultOrListeners] = null;
2231 } 2171 }
2232 immediate(value) { 2172 immediate(value) {
2233 this[_zone] = Zone.current; 2173 this[_zone] = Zone.current;
2234 this[_state] = _Future$()._INCOMPLETE; 2174 this[_state] = _Future$()._INCOMPLETE;
2235 this[_resultOrListeners] = null; 2175 this[_resultOrListeners] = null;
2236 this[_asyncComplete](value); 2176 this[_asyncComplete](value);
2237 } 2177 }
2238 immediateError(error, stackTrace) { 2178 immediateError(error, stackTrace) {
2239 if (stackTrace === void 0) 2179 if (stackTrace === void 0) stackTrace = null;
2240 stackTrace = null;
2241 this[_zone] = Zone.current; 2180 this[_zone] = Zone.current;
2242 this[_state] = _Future$()._INCOMPLETE; 2181 this[_state] = _Future$()._INCOMPLETE;
2243 this[_resultOrListeners] = null; 2182 this[_resultOrListeners] = null;
2244 this[_asyncCompleteError](error, stackTrace); 2183 this[_asyncCompleteError](error, stackTrace);
2245 } 2184 }
2246 get [_mayComplete]() { 2185 get [_mayComplete]() {
2247 return this[_state] == _Future$()._INCOMPLETE; 2186 return this[_state] == _Future$()._INCOMPLETE;
2248 } 2187 }
2249 get [_isChained]() { 2188 get [_isChained]() {
2250 return this[_state] == _Future$()._CHAINED; 2189 return this[_state] == _Future$()._CHAINED;
(...skipping 28 matching lines...) Expand all
2279 } 2218 }
2280 this[_addListener](new _FutureListener.then(result, f, onError)); 2219 this[_addListener](new _FutureListener.then(result, f, onError));
2281 return result; 2220 return result;
2282 } 2221 }
2283 catchError(onError, opts) { 2222 catchError(onError, opts) {
2284 let test = opts && 'test' in opts ? opts.test : null; 2223 let test = opts && 'test' in opts ? opts.test : null;
2285 dart.as(test, dart.functionType(core.bool, [dart.dynamic])); 2224 dart.as(test, dart.functionType(core.bool, [dart.dynamic]));
2286 let result = new (_Future$())(); 2225 let result = new (_Future$())();
2287 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { 2226 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
2288 onError = _registerErrorHandler(onError, result[_zone]); 2227 onError = _registerErrorHandler(onError, result[_zone]);
2289 if (test != null) 2228 if (test != null) test = dart.as(result[_zone].registerUnaryCallback(t est), __CastType8);
2290 test = dart.as(result[_zone].registerUnaryCallback(test), __CastType 8);
2291 } 2229 }
2292 this[_addListener](new _FutureListener.catchError(result, onError, test) ); 2230 this[_addListener](new _FutureListener.catchError(result, onError, test) );
2293 return result; 2231 return result;
2294 } 2232 }
2295 whenComplete(action) { 2233 whenComplete(action) {
2296 dart.as(action, dart.functionType(dart.dynamic, [])); 2234 dart.as(action, dart.functionType(dart.dynamic, []));
2297 let result = new (_Future$(T))(); 2235 let result = new (_Future$(T))();
2298 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { 2236 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) {
2299 action = result[_zone].registerCallback(action); 2237 action = result[_zone].registerCallback(action);
2300 } 2238 }
2301 this[_addListener](new _FutureListener.whenComplete(result, action)); 2239 this[_addListener](new _FutureListener.whenComplete(result, action));
2302 return dart.as(result, Future$(T)); 2240 return dart.as(result, Future$(T));
2303 } 2241 }
2304 asStream() { 2242 asStream() {
2305 return Stream$(T).fromFuture(this); 2243 return Stream$(T).fromFuture(this);
2306 } 2244 }
2307 [_markPendingCompletion]() { 2245 [_markPendingCompletion]() {
2308 if (!dart.notNull(this[_mayComplete])) 2246 if (!dart.notNull(this[_mayComplete])) dart.throw(new core.StateError("F uture already completed"));
2309 dart.throw(new core.StateError("Future already completed"));
2310 this[_state] = _Future$()._PENDING_COMPLETE; 2247 this[_state] = _Future$()._PENDING_COMPLETE;
2311 } 2248 }
2312 get [_value]() { 2249 get [_value]() {
2313 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasVal ue])); 2250 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasVal ue]));
2314 return dart.as(this[_resultOrListeners], T); 2251 return dart.as(this[_resultOrListeners], T);
2315 } 2252 }
2316 get [_error]() { 2253 get [_error]() {
2317 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasErr or])); 2254 dart.assert(dart.notNull(this[_isComplete]) && dart.notNull(this[_hasErr or]));
2318 return dart.as(this[_resultOrListeners], AsyncError); 2255 return dart.as(this[_resultOrListeners], AsyncError);
2319 } 2256 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 return prev; 2293 return prev;
2357 } 2294 }
2358 static _chainForeignFuture(source, target) { 2295 static _chainForeignFuture(source, target) {
2359 dart.assert(!dart.notNull(target[_isComplete])); 2296 dart.assert(!dart.notNull(target[_isComplete]));
2360 dart.assert(!dart.is(source, _Future$())); 2297 dart.assert(!dart.is(source, _Future$()));
2361 target[_isChained] = true; 2298 target[_isChained] = true;
2362 source.then(dart.fn(value => { 2299 source.then(dart.fn(value => {
2363 dart.assert(target[_isChained]); 2300 dart.assert(target[_isChained]);
2364 target[_completeWithValue](value); 2301 target[_completeWithValue](value);
2365 }), {onError: dart.fn((error, stackTrace) => { 2302 }), {onError: dart.fn((error, stackTrace) => {
2366 if (stackTrace === void 0) 2303 if (stackTrace === void 0) stackTrace = null;
2367 stackTrace = null;
2368 dart.assert(target[_isChained]); 2304 dart.assert(target[_isChained]);
2369 target[_completeError](error, dart.as(stackTrace, core.StackTrace)); 2305 target[_completeError](error, dart.as(stackTrace, core.StackTrace));
2370 }, dart.dynamic, [dart.dynamic], [dart.dynamic])}); 2306 }, dart.dynamic, [dart.dynamic], [dart.dynamic])});
2371 } 2307 }
2372 static _chainCoreFuture(source, target) { 2308 static _chainCoreFuture(source, target) {
2373 dart.assert(!dart.notNull(target[_isComplete])); 2309 dart.assert(!dart.notNull(target[_isComplete]));
2374 dart.assert(dart.is(source, _Future$())); 2310 dart.assert(dart.is(source, _Future$()));
2375 target[_isChained] = true; 2311 target[_isChained] = true;
2376 let listener = new _FutureListener.chain(target); 2312 let listener = new _FutureListener.chain(target);
2377 if (dart.notNull(source[_isComplete])) { 2313 if (dart.notNull(source[_isComplete])) {
(...skipping 17 matching lines...) Expand all
2395 } 2331 }
2396 } 2332 }
2397 [_completeWithValue](value) { 2333 [_completeWithValue](value) {
2398 dart.assert(!dart.notNull(this[_isComplete])); 2334 dart.assert(!dart.notNull(this[_isComplete]));
2399 dart.assert(!dart.is(value, Future)); 2335 dart.assert(!dart.is(value, Future));
2400 let listeners = this[_removeListeners](); 2336 let listeners = this[_removeListeners]();
2401 this[_setValue](dart.as(value, T)); 2337 this[_setValue](dart.as(value, T));
2402 _Future$()._propagateToListeners(this, listeners); 2338 _Future$()._propagateToListeners(this, listeners);
2403 } 2339 }
2404 [_completeError](error, stackTrace) { 2340 [_completeError](error, stackTrace) {
2405 if (stackTrace === void 0) 2341 if (stackTrace === void 0) stackTrace = null;
2406 stackTrace = null;
2407 dart.assert(!dart.notNull(this[_isComplete])); 2342 dart.assert(!dart.notNull(this[_isComplete]));
2408 let listeners = this[_removeListeners](); 2343 let listeners = this[_removeListeners]();
2409 this[_setError](error, stackTrace); 2344 this[_setError](error, stackTrace);
2410 _Future$()._propagateToListeners(this, listeners); 2345 _Future$()._propagateToListeners(this, listeners);
2411 } 2346 }
2412 [_asyncComplete](value) { 2347 [_asyncComplete](value) {
2413 dart.assert(!dart.notNull(this[_isComplete])); 2348 dart.assert(!dart.notNull(this[_isComplete]));
2414 if (value == null) { 2349 if (value == null) {
2415 } else if (dart.is(value, Future)) { 2350 } else if (dart.is(value, Future)) {
2416 let typedFuture = dart.as(value, Future$(T)); 2351 let typedFuture = dart.as(value, Future$(T));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 return; 2475 return;
2541 } 2476 }
2542 2477
2543 if (dart.is(completeResult, Future)) { 2478 if (dart.is(completeResult, Future)) {
2544 let result = listener.result; 2479 let result = listener.result;
2545 result[_isChained] = true; 2480 result[_isChained] = true;
2546 isPropagationAborted = true; 2481 isPropagationAborted = true;
2547 dart.dsend(completeResult, 'then', dart.fn(ignored => { 2482 dart.dsend(completeResult, 'then', dart.fn(ignored => {
2548 _Future$()._propagateToListeners(source, new _FutureListener.c hain(result)); 2483 _Future$()._propagateToListeners(source, new _FutureListener.c hain(result));
2549 }), {onError: dart.fn((error, stackTrace) => { 2484 }), {onError: dart.fn((error, stackTrace) => {
2550 if (stackTrace === void 0) 2485 if (stackTrace === void 0) stackTrace = null;
2551 stackTrace = null;
2552 if (!dart.is(completeResult, _Future$())) { 2486 if (!dart.is(completeResult, _Future$())) {
2553 completeResult = new (_Future$())(); 2487 completeResult = new (_Future$())();
2554 dart.dsend(completeResult, _setError, error, stackTrace); 2488 dart.dsend(completeResult, _setError, error, stackTrace);
2555 } 2489 }
2556 _Future$()._propagateToListeners(dart.as(completeResult, _Fu ture$()), new _FutureListener.chain(result)); 2490 _Future$()._propagateToListeners(dart.as(completeResult, _Fu ture$()), new _FutureListener.chain(result));
2557 }, dart.dynamic, [dart.dynamic], [dart.dynamic])}); 2491 }, dart.dynamic, [dart.dynamic], [dart.dynamic])});
2558 } 2492 }
2559 } 2493 }
2560 dart.fn(handleWhenCompleteCallback, dart.void, []); 2494 dart.fn(handleWhenCompleteCallback, dart.void, []);
2561 if (!dart.notNull(hasError)) { 2495 if (!dart.notNull(hasError)) {
2562 if (dart.notNull(listener.handlesValue)) { 2496 if (dart.notNull(listener.handlesValue)) {
2563 listenerHasValue = handleValueCallback(); 2497 listenerHasValue = handleValueCallback();
2564 } 2498 }
2565 } else { 2499 } else {
2566 handleError(); 2500 handleError();
2567 } 2501 }
2568 if (dart.notNull(listener.handlesComplete)) { 2502 if (dart.notNull(listener.handlesComplete)) {
2569 handleWhenCompleteCallback(); 2503 handleWhenCompleteCallback();
2570 } 2504 }
2571 if (oldZone != null) 2505 if (oldZone != null) Zone._leave(oldZone);
2572 Zone._leave(oldZone); 2506 if (dart.notNull(isPropagationAborted)) return;
2573 if (dart.notNull(isPropagationAborted))
2574 return;
2575 if (dart.notNull(listenerHasValue) && !dart.notNull(core.identical(s ourceValue, listenerValueOrError)) && dart.is(listenerValueOrError, Future)) { 2507 if (dart.notNull(listenerHasValue) && !dart.notNull(core.identical(s ourceValue, listenerValueOrError)) && dart.is(listenerValueOrError, Future)) {
2576 let chainSource = dart.as(listenerValueOrError, Future); 2508 let chainSource = dart.as(listenerValueOrError, Future);
2577 let result = listener.result; 2509 let result = listener.result;
2578 if (dart.is(chainSource, _Future$())) { 2510 if (dart.is(chainSource, _Future$())) {
2579 if (dart.notNull(chainSource[_isComplete])) { 2511 if (dart.notNull(chainSource[_isComplete])) {
2580 result[_isChained] = true; 2512 result[_isChained] = true;
2581 source = chainSource; 2513 source = chainSource;
2582 listeners = new _FutureListener.chain(result); 2514 listeners = new _FutureListener.chain(result);
2583 continue; 2515 continue;
2584 } else { 2516 } else {
(...skipping 12 matching lines...) Expand all
2597 } else { 2529 } else {
2598 let asyncError = dart.as(listenerValueOrError, AsyncError); 2530 let asyncError = dart.as(listenerValueOrError, AsyncError);
2599 result[_setErrorObject](asyncError); 2531 result[_setErrorObject](asyncError);
2600 } 2532 }
2601 source = result; 2533 source = result;
2602 } 2534 }
2603 } 2535 }
2604 timeout(timeLimit, opts) { 2536 timeout(timeLimit, opts) {
2605 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null; 2537 let onTimeout = opts && 'onTimeout' in opts ? opts.onTimeout : null;
2606 dart.as(onTimeout, dart.functionType(dart.dynamic, [])); 2538 dart.as(onTimeout, dart.functionType(dart.dynamic, []));
2607 if (dart.notNull(this[_isComplete])) 2539 if (dart.notNull(this[_isComplete])) return new (_Future$()).immediate(t his);
2608 return new (_Future$()).immediate(this);
2609 let result = new (_Future$())(); 2540 let result = new (_Future$())();
2610 let timer = null; 2541 let timer = null;
2611 if (onTimeout == null) { 2542 if (onTimeout == null) {
2612 timer = Timer.new(timeLimit, dart.fn(() => { 2543 timer = Timer.new(timeLimit, dart.fn(() => {
2613 result[_completeError](new TimeoutException("Future not completed", timeLimit)); 2544 result[_completeError](new TimeoutException("Future not completed", timeLimit));
2614 })); 2545 }));
2615 } else { 2546 } else {
2616 let zone = Zone.current; 2547 let zone = Zone.current;
2617 onTimeout = zone.registerCallback(onTimeout); 2548 onTimeout = zone.registerCallback(onTimeout);
2618 timer = Timer.new(timeLimit, dart.fn(() => { 2549 timer = Timer.new(timeLimit, dart.fn(() => {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 }); 2632 });
2702 exports._nextCallback = null; 2633 exports._nextCallback = null;
2703 exports._lastCallback = null; 2634 exports._lastCallback = null;
2704 exports._lastPriorityCallback = null; 2635 exports._lastPriorityCallback = null;
2705 exports._isInCallbackLoop = false; 2636 exports._isInCallbackLoop = false;
2706 function _asyncRunCallbackLoop() { 2637 function _asyncRunCallbackLoop() {
2707 while (exports._nextCallback != null) { 2638 while (exports._nextCallback != null) {
2708 exports._lastPriorityCallback = null; 2639 exports._lastPriorityCallback = null;
2709 let entry = exports._nextCallback; 2640 let entry = exports._nextCallback;
2710 exports._nextCallback = entry.next; 2641 exports._nextCallback = entry.next;
2711 if (exports._nextCallback == null) 2642 if (exports._nextCallback == null) exports._lastCallback = null;
2712 exports._lastCallback = null;
2713 entry.callback(); 2643 entry.callback();
2714 } 2644 }
2715 } 2645 }
2716 dart.fn(_asyncRunCallbackLoop, dart.void, []); 2646 dart.fn(_asyncRunCallbackLoop, dart.void, []);
2717 function _asyncRunCallback() { 2647 function _asyncRunCallback() {
2718 exports._isInCallbackLoop = true; 2648 exports._isInCallbackLoop = true;
2719 try { 2649 try {
2720 _asyncRunCallbackLoop(); 2650 _asyncRunCallbackLoop();
2721 } finally { 2651 } finally {
2722 exports._lastPriorityCallback = null; 2652 exports._lastPriorityCallback = null;
2723 exports._isInCallbackLoop = false; 2653 exports._isInCallbackLoop = false;
2724 if (exports._nextCallback != null) 2654 if (exports._nextCallback != null) _AsyncRun._scheduleImmediate(_asyncRunC allback);
2725 _AsyncRun._scheduleImmediate(_asyncRunCallback);
2726 } 2655 }
2727 } 2656 }
2728 dart.fn(_asyncRunCallback, dart.void, []); 2657 dart.fn(_asyncRunCallback, dart.void, []);
2729 function _scheduleAsyncCallback(callback) { 2658 function _scheduleAsyncCallback(callback) {
2730 if (exports._nextCallback == null) { 2659 if (exports._nextCallback == null) {
2731 exports._nextCallback = exports._lastCallback = new _AsyncCallbackEntry(da rt.as(callback, _AsyncCallback)); 2660 exports._nextCallback = exports._lastCallback = new _AsyncCallbackEntry(da rt.as(callback, _AsyncCallback));
2732 if (!dart.notNull(exports._isInCallbackLoop)) { 2661 if (!dart.notNull(exports._isInCallbackLoop)) {
2733 _AsyncRun._scheduleImmediate(_asyncRunCallback); 2662 _AsyncRun._scheduleImmediate(_asyncRunCallback);
2734 } 2663 }
2735 } else { 2664 } else {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 const _ControllerEventSinkWrapper$ = dart.generic(function(T) { 2857 const _ControllerEventSinkWrapper$ = dart.generic(function(T) {
2929 class _ControllerEventSinkWrapper extends core.Object { 2858 class _ControllerEventSinkWrapper extends core.Object {
2930 _ControllerEventSinkWrapper(sink) { 2859 _ControllerEventSinkWrapper(sink) {
2931 this[_sink] = sink; 2860 this[_sink] = sink;
2932 } 2861 }
2933 add(data) { 2862 add(data) {
2934 dart.as(data, T); 2863 dart.as(data, T);
2935 this[_sink].add(data); 2864 this[_sink].add(data);
2936 } 2865 }
2937 addError(error, stackTrace) { 2866 addError(error, stackTrace) {
2938 if (stackTrace === void 0) 2867 if (stackTrace === void 0) stackTrace = null;
2939 stackTrace = null;
2940 this[_sink].addError(error, stackTrace); 2868 this[_sink].addError(error, stackTrace);
2941 } 2869 }
2942 close() { 2870 close() {
2943 this[_sink].close(); 2871 this[_sink].close();
2944 } 2872 }
2945 } 2873 }
2946 _ControllerEventSinkWrapper[dart.implements] = () => [EventSink$(T)]; 2874 _ControllerEventSinkWrapper[dart.implements] = () => [EventSink$(T)];
2947 dart.setSignature(_ControllerEventSinkWrapper, { 2875 dart.setSignature(_ControllerEventSinkWrapper, {
2948 constructors: () => ({_ControllerEventSinkWrapper: [_ControllerEventSinkWr apper$(T), [EventSink]]}), 2876 constructors: () => ({_ControllerEventSinkWrapper: [_ControllerEventSinkWr apper$(T), [EventSink]]}),
2949 methods: () => ({ 2877 methods: () => ({
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 dart.assert(this[_isInitialState]); 2984 dart.assert(this[_isInitialState]);
3057 if (!dart.notNull(this[_isAddingStream])) { 2985 if (!dart.notNull(this[_isAddingStream])) {
3058 return dart.as(this[_varData], _PendingEvents); 2986 return dart.as(this[_varData], _PendingEvents);
3059 } 2987 }
3060 let state = dart.as(this[_varData], _StreamControllerAddStreamState); 2988 let state = dart.as(this[_varData], _StreamControllerAddStreamState);
3061 return dart.as(state.varData, _PendingEvents); 2989 return dart.as(state.varData, _PendingEvents);
3062 } 2990 }
3063 [_ensurePendingEvents]() { 2991 [_ensurePendingEvents]() {
3064 dart.assert(this[_isInitialState]); 2992 dart.assert(this[_isInitialState]);
3065 if (!dart.notNull(this[_isAddingStream])) { 2993 if (!dart.notNull(this[_isAddingStream])) {
3066 if (this[_varData] == null) 2994 if (this[_varData] == null) this[_varData] = new _StreamImplEvents();
3067 this[_varData] = new _StreamImplEvents();
3068 return dart.as(this[_varData], _StreamImplEvents); 2995 return dart.as(this[_varData], _StreamImplEvents);
3069 } 2996 }
3070 let state = dart.as(this[_varData], _StreamControllerAddStreamState); 2997 let state = dart.as(this[_varData], _StreamControllerAddStreamState);
3071 if (state.varData == null) 2998 if (state.varData == null) state.varData = new _StreamImplEvents();
3072 state.varData = new _StreamImplEvents();
3073 return dart.as(state.varData, _StreamImplEvents); 2999 return dart.as(state.varData, _StreamImplEvents);
3074 } 3000 }
3075 get [_subscription]() { 3001 get [_subscription]() {
3076 dart.assert(this.hasListener); 3002 dart.assert(this.hasListener);
3077 if (dart.notNull(this[_isAddingStream])) { 3003 if (dart.notNull(this[_isAddingStream])) {
3078 let addState = dart.as(this[_varData], _StreamControllerAddStreamState ); 3004 let addState = dart.as(this[_varData], _StreamControllerAddStreamState );
3079 return dart.as(addState.varData, _ControllerSubscription); 3005 return dart.as(addState.varData, _ControllerSubscription);
3080 } 3006 }
3081 return dart.as(this[_varData], _ControllerSubscription); 3007 return dart.as(this[_varData], _ControllerSubscription);
3082 } 3008 }
3083 [_badEventState]() { 3009 [_badEventState]() {
3084 if (dart.notNull(this.isClosed)) { 3010 if (dart.notNull(this.isClosed)) {
3085 return new core.StateError("Cannot add event after closing"); 3011 return new core.StateError("Cannot add event after closing");
3086 } 3012 }
3087 dart.assert(this[_isAddingStream]); 3013 dart.assert(this[_isAddingStream]);
3088 return new core.StateError("Cannot add event while adding a stream"); 3014 return new core.StateError("Cannot add event while adding a stream");
3089 } 3015 }
3090 addStream(source, opts) { 3016 addStream(source, opts) {
3091 dart.as(source, Stream$(T)); 3017 dart.as(source, Stream$(T));
3092 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 3018 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
3093 if (!dart.notNull(this[_mayAddEvent])) 3019 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_badEventState]() );
3094 dart.throw(this[_badEventState]()); 3020 if (dart.notNull(this[_isCanceled])) return new _Future.immediate(null);
3095 if (dart.notNull(this[_isCanceled]))
3096 return new _Future.immediate(null);
3097 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError); 3021 let addState = new _StreamControllerAddStreamState(this, this[_varData], source, cancelOnError);
3098 this[_varData] = addState; 3022 this[_varData] = addState;
3099 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er$()._STATE_ADDSTREAM); 3023 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er$()._STATE_ADDSTREAM);
3100 return addState.addStreamFuture; 3024 return addState.addStreamFuture;
3101 } 3025 }
3102 get done() { 3026 get done() {
3103 return this[_ensureDoneFuture](); 3027 return this[_ensureDoneFuture]();
3104 } 3028 }
3105 [_ensureDoneFuture]() { 3029 [_ensureDoneFuture]() {
3106 if (this[_doneFuture] == null) { 3030 if (this[_doneFuture] == null) {
3107 this[_doneFuture] = dart.notNull(this[_isCanceled]) ? Future._nullFutu re : new _Future(); 3031 this[_doneFuture] = dart.notNull(this[_isCanceled]) ? Future._nullFutu re : new _Future();
3108 } 3032 }
3109 return this[_doneFuture]; 3033 return this[_doneFuture];
3110 } 3034 }
3111 add(value) { 3035 add(value) {
3112 dart.as(value, T); 3036 dart.as(value, T);
3113 if (!dart.notNull(this[_mayAddEvent])) 3037 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_badEventState]() );
3114 dart.throw(this[_badEventState]());
3115 this[_add](value); 3038 this[_add](value);
3116 } 3039 }
3117 addError(error, stackTrace) { 3040 addError(error, stackTrace) {
3118 if (stackTrace === void 0) 3041 if (stackTrace === void 0) stackTrace = null;
3119 stackTrace = null;
3120 error = _nonNullError(error); 3042 error = _nonNullError(error);
3121 if (!dart.notNull(this[_mayAddEvent])) 3043 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_badEventState]() );
3122 dart.throw(this[_badEventState]());
3123 let replacement = Zone.current.errorCallback(error, stackTrace); 3044 let replacement = Zone.current.errorCallback(error, stackTrace);
3124 if (replacement != null) { 3045 if (replacement != null) {
3125 error = _nonNullError(replacement.error); 3046 error = _nonNullError(replacement.error);
3126 stackTrace = replacement.stackTrace; 3047 stackTrace = replacement.stackTrace;
3127 } 3048 }
3128 this[_addError](error, stackTrace); 3049 this[_addError](error, stackTrace);
3129 } 3050 }
3130 close() { 3051 close() {
3131 if (dart.notNull(this.isClosed)) { 3052 if (dart.notNull(this.isClosed)) {
3132 return this[_ensureDoneFuture](); 3053 return this[_ensureDoneFuture]();
3133 } 3054 }
3134 if (!dart.notNull(this[_mayAddEvent])) 3055 if (!dart.notNull(this[_mayAddEvent])) dart.throw(this[_badEventState]() );
3135 dart.throw(this[_badEventState]());
3136 this[_closeUnchecked](); 3056 this[_closeUnchecked]();
3137 return this[_ensureDoneFuture](); 3057 return this[_ensureDoneFuture]();
3138 } 3058 }
3139 [_closeUnchecked]() { 3059 [_closeUnchecked]() {
3140 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er$()._STATE_CLOSED); 3060 this[_state] = dart.notNull(this[_state]) | dart.notNull(_StreamControll er$()._STATE_CLOSED);
3141 if (dart.notNull(this.hasListener)) { 3061 if (dart.notNull(this.hasListener)) {
3142 this[_sendDone](); 3062 this[_sendDone]();
3143 } else if (dart.notNull(this[_isInitialState])) { 3063 } else if (dart.notNull(this[_isInitialState])) {
3144 this[_ensurePendingEvents]().add(dart.const(new _DelayedDone())); 3064 this[_ensurePendingEvents]().add(dart.const(new _DelayedDone()));
3145 } 3065 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3370 super._StreamController(...arguments); 3290 super._StreamController(...arguments);
3371 } 3291 }
3372 } 3292 }
3373 class _NoCallbackSyncStreamController extends dart.mixin(_StreamController, _S yncStreamControllerDispatch, _NoCallbacks) { 3293 class _NoCallbackSyncStreamController extends dart.mixin(_StreamController, _S yncStreamControllerDispatch, _NoCallbacks) {
3374 _NoCallbackSyncStreamController() { 3294 _NoCallbackSyncStreamController() {
3375 super._StreamController(...arguments); 3295 super._StreamController(...arguments);
3376 } 3296 }
3377 } 3297 }
3378 const _NotificationHandler = dart.typedef('_NotificationHandler', () => dart.f unctionType(dart.dynamic, [])); 3298 const _NotificationHandler = dart.typedef('_NotificationHandler', () => dart.f unctionType(dart.dynamic, []));
3379 function _runGuarded(notificationHandler) { 3299 function _runGuarded(notificationHandler) {
3380 if (notificationHandler == null) 3300 if (notificationHandler == null) return null;
3381 return null;
3382 try { 3301 try {
3383 let result = notificationHandler(); 3302 let result = notificationHandler();
3384 if (dart.is(result, Future)) 3303 if (dart.is(result, Future)) return dart.as(result, Future);
3385 return dart.as(result, Future);
3386 return null; 3304 return null;
3387 } catch (e) { 3305 } catch (e) {
3388 let s = dart.stackTrace(e); 3306 let s = dart.stackTrace(e);
3389 Zone.current.handleUncaughtError(e, s); 3307 Zone.current.handleUncaughtError(e, s);
3390 } 3308 }
3391 3309
3392 } 3310 }
3393 dart.fn(_runGuarded, Future, [_NotificationHandler]); 3311 dart.fn(_runGuarded, Future, [_NotificationHandler]);
3394 const _target = Symbol('_target'); 3312 const _target = Symbol('_target');
3395 const _StreamSinkWrapper$ = dart.generic(function(T) { 3313 const _StreamSinkWrapper$ = dart.generic(function(T) {
3396 class _StreamSinkWrapper extends core.Object { 3314 class _StreamSinkWrapper extends core.Object {
3397 _StreamSinkWrapper(target) { 3315 _StreamSinkWrapper(target) {
3398 this[_target] = target; 3316 this[_target] = target;
3399 } 3317 }
3400 add(data) { 3318 add(data) {
3401 dart.as(data, T); 3319 dart.as(data, T);
3402 this[_target].add(data); 3320 this[_target].add(data);
3403 } 3321 }
3404 addError(error, stackTrace) { 3322 addError(error, stackTrace) {
3405 if (stackTrace === void 0) 3323 if (stackTrace === void 0) stackTrace = null;
3406 stackTrace = null;
3407 this[_target].addError(error, stackTrace); 3324 this[_target].addError(error, stackTrace);
3408 } 3325 }
3409 close() { 3326 close() {
3410 return this[_target].close(); 3327 return this[_target].close();
3411 } 3328 }
3412 addStream(source, opts) { 3329 addStream(source, opts) {
3413 dart.as(source, Stream$(T)); 3330 dart.as(source, Stream$(T));
3414 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true; 3331 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : true;
3415 return this[_target].addStream(source, {cancelOnError: cancelOnError}); 3332 return this[_target].addStream(source, {cancelOnError: cancelOnError});
3416 } 3333 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 const _isUsed = Symbol('_isUsed'); 3433 const _isUsed = Symbol('_isUsed');
3517 const _GeneratedStreamImpl$ = dart.generic(function(T) { 3434 const _GeneratedStreamImpl$ = dart.generic(function(T) {
3518 class _GeneratedStreamImpl extends _StreamImpl$(T) { 3435 class _GeneratedStreamImpl extends _StreamImpl$(T) {
3519 _GeneratedStreamImpl(pending) { 3436 _GeneratedStreamImpl(pending) {
3520 this[_pending] = pending; 3437 this[_pending] = pending;
3521 this[_isUsed] = false; 3438 this[_isUsed] = false;
3522 } 3439 }
3523 [_createSubscription](onData, onError, onDone, cancelOnError) { 3440 [_createSubscription](onData, onError, onDone, cancelOnError) {
3524 dart.as(onData, dart.functionType(dart.void, [T])); 3441 dart.as(onData, dart.functionType(dart.void, [T]));
3525 dart.as(onDone, dart.functionType(dart.void, [])); 3442 dart.as(onDone, dart.functionType(dart.void, []));
3526 if (dart.notNull(this[_isUsed])) 3443 if (dart.notNull(this[_isUsed])) dart.throw(new core.StateError("Stream has already been listened to."));
3527 dart.throw(new core.StateError("Stream has already been listened to.") );
3528 this[_isUsed] = true; 3444 this[_isUsed] = true;
3529 return dart.as((() => { 3445 return dart.as((() => {
3530 let _ = new _BufferingStreamSubscription(onData, onError, onDone, canc elOnError); 3446 let _ = new _BufferingStreamSubscription(onData, onError, onDone, canc elOnError);
3531 _[_setPendingEvents](this[_pending]()); 3447 _[_setPendingEvents](this[_pending]());
3532 return _; 3448 return _;
3533 }).bind(this)(), StreamSubscription$(T)); 3449 }).bind(this)(), StreamSubscription$(T));
3534 } 3450 }
3535 } 3451 }
3536 dart.setSignature(_GeneratedStreamImpl, { 3452 dart.setSignature(_GeneratedStreamImpl, {
3537 constructors: () => ({_GeneratedStreamImpl: [_GeneratedStreamImpl$(T), [_E ventGenerator]]}), 3453 constructors: () => ({_GeneratedStreamImpl: [_GeneratedStreamImpl$(T), [_E ventGenerator]]}),
3538 methods: () => ({[_createSubscription]: [StreamSubscription$(T), [dart.fun ctionType(dart.void, [T]), core.Function, dart.functionType(dart.void, []), core .bool]]}) 3454 methods: () => ({[_createSubscription]: [StreamSubscription$(T), [dart.fun ctionType(dart.void, [T]), core.Function, dart.functionType(dart.void, []), core .bool]]})
3539 }); 3455 });
3540 return _GeneratedStreamImpl; 3456 return _GeneratedStreamImpl;
3541 }); 3457 });
3542 let _GeneratedStreamImpl = _GeneratedStreamImpl$(); 3458 let _GeneratedStreamImpl = _GeneratedStreamImpl$();
3543 const _eventScheduled = Symbol('_eventScheduled'); 3459 const _eventScheduled = Symbol('_eventScheduled');
3544 class _PendingEvents extends core.Object { 3460 class _PendingEvents extends core.Object {
3545 _PendingEvents() { 3461 _PendingEvents() {
3546 this[_state] = _PendingEvents._STATE_UNSCHEDULED; 3462 this[_state] = _PendingEvents._STATE_UNSCHEDULED;
3547 } 3463 }
3548 get isScheduled() { 3464 get isScheduled() {
3549 return this[_state] == _PendingEvents._STATE_SCHEDULED; 3465 return this[_state] == _PendingEvents._STATE_SCHEDULED;
3550 } 3466 }
3551 get [_eventScheduled]() { 3467 get [_eventScheduled]() {
3552 return dart.notNull(this[_state]) >= dart.notNull(_PendingEvents._STATE_SC HEDULED); 3468 return dart.notNull(this[_state]) >= dart.notNull(_PendingEvents._STATE_SC HEDULED);
3553 } 3469 }
3554 schedule(dispatch) { 3470 schedule(dispatch) {
3555 if (dart.notNull(this.isScheduled)) 3471 if (dart.notNull(this.isScheduled)) return;
3556 return;
3557 dart.assert(!dart.notNull(this.isEmpty)); 3472 dart.assert(!dart.notNull(this.isEmpty));
3558 if (dart.notNull(this[_eventScheduled])) { 3473 if (dart.notNull(this[_eventScheduled])) {
3559 dart.assert(this[_state] == _PendingEvents._STATE_CANCELED); 3474 dart.assert(this[_state] == _PendingEvents._STATE_CANCELED);
3560 this[_state] = _PendingEvents._STATE_SCHEDULED; 3475 this[_state] = _PendingEvents._STATE_SCHEDULED;
3561 return; 3476 return;
3562 } 3477 }
3563 scheduleMicrotask(dart.fn((() => { 3478 scheduleMicrotask(dart.fn((() => {
3564 let oldState = this[_state]; 3479 let oldState = this[_state];
3565 this[_state] = _PendingEvents._STATE_UNSCHEDULED; 3480 this[_state] = _PendingEvents._STATE_UNSCHEDULED;
3566 if (oldState == _PendingEvents._STATE_CANCELED) 3481 if (oldState == _PendingEvents._STATE_CANCELED) return;
3567 return;
3568 this.handleNext(dispatch); 3482 this.handleNext(dispatch);
3569 }).bind(this))); 3483 }).bind(this)));
3570 this[_state] = _PendingEvents._STATE_SCHEDULED; 3484 this[_state] = _PendingEvents._STATE_SCHEDULED;
3571 } 3485 }
3572 cancelSchedule() { 3486 cancelSchedule() {
3573 if (dart.notNull(this.isScheduled)) 3487 if (dart.notNull(this.isScheduled)) this[_state] = _PendingEvents._STATE_C ANCELED;
3574 this[_state] = _PendingEvents._STATE_CANCELED;
3575 } 3488 }
3576 } 3489 }
3577 dart.setSignature(_PendingEvents, { 3490 dart.setSignature(_PendingEvents, {
3578 methods: () => ({ 3491 methods: () => ({
3579 schedule: [dart.void, [_EventDispatch]], 3492 schedule: [dart.void, [_EventDispatch]],
3580 cancelSchedule: [dart.void, []] 3493 cancelSchedule: [dart.void, []]
3581 }) 3494 })
3582 }); 3495 });
3583 const _iterator = Symbol('_iterator'); 3496 const _iterator = Symbol('_iterator');
3584 const _IterablePendingEvents$ = dart.generic(function(T) { 3497 const _IterablePendingEvents$ = dart.generic(function(T) {
(...skipping 20 matching lines...) Expand all
3605 } 3518 }
3606 3519
3607 if (!dart.notNull(isDone)) { 3520 if (!dart.notNull(isDone)) {
3608 dispatch[_sendData](this[_iterator].current); 3521 dispatch[_sendData](this[_iterator].current);
3609 } else { 3522 } else {
3610 this[_iterator] = null; 3523 this[_iterator] = null;
3611 dispatch[_sendDone](); 3524 dispatch[_sendDone]();
3612 } 3525 }
3613 } 3526 }
3614 clear() { 3527 clear() {
3615 if (dart.notNull(this.isScheduled)) 3528 if (dart.notNull(this.isScheduled)) this.cancelSchedule();
3616 this.cancelSchedule();
3617 this[_iterator] = null; 3529 this[_iterator] = null;
3618 } 3530 }
3619 } 3531 }
3620 dart.setSignature(_IterablePendingEvents, { 3532 dart.setSignature(_IterablePendingEvents, {
3621 constructors: () => ({_IterablePendingEvents: [_IterablePendingEvents$(T), [core.Iterable$(T)]]}), 3533 constructors: () => ({_IterablePendingEvents: [_IterablePendingEvents$(T), [core.Iterable$(T)]]}),
3622 methods: () => ({ 3534 methods: () => ({
3623 handleNext: [dart.void, [_EventDispatch]], 3535 handleNext: [dart.void, [_EventDispatch]],
3624 clear: [dart.void, []] 3536 clear: [dart.void, []]
3625 }) 3537 })
3626 }); 3538 });
3627 return _IterablePendingEvents; 3539 return _IterablePendingEvents;
3628 }); 3540 });
3629 let _IterablePendingEvents = _IterablePendingEvents$(); 3541 let _IterablePendingEvents = _IterablePendingEvents$();
3630 const _DataHandler$ = dart.generic(function(T) { 3542 const _DataHandler$ = dart.generic(function(T) {
3631 const _DataHandler = dart.typedef('_DataHandler', () => dart.functionType(da rt.void, [T])); 3543 const _DataHandler = dart.typedef('_DataHandler', () => dart.functionType(da rt.void, [T]));
3632 return _DataHandler; 3544 return _DataHandler;
3633 }); 3545 });
3634 let _DataHandler = _DataHandler$(); 3546 let _DataHandler = _DataHandler$();
3635 const _DoneHandler = dart.typedef('_DoneHandler', () => dart.functionType(dart .void, [])); 3547 const _DoneHandler = dart.typedef('_DoneHandler', () => dart.functionType(dart .void, []));
3636 function _nullDataHandler(value) { 3548 function _nullDataHandler(value) {
3637 } 3549 }
3638 dart.fn(_nullDataHandler, dart.void, [dart.dynamic]); 3550 dart.fn(_nullDataHandler, dart.void, [dart.dynamic]);
3639 function _nullErrorHandler(error, stackTrace) { 3551 function _nullErrorHandler(error, stackTrace) {
3640 if (stackTrace === void 0) 3552 if (stackTrace === void 0) stackTrace = null;
3641 stackTrace = null;
3642 Zone.current.handleUncaughtError(error, stackTrace); 3553 Zone.current.handleUncaughtError(error, stackTrace);
3643 } 3554 }
3644 dart.fn(_nullErrorHandler, dart.void, [dart.dynamic], [core.StackTrace]); 3555 dart.fn(_nullErrorHandler, dart.void, [dart.dynamic], [core.StackTrace]);
3645 function _nullDoneHandler() { 3556 function _nullDoneHandler() {
3646 } 3557 }
3647 dart.fn(_nullDoneHandler, dart.void, []); 3558 dart.fn(_nullDoneHandler, dart.void, []);
3648 const _DelayedEvent$ = dart.generic(function(T) { 3559 const _DelayedEvent$ = dart.generic(function(T) {
3649 class _DelayedEvent extends core.Object { 3560 class _DelayedEvent extends core.Object {
3650 _DelayedEvent() { 3561 _DelayedEvent() {
3651 this.next = null; 3562 this.next = null;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 handleNext(dispatch) { 3637 handleNext(dispatch) {
3727 dart.assert(!dart.notNull(this.isScheduled)); 3638 dart.assert(!dart.notNull(this.isScheduled));
3728 let event = this.firstPendingEvent; 3639 let event = this.firstPendingEvent;
3729 this.firstPendingEvent = event.next; 3640 this.firstPendingEvent = event.next;
3730 if (this.firstPendingEvent == null) { 3641 if (this.firstPendingEvent == null) {
3731 this.lastPendingEvent = null; 3642 this.lastPendingEvent = null;
3732 } 3643 }
3733 event.perform(dispatch); 3644 event.perform(dispatch);
3734 } 3645 }
3735 clear() { 3646 clear() {
3736 if (dart.notNull(this.isScheduled)) 3647 if (dart.notNull(this.isScheduled)) this.cancelSchedule();
3737 this.cancelSchedule();
3738 this.firstPendingEvent = this.lastPendingEvent = null; 3648 this.firstPendingEvent = this.lastPendingEvent = null;
3739 } 3649 }
3740 } 3650 }
3741 dart.setSignature(_StreamImplEvents, { 3651 dart.setSignature(_StreamImplEvents, {
3742 methods: () => ({ 3652 methods: () => ({
3743 add: [dart.void, [_DelayedEvent]], 3653 add: [dart.void, [_DelayedEvent]],
3744 handleNext: [dart.void, [_EventDispatch]], 3654 handleNext: [dart.void, [_EventDispatch]],
3745 clear: [dart.void, []] 3655 clear: [dart.void, []]
3746 }) 3656 })
3747 }); 3657 });
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 get [_isSent]() { 3696 get [_isSent]() {
3787 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n$()._DONE_SENT)) != 0; 3697 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n$()._DONE_SENT)) != 0;
3788 } 3698 }
3789 get [_isScheduled]() { 3699 get [_isScheduled]() {
3790 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n$()._SCHEDULED)) != 0; 3700 return (dart.notNull(this[_state]) & dart.notNull(_DoneStreamSubscriptio n$()._SCHEDULED)) != 0;
3791 } 3701 }
3792 get isPaused() { 3702 get isPaused() {
3793 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n$()._PAUSED); 3703 return dart.notNull(this[_state]) >= dart.notNull(_DoneStreamSubscriptio n$()._PAUSED);
3794 } 3704 }
3795 [_schedule]() { 3705 [_schedule]() {
3796 if (dart.notNull(this[_isScheduled])) 3706 if (dart.notNull(this[_isScheduled])) return;
3797 return;
3798 this[_zone].scheduleMicrotask(dart.bind(this, _sendDone)); 3707 this[_zone].scheduleMicrotask(dart.bind(this, _sendDone));
3799 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription$()._SCHEDULED); 3708 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription$()._SCHEDULED);
3800 } 3709 }
3801 onData(handleData) { 3710 onData(handleData) {
3802 dart.as(handleData, dart.functionType(dart.void, [T])); 3711 dart.as(handleData, dart.functionType(dart.void, [T]));
3803 } 3712 }
3804 onError(handleError) {} 3713 onError(handleError) {}
3805 onDone(handleDone) { 3714 onDone(handleDone) {
3806 dart.as(handleDone, dart.functionType(dart.void, [])); 3715 dart.as(handleDone, dart.functionType(dart.void, []));
3807 this[_onDone] = handleDone; 3716 this[_onDone] = handleDone;
3808 } 3717 }
3809 pause(resumeSignal) { 3718 pause(resumeSignal) {
3810 if (resumeSignal === void 0) 3719 if (resumeSignal === void 0) resumeSignal = null;
3811 resumeSignal = null;
3812 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs cription$()._PAUSED); 3720 this[_state] = dart.notNull(this[_state]) + dart.notNull(_DoneStreamSubs cription$()._PAUSED);
3813 if (resumeSignal != null) 3721 if (resumeSignal != null) resumeSignal.whenComplete(dart.bind(this, 'res ume'));
3814 resumeSignal.whenComplete(dart.bind(this, 'resume'));
3815 } 3722 }
3816 resume() { 3723 resume() {
3817 if (dart.notNull(this.isPaused)) { 3724 if (dart.notNull(this.isPaused)) {
3818 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu bscription$()._PAUSED); 3725 this[_state] = dart.notNull(this[_state]) - dart.notNull(_DoneStreamSu bscription$()._PAUSED);
3819 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) { 3726 if (!dart.notNull(this.isPaused) && !dart.notNull(this[_isSent])) {
3820 this[_schedule](); 3727 this[_schedule]();
3821 } 3728 }
3822 } 3729 }
3823 } 3730 }
3824 cancel() { 3731 cancel() {
3825 return null; 3732 return null;
3826 } 3733 }
3827 asFuture(futureValue) { 3734 asFuture(futureValue) {
3828 if (futureValue === void 0) 3735 if (futureValue === void 0) futureValue = null;
3829 futureValue = null;
3830 let result = new _Future(); 3736 let result = new _Future();
3831 this[_onDone] = dart.fn(() => { 3737 this[_onDone] = dart.fn(() => {
3832 result[_completeWithValue](null); 3738 result[_completeWithValue](null);
3833 }); 3739 });
3834 return result; 3740 return result;
3835 } 3741 }
3836 [_sendDone]() { 3742 [_sendDone]() {
3837 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_DoneStreamSub scription$()._SCHEDULED); 3743 this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_DoneStreamSub scription$()._SCHEDULED);
3838 if (dart.notNull(this.isPaused)) 3744 if (dart.notNull(this.isPaused)) return;
3839 return;
3840 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription$()._DONE_SENT); 3745 this[_state] = dart.notNull(this[_state]) | dart.notNull(_DoneStreamSubs cription$()._DONE_SENT);
3841 if (this[_onDone] != null) 3746 if (this[_onDone] != null) this[_zone].runGuarded(this[_onDone]);
3842 this[_zone].runGuarded(this[_onDone]);
3843 } 3747 }
3844 } 3748 }
3845 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)]; 3749 _DoneStreamSubscription[dart.implements] = () => [StreamSubscription$(T)];
3846 dart.setSignature(_DoneStreamSubscription, { 3750 dart.setSignature(_DoneStreamSubscription, {
3847 constructors: () => ({_DoneStreamSubscription: [_DoneStreamSubscription$(T ), [_DoneHandler]]}), 3751 constructors: () => ({_DoneStreamSubscription: [_DoneStreamSubscription$(T ), [_DoneHandler]]}),
3848 methods: () => ({ 3752 methods: () => ({
3849 [_schedule]: [dart.void, []], 3753 [_schedule]: [dart.void, []],
3850 onData: [dart.void, [dart.functionType(dart.void, [T])]], 3754 onData: [dart.void, [dart.functionType(dart.void, [T])]],
3851 onError: [dart.void, [core.Function]], 3755 onError: [dart.void, [core.Function]],
3852 onDone: [dart.void, [dart.functionType(dart.void, [])]], 3756 onDone: [dart.void, [dart.functionType(dart.void, [])]],
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3911 this[_subscription] = null; 3815 this[_subscription] = null;
3912 } 3816 }
3913 } 3817 }
3914 } 3818 }
3915 [_onListen]() { 3819 [_onListen]() {
3916 if (this[_onListenHandler] != null) { 3820 if (this[_onListenHandler] != null) {
3917 this[_zone].runUnary(this[_onListenHandler], new _BroadcastSubscriptio nWrapper(this)); 3821 this[_zone].runUnary(this[_onListenHandler], new _BroadcastSubscriptio nWrapper(this));
3918 } 3822 }
3919 } 3823 }
3920 [_cancelSubscription]() { 3824 [_cancelSubscription]() {
3921 if (this[_subscription] == null) 3825 if (this[_subscription] == null) return;
3922 return;
3923 let subscription = this[_subscription]; 3826 let subscription = this[_subscription];
3924 this[_subscription] = null; 3827 this[_subscription] = null;
3925 this[_controller] = null; 3828 this[_controller] = null;
3926 subscription.cancel(); 3829 subscription.cancel();
3927 } 3830 }
3928 [_pauseSubscription](resumeSignal) { 3831 [_pauseSubscription](resumeSignal) {
3929 if (this[_subscription] == null) 3832 if (this[_subscription] == null) return;
3930 return;
3931 this[_subscription].pause(resumeSignal); 3833 this[_subscription].pause(resumeSignal);
3932 } 3834 }
3933 [_resumeSubscription]() { 3835 [_resumeSubscription]() {
3934 if (this[_subscription] == null) 3836 if (this[_subscription] == null) return;
3935 return;
3936 this[_subscription].resume(); 3837 this[_subscription].resume();
3937 } 3838 }
3938 get [_isSubscriptionPaused]() { 3839 get [_isSubscriptionPaused]() {
3939 if (this[_subscription] == null) 3840 if (this[_subscription] == null) return false;
3940 return false;
3941 return this[_subscription].isPaused; 3841 return this[_subscription].isPaused;
3942 } 3842 }
3943 } 3843 }
3944 dart.setSignature(_AsBroadcastStream, { 3844 dart.setSignature(_AsBroadcastStream, {
3945 constructors: () => ({_AsBroadcastStream: [_AsBroadcastStream$(T), [Stream $(T), dart.functionType(dart.void, [StreamSubscription]), dart.functionType(dart .void, [StreamSubscription])]]}), 3845 constructors: () => ({_AsBroadcastStream: [_AsBroadcastStream$(T), [Stream $(T), dart.functionType(dart.void, [StreamSubscription]), dart.functionType(dart .void, [StreamSubscription])]]}),
3946 methods: () => ({ 3846 methods: () => ({
3947 listen: [StreamSubscription$(T), [dart.functionType(dart.void, [T])], {o nError: core.Function, onDone: dart.functionType(dart.void, []), cancelOnError: core.bool}], 3847 listen: [StreamSubscription$(T), [dart.functionType(dart.void, [T])], {o nError: core.Function, onDone: dart.functionType(dart.void, []), cancelOnError: core.bool}],
3948 [_onCancel]: [dart.void, []], 3848 [_onCancel]: [dart.void, []],
3949 [_onListen]: [dart.void, []], 3849 [_onListen]: [dart.void, []],
3950 [_cancelSubscription]: [dart.void, []], 3850 [_cancelSubscription]: [dart.void, []],
(...skipping 14 matching lines...) Expand all
3965 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription.")); 3865 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription."));
3966 } 3866 }
3967 onError(handleError) { 3867 onError(handleError) {
3968 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription.")); 3868 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription."));
3969 } 3869 }
3970 onDone(handleDone) { 3870 onDone(handleDone) {
3971 dart.as(handleDone, dart.functionType(dart.void, [])); 3871 dart.as(handleDone, dart.functionType(dart.void, []));
3972 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription.")); 3872 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription."));
3973 } 3873 }
3974 pause(resumeSignal) { 3874 pause(resumeSignal) {
3975 if (resumeSignal === void 0) 3875 if (resumeSignal === void 0) resumeSignal = null;
3976 resumeSignal = null;
3977 this[_stream][_pauseSubscription](resumeSignal); 3876 this[_stream][_pauseSubscription](resumeSignal);
3978 } 3877 }
3979 resume() { 3878 resume() {
3980 this[_stream][_resumeSubscription](); 3879 this[_stream][_resumeSubscription]();
3981 } 3880 }
3982 cancel() { 3881 cancel() {
3983 this[_stream][_cancelSubscription](); 3882 this[_stream][_cancelSubscription]();
3984 return null; 3883 return null;
3985 } 3884 }
3986 get isPaused() { 3885 get isPaused() {
3987 return this[_stream][_isSubscriptionPaused]; 3886 return this[_stream][_isSubscriptionPaused];
3988 } 3887 }
3989 asFuture(futureValue) { 3888 asFuture(futureValue) {
3990 if (futureValue === void 0) 3889 if (futureValue === void 0) futureValue = null;
3991 futureValue = null;
3992 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription.")); 3890 dart.throw(new core.UnsupportedError("Cannot change handlers of asBroadc astStream source subscription."));
3993 } 3891 }
3994 } 3892 }
3995 _BroadcastSubscriptionWrapper[dart.implements] = () => [StreamSubscription$( T)]; 3893 _BroadcastSubscriptionWrapper[dart.implements] = () => [StreamSubscription$( T)];
3996 dart.setSignature(_BroadcastSubscriptionWrapper, { 3894 dart.setSignature(_BroadcastSubscriptionWrapper, {
3997 constructors: () => ({_BroadcastSubscriptionWrapper: [_BroadcastSubscripti onWrapper$(T), [_AsBroadcastStream]]}), 3895 constructors: () => ({_BroadcastSubscriptionWrapper: [_BroadcastSubscripti onWrapper$(T), [_AsBroadcastStream]]}),
3998 methods: () => ({ 3896 methods: () => ({
3999 onData: [dart.void, [dart.functionType(dart.void, [T])]], 3897 onData: [dart.void, [dart.functionType(dart.void, [T])]],
4000 onError: [dart.void, [core.Function]], 3898 onError: [dart.void, [core.Function]],
4001 onDone: [dart.void, [dart.functionType(dart.void, [])]], 3899 onDone: [dart.void, [dart.functionType(dart.void, [])]],
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4061 } 3959 }
4062 } 3960 }
4063 [_clear]() { 3961 [_clear]() {
4064 this[_subscription] = null; 3962 this[_subscription] = null;
4065 this[_futureOrPrefetch] = null; 3963 this[_futureOrPrefetch] = null;
4066 this[_current] = null; 3964 this[_current] = null;
4067 this[_state] = _StreamIteratorImpl$()._STATE_DONE; 3965 this[_state] = _StreamIteratorImpl$()._STATE_DONE;
4068 } 3966 }
4069 cancel() { 3967 cancel() {
4070 let subscription = this[_subscription]; 3968 let subscription = this[_subscription];
4071 if (subscription == null) 3969 if (subscription == null) return null;
4072 return null;
4073 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) { 3970 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) {
4074 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool)); 3971 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
4075 this[_clear](); 3972 this[_clear]();
4076 hasNext[_complete](false); 3973 hasNext[_complete](false);
4077 } else { 3974 } else {
4078 this[_clear](); 3975 this[_clear]();
4079 } 3976 }
4080 return subscription.cancel(); 3977 return subscription.cancel();
4081 } 3978 }
4082 [_onData](data) { 3979 [_onData](data) {
4083 dart.as(data, T); 3980 dart.as(data, T);
4084 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) { 3981 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) {
4085 this[_current] = data; 3982 this[_current] = data;
4086 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool)); 3983 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
4087 this[_futureOrPrefetch] = null; 3984 this[_futureOrPrefetch] = null;
4088 this[_state] = _StreamIteratorImpl$()._STATE_FOUND; 3985 this[_state] = _StreamIteratorImpl$()._STATE_FOUND;
4089 hasNext[_complete](true); 3986 hasNext[_complete](true);
4090 return; 3987 return;
4091 } 3988 }
4092 this[_subscription].pause(); 3989 this[_subscription].pause();
4093 dart.assert(this[_futureOrPrefetch] == null); 3990 dart.assert(this[_futureOrPrefetch] == null);
4094 this[_futureOrPrefetch] = data; 3991 this[_futureOrPrefetch] = data;
4095 this[_state] = _StreamIteratorImpl$()._STATE_EXTRA_DATA; 3992 this[_state] = _StreamIteratorImpl$()._STATE_EXTRA_DATA;
4096 } 3993 }
4097 [_onError](error, stackTrace) { 3994 [_onError](error, stackTrace) {
4098 if (stackTrace === void 0) 3995 if (stackTrace === void 0) stackTrace = null;
4099 stackTrace = null;
4100 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) { 3996 if (this[_state] == _StreamIteratorImpl$()._STATE_MOVING) {
4101 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool)); 3997 let hasNext = dart.as(this[_futureOrPrefetch], _Future$(core.bool));
4102 this[_clear](); 3998 this[_clear]();
4103 hasNext[_completeError](error, stackTrace); 3999 hasNext[_completeError](error, stackTrace);
4104 return; 4000 return;
4105 } 4001 }
4106 this[_subscription].pause(); 4002 this[_subscription].pause();
4107 dart.assert(this[_futureOrPrefetch] == null); 4003 dart.assert(this[_futureOrPrefetch] == null);
4108 this[_futureOrPrefetch] = new AsyncError(error, stackTrace); 4004 this[_futureOrPrefetch] = new AsyncError(error, stackTrace);
4109 this[_state] = _StreamIteratorImpl$()._STATE_EXTRA_ERROR; 4005 this[_state] = _StreamIteratorImpl$()._STATE_EXTRA_ERROR;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4253 const _ForwardingStreamSubscription$ = dart.generic(function(S, T) { 4149 const _ForwardingStreamSubscription$ = dart.generic(function(S, T) {
4254 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T) { 4150 class _ForwardingStreamSubscription extends _BufferingStreamSubscription$(T) {
4255 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr or) { 4151 _ForwardingStreamSubscription(stream, onData, onError, onDone, cancelOnErr or) {
4256 this[_stream] = stream; 4152 this[_stream] = stream;
4257 this[_subscription] = null; 4153 this[_subscription] = null;
4258 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r); 4154 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro r);
4259 this[_subscription] = this[_stream][_source].listen(dart.bind(this, _han dleData), {onError: dart.bind(this, _handleError), onDone: dart.bind(this, _hand leDone)}); 4155 this[_subscription] = this[_stream][_source].listen(dart.bind(this, _han dleData), {onError: dart.bind(this, _handleError), onDone: dart.bind(this, _hand leDone)});
4260 } 4156 }
4261 [_add](data) { 4157 [_add](data) {
4262 dart.as(data, T); 4158 dart.as(data, T);
4263 if (dart.notNull(this[_isClosed])) 4159 if (dart.notNull(this[_isClosed])) return;
4264 return;
4265 super[_add](data); 4160 super[_add](data);
4266 } 4161 }
4267 [_addError](error, stackTrace) { 4162 [_addError](error, stackTrace) {
4268 if (dart.notNull(this[_isClosed])) 4163 if (dart.notNull(this[_isClosed])) return;
4269 return;
4270 super[_addError](error, stackTrace); 4164 super[_addError](error, stackTrace);
4271 } 4165 }
4272 [_onPause]() { 4166 [_onPause]() {
4273 if (this[_subscription] == null) 4167 if (this[_subscription] == null) return;
4274 return;
4275 this[_subscription].pause(); 4168 this[_subscription].pause();
4276 } 4169 }
4277 [_onResume]() { 4170 [_onResume]() {
4278 if (this[_subscription] == null) 4171 if (this[_subscription] == null) return;
4279 return;
4280 this[_subscription].resume(); 4172 this[_subscription].resume();
4281 } 4173 }
4282 [_onCancel]() { 4174 [_onCancel]() {
4283 if (this[_subscription] != null) { 4175 if (this[_subscription] != null) {
4284 let subscription = this[_subscription]; 4176 let subscription = this[_subscription];
4285 this[_subscription] = null; 4177 this[_subscription] = null;
4286 subscription.cancel(); 4178 subscription.cancel();
4287 } 4179 }
4288 return null; 4180 return null;
4289 } 4181 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
4462 }); 4354 });
4463 return _HandleErrorStream; 4355 return _HandleErrorStream;
4464 }); 4356 });
4465 let _HandleErrorStream = _HandleErrorStream$(); 4357 let _HandleErrorStream = _HandleErrorStream$();
4466 const _remaining = Symbol('_remaining'); 4358 const _remaining = Symbol('_remaining');
4467 const _TakeStream$ = dart.generic(function(T) { 4359 const _TakeStream$ = dart.generic(function(T) {
4468 class _TakeStream extends _ForwardingStream$(T, T) { 4360 class _TakeStream extends _ForwardingStream$(T, T) {
4469 _TakeStream(source, count) { 4361 _TakeStream(source, count) {
4470 this[_remaining] = count; 4362 this[_remaining] = count;
4471 super._ForwardingStream(source); 4363 super._ForwardingStream(source);
4472 if (!(typeof count == 'number')) 4364 if (!(typeof count == 'number')) dart.throw(new core.ArgumentError(count ));
4473 dart.throw(new core.ArgumentError(count));
4474 } 4365 }
4475 [_handleData](inputEvent, sink) { 4366 [_handleData](inputEvent, sink) {
4476 dart.as(inputEvent, T); 4367 dart.as(inputEvent, T);
4477 dart.as(sink, _EventSink$(T)); 4368 dart.as(sink, _EventSink$(T));
4478 if (dart.notNull(this[_remaining]) > 0) { 4369 if (dart.notNull(this[_remaining]) > 0) {
4479 sink[_add](inputEvent); 4370 sink[_add](inputEvent);
4480 this[_remaining] = dart.notNull(this[_remaining]) - 1; 4371 this[_remaining] = dart.notNull(this[_remaining]) - 1;
4481 if (this[_remaining] == 0) { 4372 if (this[_remaining] == 0) {
4482 sink[_close](); 4373 sink[_close]();
4483 } 4374 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4522 methods: () => ({[_handleData]: [dart.void, [T, _EventSink$(T)]]}) 4413 methods: () => ({[_handleData]: [dart.void, [T, _EventSink$(T)]]})
4523 }); 4414 });
4524 return _TakeWhileStream; 4415 return _TakeWhileStream;
4525 }); 4416 });
4526 let _TakeWhileStream = _TakeWhileStream$(); 4417 let _TakeWhileStream = _TakeWhileStream$();
4527 const _SkipStream$ = dart.generic(function(T) { 4418 const _SkipStream$ = dart.generic(function(T) {
4528 class _SkipStream extends _ForwardingStream$(T, T) { 4419 class _SkipStream extends _ForwardingStream$(T, T) {
4529 _SkipStream(source, count) { 4420 _SkipStream(source, count) {
4530 this[_remaining] = count; 4421 this[_remaining] = count;
4531 super._ForwardingStream(source); 4422 super._ForwardingStream(source);
4532 if (!(typeof count == 'number') || dart.notNull(count) < 0) 4423 if (!(typeof count == 'number') || dart.notNull(count) < 0) dart.throw(n ew core.ArgumentError(count));
4533 dart.throw(new core.ArgumentError(count));
4534 } 4424 }
4535 [_handleData](inputEvent, sink) { 4425 [_handleData](inputEvent, sink) {
4536 dart.as(inputEvent, T); 4426 dart.as(inputEvent, T);
4537 dart.as(sink, _EventSink$(T)); 4427 dart.as(sink, _EventSink$(T));
4538 if (dart.notNull(this[_remaining]) > 0) { 4428 if (dart.notNull(this[_remaining]) > 0) {
4539 this[_remaining] = dart.notNull(this[_remaining]) - 1; 4429 this[_remaining] = dart.notNull(this[_remaining]) - 1;
4540 return; 4430 return;
4541 } 4431 }
4542 sink[_add](inputEvent); 4432 sink[_add](inputEvent);
4543 } 4433 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4643 const _EventSinkWrapper$ = dart.generic(function(T) { 4533 const _EventSinkWrapper$ = dart.generic(function(T) {
4644 class _EventSinkWrapper extends core.Object { 4534 class _EventSinkWrapper extends core.Object {
4645 _EventSinkWrapper(sink) { 4535 _EventSinkWrapper(sink) {
4646 this[_sink] = sink; 4536 this[_sink] = sink;
4647 } 4537 }
4648 add(data) { 4538 add(data) {
4649 dart.as(data, T); 4539 dart.as(data, T);
4650 this[_sink][_add](data); 4540 this[_sink][_add](data);
4651 } 4541 }
4652 addError(error, stackTrace) { 4542 addError(error, stackTrace) {
4653 if (stackTrace === void 0) 4543 if (stackTrace === void 0) stackTrace = null;
4654 stackTrace = null;
4655 this[_sink][_addError](error, stackTrace); 4544 this[_sink][_addError](error, stackTrace);
4656 } 4545 }
4657 close() { 4546 close() {
4658 this[_sink][_close](); 4547 this[_sink][_close]();
4659 } 4548 }
4660 } 4549 }
4661 _EventSinkWrapper[dart.implements] = () => [EventSink$(T)]; 4550 _EventSinkWrapper[dart.implements] = () => [EventSink$(T)];
4662 dart.setSignature(_EventSinkWrapper, { 4551 dart.setSignature(_EventSinkWrapper, {
4663 constructors: () => ({_EventSinkWrapper: [_EventSinkWrapper$(T), [_EventSi nk]]}), 4552 constructors: () => ({_EventSinkWrapper: [_EventSinkWrapper$(T), [_EventSi nk]]}),
4664 methods: () => ({ 4553 methods: () => ({
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4698 } 4587 }
4699 super[_addError](error, stackTrace); 4588 super[_addError](error, stackTrace);
4700 } 4589 }
4701 [_close]() { 4590 [_close]() {
4702 if (dart.notNull(this[_isClosed])) { 4591 if (dart.notNull(this[_isClosed])) {
4703 dart.throw(new core.StateError("Stream is already closed")); 4592 dart.throw(new core.StateError("Stream is already closed"));
4704 } 4593 }
4705 super[_close](); 4594 super[_close]();
4706 } 4595 }
4707 [_onPause]() { 4596 [_onPause]() {
4708 if (dart.notNull(this[_isSubscribed])) 4597 if (dart.notNull(this[_isSubscribed])) this[_subscription].pause();
4709 this[_subscription].pause();
4710 } 4598 }
4711 [_onResume]() { 4599 [_onResume]() {
4712 if (dart.notNull(this[_isSubscribed])) 4600 if (dart.notNull(this[_isSubscribed])) this[_subscription].resume();
4713 this[_subscription].resume();
4714 } 4601 }
4715 [_onCancel]() { 4602 [_onCancel]() {
4716 if (dart.notNull(this[_isSubscribed])) { 4603 if (dart.notNull(this[_isSubscribed])) {
4717 let subscription = this[_subscription]; 4604 let subscription = this[_subscription];
4718 this[_subscription] = null; 4605 this[_subscription] = null;
4719 subscription.cancel(); 4606 subscription.cancel();
4720 } 4607 }
4721 return null; 4608 return null;
4722 } 4609 }
4723 [_handleData](data) { 4610 [_handleData](data) {
4724 dart.as(data, S); 4611 dart.as(data, S);
4725 try { 4612 try {
4726 this[_transformerSink].add(data); 4613 this[_transformerSink].add(data);
4727 } catch (e) { 4614 } catch (e) {
4728 let s = dart.stackTrace(e); 4615 let s = dart.stackTrace(e);
4729 this[_addError](e, s); 4616 this[_addError](e, s);
4730 } 4617 }
4731 4618
4732 } 4619 }
4733 [_handleError](error, stackTrace) { 4620 [_handleError](error, stackTrace) {
4734 if (stackTrace === void 0) 4621 if (stackTrace === void 0) stackTrace = null;
4735 stackTrace = null;
4736 try { 4622 try {
4737 this[_transformerSink].addError(error, dart.as(stackTrace, core.StackT race)); 4623 this[_transformerSink].addError(error, dart.as(stackTrace, core.StackT race));
4738 } catch (e) { 4624 } catch (e) {
4739 let s = dart.stackTrace(e); 4625 let s = dart.stackTrace(e);
4740 if (dart.notNull(core.identical(e, error))) { 4626 if (dart.notNull(core.identical(e, error))) {
4741 this[_addError](error, dart.as(stackTrace, core.StackTrace)); 4627 this[_addError](error, dart.as(stackTrace, core.StackTrace));
4742 } else { 4628 } else {
4743 this[_addError](e, s); 4629 this[_addError](e, s);
4744 } 4630 }
4745 } 4631 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
4841 this[_handleData] = handleData; 4727 this[_handleData] = handleData;
4842 this[_handleError] = handleError; 4728 this[_handleError] = handleError;
4843 this[_handleDone] = handleDone; 4729 this[_handleDone] = handleDone;
4844 this[_sink] = sink; 4730 this[_sink] = sink;
4845 } 4731 }
4846 add(data) { 4732 add(data) {
4847 dart.as(data, S); 4733 dart.as(data, S);
4848 return this[_handleData](data, this[_sink]); 4734 return this[_handleData](data, this[_sink]);
4849 } 4735 }
4850 addError(error, stackTrace) { 4736 addError(error, stackTrace) {
4851 if (stackTrace === void 0) 4737 if (stackTrace === void 0) stackTrace = null;
4852 stackTrace = null;
4853 return this[_handleError](error, stackTrace, this[_sink]); 4738 return this[_handleError](error, stackTrace, this[_sink]);
4854 } 4739 }
4855 close() { 4740 close() {
4856 return this[_handleDone](this[_sink]); 4741 return this[_handleDone](this[_sink]);
4857 } 4742 }
4858 } 4743 }
4859 _HandlerEventSink[dart.implements] = () => [EventSink$(S)]; 4744 _HandlerEventSink[dart.implements] = () => [EventSink$(S)];
4860 dart.setSignature(_HandlerEventSink, { 4745 dart.setSignature(_HandlerEventSink, {
4861 constructors: () => ({_HandlerEventSink: [_HandlerEventSink$(S, T), [_Tran sformDataHandler$(S, T), _TransformErrorHandler$(T), _TransformDoneHandler$(T), EventSink$(T)]]}), 4746 constructors: () => ({_HandlerEventSink: [_HandlerEventSink$(S, T), [_Tran sformDataHandler$(S, T), _TransformErrorHandler$(T), _TransformDoneHandler$(T), EventSink$(T)]]}),
4862 methods: () => ({ 4747 methods: () => ({
4863 add: [dart.void, [S]], 4748 add: [dart.void, [S]],
4864 addError: [dart.void, [core.Object], [core.StackTrace]], 4749 addError: [dart.void, [core.Object], [core.StackTrace]],
4865 close: [dart.void, []] 4750 close: [dart.void, []]
4866 }) 4751 })
4867 }); 4752 });
4868 return _HandlerEventSink; 4753 return _HandlerEventSink;
4869 }); 4754 });
4870 let _HandlerEventSink = _HandlerEventSink$(); 4755 let _HandlerEventSink = _HandlerEventSink$();
4871 const _StreamHandlerTransformer$ = dart.generic(function(S, T) { 4756 const _StreamHandlerTransformer$ = dart.generic(function(S, T) {
4872 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) { 4757 class _StreamHandlerTransformer extends _StreamSinkTransformer$(S, T) {
4873 _StreamHandlerTransformer(opts) { 4758 _StreamHandlerTransformer(opts) {
4874 let handleData = opts && 'handleData' in opts ? opts.handleData : null; 4759 let handleData = opts && 'handleData' in opts ? opts.handleData : null;
4875 let handleError = opts && 'handleError' in opts ? opts.handleError : nul l; 4760 let handleError = opts && 'handleError' in opts ? opts.handleError : nul l;
4876 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null; 4761 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null;
4877 super._StreamSinkTransformer(dart.as(dart.fn(outputSink => { 4762 super._StreamSinkTransformer(dart.as(dart.fn(outputSink => {
4878 dart.as(outputSink, EventSink$(T)); 4763 dart.as(outputSink, EventSink$(T));
4879 if (handleData == null) 4764 if (handleData == null) handleData = dart.as(_StreamHandlerTransformer $()._defaultHandleData, __CastType27);
4880 handleData = dart.as(_StreamHandlerTransformer$()._defaultHandleData , __CastType27); 4765 if (handleError == null) handleError = dart.as(_StreamHandlerTransform er$()._defaultHandleError, __CastType30);
4881 if (handleError == null) 4766 if (handleDone == null) handleDone = _StreamHandlerTransformer$()._def aultHandleDone;
4882 handleError = dart.as(_StreamHandlerTransformer$()._defaultHandleErr or, __CastType30);
4883 if (handleDone == null)
4884 handleDone = _StreamHandlerTransformer$()._defaultHandleDone;
4885 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD one, outputSink); 4767 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD one, outputSink);
4886 }, dart.dynamic, [EventSink$(T)]), _SinkMapper$(S, T))); 4768 }, dart.dynamic, [EventSink$(T)]), _SinkMapper$(S, T)));
4887 } 4769 }
4888 bind(stream) { 4770 bind(stream) {
4889 dart.as(stream, Stream$(S)); 4771 dart.as(stream, Stream$(S));
4890 return super.bind(stream); 4772 return super.bind(stream);
4891 } 4773 }
4892 static _defaultHandleData(data, sink) { 4774 static _defaultHandleData(data, sink) {
4893 sink.add(data); 4775 sink.add(data);
4894 } 4776 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
4985 if (dart.equals(Zone.current, Zone.ROOT)) { 4867 if (dart.equals(Zone.current, Zone.ROOT)) {
4986 return Zone.current.createPeriodicTimer(duration, callback); 4868 return Zone.current.createPeriodicTimer(duration, callback);
4987 } 4869 }
4988 return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bin dUnaryCallback(callback, {runGuarded: true}), __CastType34)); 4870 return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bin dUnaryCallback(callback, {runGuarded: true}), __CastType34));
4989 } 4871 }
4990 static run(callback) { 4872 static run(callback) {
4991 Timer.new(core.Duration.ZERO, callback); 4873 Timer.new(core.Duration.ZERO, callback);
4992 } 4874 }
4993 static _createTimer(duration, callback) { 4875 static _createTimer(duration, callback) {
4994 let milliseconds = duration.inMilliseconds; 4876 let milliseconds = duration.inMilliseconds;
4995 if (dart.notNull(milliseconds) < 0) 4877 if (dart.notNull(milliseconds) < 0) milliseconds = 0;
4996 milliseconds = 0;
4997 return new _isolate_helper.TimerImpl(milliseconds, callback); 4878 return new _isolate_helper.TimerImpl(milliseconds, callback);
4998 } 4879 }
4999 static _createPeriodicTimer(duration, callback) { 4880 static _createPeriodicTimer(duration, callback) {
5000 let milliseconds = duration.inMilliseconds; 4881 let milliseconds = duration.inMilliseconds;
5001 if (dart.notNull(milliseconds) < 0) 4882 if (dart.notNull(milliseconds) < 0) milliseconds = 0;
5002 milliseconds = 0;
5003 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback); 4883 return new _isolate_helper.TimerImpl.periodic(milliseconds, callback);
5004 } 4884 }
5005 } 4885 }
5006 dart.setSignature(Timer, { 4886 dart.setSignature(Timer, {
5007 constructors: () => ({ 4887 constructors: () => ({
5008 new: [Timer, [core.Duration, dart.functionType(dart.void, [])]], 4888 new: [Timer, [core.Duration, dart.functionType(dart.void, [])]],
5009 periodic: [Timer, [core.Duration, dart.functionType(dart.void, [Timer])]] 4889 periodic: [Timer, [core.Duration, dart.functionType(dart.void, [Timer])]]
5010 }), 4890 }),
5011 statics: () => ({ 4891 statics: () => ({
5012 run: [dart.void, [dart.functionType(dart.void, [])]], 4892 run: [dart.void, [dart.functionType(dart.void, [])]],
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
5200 get [_handleUncaughtError]() { 5080 get [_handleUncaughtError]() {
5201 return dart.const(new _ZoneFunction(_ROOT_ZONE, _rootHandleUncaughtError)) ; 5081 return dart.const(new _ZoneFunction(_ROOT_ZONE, _rootHandleUncaughtError)) ;
5202 } 5082 }
5203 get parent() { 5083 get parent() {
5204 return null; 5084 return null;
5205 } 5085 }
5206 get [_map]() { 5086 get [_map]() {
5207 return _RootZone._rootMap; 5087 return _RootZone._rootMap;
5208 } 5088 }
5209 get [_delegate]() { 5089 get [_delegate]() {
5210 if (_RootZone._rootDelegate != null) 5090 if (_RootZone._rootDelegate != null) return _RootZone._rootDelegate;
5211 return _RootZone._rootDelegate;
5212 return _RootZone._rootDelegate = new _ZoneDelegate(this); 5091 return _RootZone._rootDelegate = new _ZoneDelegate(this);
5213 } 5092 }
5214 get errorZone() { 5093 get errorZone() {
5215 return this; 5094 return this;
5216 } 5095 }
5217 runGuarded(f) { 5096 runGuarded(f) {
5218 try { 5097 try {
5219 if (dart.notNull(core.identical(_ROOT_ZONE, Zone._current))) { 5098 if (dart.notNull(core.identical(_ROOT_ZONE, Zone._current))) {
5220 return f(); 5099 return f();
5221 } 5100 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5279 } 5158 }
5280 handleUncaughtError(error, stackTrace) { 5159 handleUncaughtError(error, stackTrace) {
5281 return _rootHandleUncaughtError(null, null, this, error, stackTrace); 5160 return _rootHandleUncaughtError(null, null, this, error, stackTrace);
5282 } 5161 }
5283 fork(opts) { 5162 fork(opts) {
5284 let specification = opts && 'specification' in opts ? opts.specification : null; 5163 let specification = opts && 'specification' in opts ? opts.specification : null;
5285 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; 5164 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null;
5286 return _rootFork(null, null, this, specification, zoneValues); 5165 return _rootFork(null, null, this, specification, zoneValues);
5287 } 5166 }
5288 run(f) { 5167 run(f) {
5289 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) 5168 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) return f();
5290 return f();
5291 return _rootRun(null, null, this, f); 5169 return _rootRun(null, null, this, f);
5292 } 5170 }
5293 runUnary(f, arg) { 5171 runUnary(f, arg) {
5294 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) 5172 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) return dart.d call(f, arg);
5295 return dart.dcall(f, arg);
5296 return _rootRunUnary(null, null, this, f, arg); 5173 return _rootRunUnary(null, null, this, f, arg);
5297 } 5174 }
5298 runBinary(f, arg1, arg2) { 5175 runBinary(f, arg1, arg2) {
5299 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) 5176 if (dart.notNull(core.identical(Zone._current, _ROOT_ZONE))) return dart.d call(f, arg1, arg2);
5300 return dart.dcall(f, arg1, arg2);
5301 return _rootRunBinary(null, null, this, f, arg1, arg2); 5177 return _rootRunBinary(null, null, this, f, arg1, arg2);
5302 } 5178 }
5303 registerCallback(f) { 5179 registerCallback(f) {
5304 return f; 5180 return f;
5305 } 5181 }
5306 registerUnaryCallback(f) { 5182 registerUnaryCallback(f) {
5307 return f; 5183 return f;
5308 } 5184 }
5309 registerBinaryCallback(f) { 5185 registerBinaryCallback(f) {
5310 return f; 5186 return f;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5347 scheduleMicrotask: [dart.void, [dart.functionType(dart.void, [])]], 5223 scheduleMicrotask: [dart.void, [dart.functionType(dart.void, [])]],
5348 createTimer: [Timer, [core.Duration, dart.functionType(dart.void, [])]], 5224 createTimer: [Timer, [core.Duration, dart.functionType(dart.void, [])]],
5349 createPeriodicTimer: [Timer, [core.Duration, dart.functionType(dart.void, [Timer])]], 5225 createPeriodicTimer: [Timer, [core.Duration, dart.functionType(dart.void, [Timer])]],
5350 print: [dart.void, [core.String]] 5226 print: [dart.void, [core.String]]
5351 }) 5227 })
5352 }); 5228 });
5353 const _ROOT_ZONE = dart.const(new _RootZone()); 5229 const _ROOT_ZONE = dart.const(new _RootZone());
5354 Zone.ROOT = _ROOT_ZONE; 5230 Zone.ROOT = _ROOT_ZONE;
5355 Zone._current = _ROOT_ZONE; 5231 Zone._current = _ROOT_ZONE;
5356 function _parentDelegate(zone) { 5232 function _parentDelegate(zone) {
5357 if (zone.parent == null) 5233 if (zone.parent == null) return null;
5358 return null;
5359 return zone.parent[_delegate]; 5234 return zone.parent[_delegate];
5360 } 5235 }
5361 dart.fn(_parentDelegate, ZoneDelegate, [_Zone]); 5236 dart.fn(_parentDelegate, ZoneDelegate, [_Zone]);
5362 const _delegationTarget = Symbol('_delegationTarget'); 5237 const _delegationTarget = Symbol('_delegationTarget');
5363 class _ZoneDelegate extends core.Object { 5238 class _ZoneDelegate extends core.Object {
5364 _ZoneDelegate(delegationTarget) { 5239 _ZoneDelegate(delegationTarget) {
5365 this[_delegationTarget] = delegationTarget; 5240 this[_delegationTarget] = delegationTarget;
5366 } 5241 }
5367 handleUncaughtError(zone, error, stackTrace) { 5242 handleUncaughtError(zone, error, stackTrace) {
5368 let implementation = this[_delegationTarget][_handleUncaughtError]; 5243 let implementation = this[_delegationTarget][_handleUncaughtError];
(...skipping 26 matching lines...) Expand all
5395 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega te(implZone), zone, f), ZoneUnaryCallback); 5270 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega te(implZone), zone, f), ZoneUnaryCallback);
5396 } 5271 }
5397 registerBinaryCallback(zone, f) { 5272 registerBinaryCallback(zone, f) {
5398 let implementation = this[_delegationTarget][_registerBinaryCallback]; 5273 let implementation = this[_delegationTarget][_registerBinaryCallback];
5399 let implZone = implementation.zone; 5274 let implZone = implementation.zone;
5400 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega te(implZone), zone, f), ZoneBinaryCallback); 5275 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega te(implZone), zone, f), ZoneBinaryCallback);
5401 } 5276 }
5402 errorCallback(zone, error, stackTrace) { 5277 errorCallback(zone, error, stackTrace) {
5403 let implementation = this[_delegationTarget][_errorCallback]; 5278 let implementation = this[_delegationTarget][_errorCallback];
5404 let implZone = implementation.zone; 5279 let implZone = implementation.zone;
5405 if (dart.notNull(core.identical(implZone, _ROOT_ZONE))) 5280 if (dart.notNull(core.identical(implZone, _ROOT_ZONE))) return null;
5406 return null;
5407 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega te(implZone), zone, error, stackTrace), AsyncError); 5281 return dart.as(dart.dcall(implementation.function, implZone, _parentDelega te(implZone), zone, error, stackTrace), AsyncError);
5408 } 5282 }
5409 scheduleMicrotask(zone, f) { 5283 scheduleMicrotask(zone, f) {
5410 let implementation = this[_delegationTarget][_scheduleMicrotask]; 5284 let implementation = this[_delegationTarget][_scheduleMicrotask];
5411 let implZone = implementation.zone; 5285 let implZone = implementation.zone;
5412 dart.dcall(implementation.function, implZone, _parentDelegate(implZone), z one, f); 5286 dart.dcall(implementation.function, implZone, _parentDelegate(implZone), z one, f);
5413 } 5287 }
5414 createTimer(zone, duration, f) { 5288 createTimer(zone, duration, f) {
5415 let implementation = this[_delegationTarget][_createTimer]; 5289 let implementation = this[_delegationTarget][_createTimer];
5416 let implZone = implementation.zone; 5290 let implZone = implementation.zone;
(...skipping 30 matching lines...) Expand all
5447 scheduleMicrotask: [dart.void, [Zone, dart.functionType(dart.dynamic, [])] ], 5321 scheduleMicrotask: [dart.void, [Zone, dart.functionType(dart.dynamic, [])] ],
5448 createTimer: [Timer, [Zone, core.Duration, dart.functionType(dart.void, [] )]], 5322 createTimer: [Timer, [Zone, core.Duration, dart.functionType(dart.void, [] )]],
5449 createPeriodicTimer: [Timer, [Zone, core.Duration, dart.functionType(dart. void, [Timer])]], 5323 createPeriodicTimer: [Timer, [Zone, core.Duration, dart.functionType(dart. void, [Timer])]],
5450 print: [dart.void, [Zone, core.String]], 5324 print: [dart.void, [Zone, core.String]],
5451 fork: [Zone, [Zone, ZoneSpecification, core.Map]] 5325 fork: [Zone, [Zone, ZoneSpecification, core.Map]]
5452 }) 5326 })
5453 }); 5327 });
5454 const _delegateCache = Symbol('_delegateCache'); 5328 const _delegateCache = Symbol('_delegateCache');
5455 class _CustomZone extends _Zone { 5329 class _CustomZone extends _Zone {
5456 get [_delegate]() { 5330 get [_delegate]() {
5457 if (this[_delegateCache] != null) 5331 if (this[_delegateCache] != null) return this[_delegateCache];
5458 return this[_delegateCache];
5459 this[_delegateCache] = new _ZoneDelegate(this); 5332 this[_delegateCache] = new _ZoneDelegate(this);
5460 return this[_delegateCache]; 5333 return this[_delegateCache];
5461 } 5334 }
5462 _CustomZone(parent, specification, map) { 5335 _CustomZone(parent, specification, map) {
5463 this.parent = parent; 5336 this.parent = parent;
5464 this[_map] = map; 5337 this[_map] = map;
5465 this[_runUnary] = null; 5338 this[_runUnary] = null;
5466 this[_run] = null; 5339 this[_run] = null;
5467 this[_runBinary] = null; 5340 this[_runBinary] = null;
5468 this[_registerCallback] = null; 5341 this[_registerCallback] = null;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
5543 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true; 5416 let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
5544 let registered = this.registerBinaryCallback(f); 5417 let registered = this.registerBinaryCallback(f);
5545 if (dart.notNull(runGuarded)) { 5418 if (dart.notNull(runGuarded)) {
5546 return dart.fn(((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).bind(this)); 5419 return dart.fn(((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).bind(this));
5547 } else { 5420 } else {
5548 return dart.fn(((arg1, arg2) => this.runBinary(registered, arg1, arg2)). bind(this)); 5421 return dart.fn(((arg1, arg2) => this.runBinary(registered, arg1, arg2)). bind(this));
5549 } 5422 }
5550 } 5423 }
5551 get(key) { 5424 get(key) {
5552 let result = this[_map].get(key); 5425 let result = this[_map].get(key);
5553 if (result != null || dart.notNull(this[_map].containsKey(key))) 5426 if (result != null || dart.notNull(this[_map].containsKey(key))) return re sult;
5554 return result;
5555 if (this.parent != null) { 5427 if (this.parent != null) {
5556 let value = this.parent.get(key); 5428 let value = this.parent.get(key);
5557 if (value != null) { 5429 if (value != null) {
5558 this[_map].set(key, value); 5430 this[_map].set(key, value);
5559 } 5431 }
5560 return value; 5432 return value;
5561 } 5433 }
5562 dart.assert(dart.equals(this, _ROOT_ZONE)); 5434 dart.assert(dart.equals(this, _ROOT_ZONE));
5563 return null; 5435 return null;
5564 } 5436 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
5609 registerBinaryCallback(f) { 5481 registerBinaryCallback(f) {
5610 let implementation = this[_registerBinaryCallback]; 5482 let implementation = this[_registerBinaryCallback];
5611 dart.assert(implementation != null); 5483 dart.assert(implementation != null);
5612 let parentDelegate = _parentDelegate(implementation.zone); 5484 let parentDelegate = _parentDelegate(implementation.zone);
5613 return dart.as(dart.dcall(implementation.function, implementation.zone, pa rentDelegate, this, f), ZoneBinaryCallback); 5485 return dart.as(dart.dcall(implementation.function, implementation.zone, pa rentDelegate, this, f), ZoneBinaryCallback);
5614 } 5486 }
5615 errorCallback(error, stackTrace) { 5487 errorCallback(error, stackTrace) {
5616 let implementation = this[_errorCallback]; 5488 let implementation = this[_errorCallback];
5617 dart.assert(implementation != null); 5489 dart.assert(implementation != null);
5618 let implementationZone = implementation.zone; 5490 let implementationZone = implementation.zone;
5619 if (dart.notNull(core.identical(implementationZone, _ROOT_ZONE))) 5491 if (dart.notNull(core.identical(implementationZone, _ROOT_ZONE))) return n ull;
5620 return null;
5621 let parentDelegate = _parentDelegate(dart.as(implementationZone, _Zone)); 5492 let parentDelegate = _parentDelegate(dart.as(implementationZone, _Zone));
5622 return dart.as(dart.dcall(implementation.function, implementationZone, par entDelegate, this, error, stackTrace), AsyncError); 5493 return dart.as(dart.dcall(implementation.function, implementationZone, par entDelegate, this, error, stackTrace), AsyncError);
5623 } 5494 }
5624 scheduleMicrotask(f) { 5495 scheduleMicrotask(f) {
5625 let implementation = this[_scheduleMicrotask]; 5496 let implementation = this[_scheduleMicrotask];
5626 dart.assert(implementation != null); 5497 dart.assert(implementation != null);
5627 let parentDelegate = _parentDelegate(implementation.zone); 5498 let parentDelegate = _parentDelegate(implementation.zone);
5628 return dart.dcall(implementation.function, implementation.zone, parentDele gate, this, f); 5499 return dart.dcall(implementation.function, implementation.zone, parentDele gate, this, f);
5629 } 5500 }
5630 createTimer(duration, f) { 5501 createTimer(duration, f) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 print: [dart.void, [core.String]] 5542 print: [dart.void, [core.String]]
5672 }) 5543 })
5673 }); 5544 });
5674 function _rootHandleUncaughtError(self, parent, zone, error, stackTrace) { 5545 function _rootHandleUncaughtError(self, parent, zone, error, stackTrace) {
5675 _schedulePriorityAsyncCallback(dart.fn(() => { 5546 _schedulePriorityAsyncCallback(dart.fn(() => {
5676 dart.throw(new _UncaughtAsyncError(error, stackTrace)); 5547 dart.throw(new _UncaughtAsyncError(error, stackTrace));
5677 })); 5548 }));
5678 } 5549 }
5679 dart.fn(_rootHandleUncaughtError, dart.void, [Zone, ZoneDelegate, Zone, dart.d ynamic, core.StackTrace]); 5550 dart.fn(_rootHandleUncaughtError, dart.void, [Zone, ZoneDelegate, Zone, dart.d ynamic, core.StackTrace]);
5680 function _rootRun(self, parent, zone, f) { 5551 function _rootRun(self, parent, zone, f) {
5681 if (dart.equals(Zone._current, zone)) 5552 if (dart.equals(Zone._current, zone)) return f();
5682 return f();
5683 let old = Zone._enter(zone); 5553 let old = Zone._enter(zone);
5684 try { 5554 try {
5685 return f(); 5555 return f();
5686 } finally { 5556 } finally {
5687 Zone._leave(old); 5557 Zone._leave(old);
5688 } 5558 }
5689 } 5559 }
5690 dart.fn(_rootRun, dart.dynamic, [Zone, ZoneDelegate, Zone, dart.functionType(d art.dynamic, [])]); 5560 dart.fn(_rootRun, dart.dynamic, [Zone, ZoneDelegate, Zone, dart.functionType(d art.dynamic, [])]);
5691 function _rootRunUnary(self, parent, zone, f, arg) { 5561 function _rootRunUnary(self, parent, zone, f, arg) {
5692 if (dart.equals(Zone._current, zone)) 5562 if (dart.equals(Zone._current, zone)) return dart.dcall(f, arg);
5693 return dart.dcall(f, arg);
5694 let old = Zone._enter(zone); 5563 let old = Zone._enter(zone);
5695 try { 5564 try {
5696 return dart.dcall(f, arg); 5565 return dart.dcall(f, arg);
5697 } finally { 5566 } finally {
5698 Zone._leave(old); 5567 Zone._leave(old);
5699 } 5568 }
5700 } 5569 }
5701 dart.fn(_rootRunUnary, dart.dynamic, [Zone, ZoneDelegate, Zone, dart.functionT ype(dart.dynamic, [dart.dynamic]), dart.dynamic]); 5570 dart.fn(_rootRunUnary, dart.dynamic, [Zone, ZoneDelegate, Zone, dart.functionT ype(dart.dynamic, [dart.dynamic]), dart.dynamic]);
5702 function _rootRunBinary(self, parent, zone, f, arg1, arg2) { 5571 function _rootRunBinary(self, parent, zone, f, arg1, arg2) {
5703 if (dart.equals(Zone._current, zone)) 5572 if (dart.equals(Zone._current, zone)) return dart.dcall(f, arg1, arg2);
5704 return dart.dcall(f, arg1, arg2);
5705 let old = Zone._enter(zone); 5573 let old = Zone._enter(zone);
5706 try { 5574 try {
5707 return dart.dcall(f, arg1, arg2); 5575 return dart.dcall(f, arg1, arg2);
5708 } finally { 5576 } finally {
5709 Zone._leave(old); 5577 Zone._leave(old);
5710 } 5578 }
5711 } 5579 }
5712 dart.fn(_rootRunBinary, dart.dynamic, [Zone, ZoneDelegate, Zone, dart.function Type(dart.dynamic, [dart.dynamic, dart.dynamic]), dart.dynamic, dart.dynamic]); 5580 dart.fn(_rootRunBinary, dart.dynamic, [Zone, ZoneDelegate, Zone, dart.function Type(dart.dynamic, [dart.dynamic, dart.dynamic]), dart.dynamic, dart.dynamic]);
5713 function _rootRegisterCallback(self, parent, zone, f) { 5581 function _rootRegisterCallback(self, parent, zone, f) {
5714 return f; 5582 return f;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
5911 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5779 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5912 exports.CreateTimerHandler = CreateTimerHandler; 5780 exports.CreateTimerHandler = CreateTimerHandler;
5913 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5781 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5914 exports.PrintHandler = PrintHandler; 5782 exports.PrintHandler = PrintHandler;
5915 exports.ForkHandler = ForkHandler; 5783 exports.ForkHandler = ForkHandler;
5916 exports.ZoneSpecification = ZoneSpecification; 5784 exports.ZoneSpecification = ZoneSpecification;
5917 exports.ZoneDelegate = ZoneDelegate; 5785 exports.ZoneDelegate = ZoneDelegate;
5918 exports.Zone = Zone; 5786 exports.Zone = Zone;
5919 exports.runZoned = runZoned; 5787 exports.runZoned = runZoned;
5920 }); 5788 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_utils.js ('k') | lib/runtime/dart/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698