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

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

Issue 1100633006: Generate static calls for Object fields and methods (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Better static dispatch check Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var async; 1 var async;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic
5 function _invokeErrorHandler(errorHandler, error, stackTrace) { 5 function _invokeErrorHandler(errorHandler, error, stackTrace) {
6 if (dart.is(errorHandler, ZoneBinaryCallback)) { 6 if (dart.is(errorHandler, ZoneBinaryCallback)) {
7 return dart.dcall(errorHandler, error, stackTrace); 7 return dart.dcall(errorHandler, error, stackTrace);
8 } else { 8 } else {
9 return dart.dcall(errorHandler, error); 9 return dart.dcall(errorHandler, error);
10 } 10 }
11 } 11 }
12 // Function _registerErrorHandler: (Function, Zone) → Function 12 // Function _registerErrorHandler: (Function, Zone) → Function
13 function _registerErrorHandler(errorHandler, zone) { 13 function _registerErrorHandler(errorHandler, zone) {
14 if (dart.is(errorHandler, ZoneBinaryCallback)) { 14 if (dart.is(errorHandler, ZoneBinaryCallback)) {
15 return zone.registerBinaryCallback(errorHandler); 15 return zone.registerBinaryCallback(errorHandler);
16 } else { 16 } else {
17 return zone.registerUnaryCallback(dart.as(errorHandler, __CastType0)); 17 return zone.registerUnaryCallback(dart.as(errorHandler, __CastType0));
18 } 18 }
19 } 19 }
20 let _getBestStackTrace = Symbol('_getBestStackTrace'); 20 let _getBestStackTrace = Symbol('_getBestStackTrace');
21 class AsyncError extends core.Object { 21 class AsyncError extends core.Object {
22 AsyncError(error, stackTrace) { 22 AsyncError(error, stackTrace) {
23 this.error = error; 23 this.error = error;
24 this.stackTrace = stackTrace; 24 this.stackTrace = stackTrace;
25 } 25 }
26 toString() { 26 toString() {
27 return this.error.toString(); 27 return dart.toString(this.error);
28 } 28 }
29 } 29 }
30 AsyncError[dart.implements] = () => [core.Error]; 30 AsyncError[dart.implements] = () => [core.Error];
31 class _UncaughtAsyncError extends AsyncError { 31 class _UncaughtAsyncError extends AsyncError {
32 _UncaughtAsyncError(error, stackTrace) { 32 _UncaughtAsyncError(error, stackTrace) {
33 super.AsyncError(error, _UncaughtAsyncError[_getBestStackTrace](error, sta ckTrace)); 33 super.AsyncError(error, _UncaughtAsyncError[_getBestStackTrace](error, sta ckTrace));
34 } 34 }
35 static [_getBestStackTrace](error, stackTrace) { 35 static [_getBestStackTrace](error, stackTrace) {
36 if (stackTrace != null) 36 if (stackTrace != null)
37 return stackTrace; 37 return stackTrace;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } catch (e) { 333 } catch (e) {
334 let s = dart.stackTrace(e); 334 let s = dart.stackTrace(e);
335 _cancelAndErrorWithReplacement(subscription, result, e, s); 335 _cancelAndErrorWithReplacement(subscription, result, e, s);
336 } 336 }
337 337
338 }, { 338 }, {
339 onError: e => { 339 onError: e => {
340 result[_completeError](e); 340 result[_completeError](e);
341 }, 341 },
342 onDone: () => { 342 onDone: () => {
343 result[_complete](buffer.toString()); 343 result[_complete](dart.toString(buffer));
344 }, 344 },
345 cancelOnError: true 345 cancelOnError: true
346 }); 346 });
347 return result; 347 return result;
348 } 348 }
349 contains(needle) { 349 contains(needle) {
350 let future = new (_Future$(core.bool))(); 350 let future = new (_Future$(core.bool))();
351 let subscription = null; 351 let subscription = null;
352 subscription = this.listen(element => { 352 subscription = this.listen(element => {
353 _runUserCode(() => dart.equals(element, needle), isMatch => { 353 _runUserCode(() => dart.equals(element, needle), isMatch => {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 let _StreamImpl = _StreamImpl$(); 794 let _StreamImpl = _StreamImpl$();
795 let _ControllerStream$ = dart.generic(function(T) { 795 let _ControllerStream$ = dart.generic(function(T) {
796 class _ControllerStream extends _StreamImpl$(T) { 796 class _ControllerStream extends _StreamImpl$(T) {
797 _ControllerStream(controller) { 797 _ControllerStream(controller) {
798 this[_controller] = controller; 798 this[_controller] = controller;
799 } 799 }
800 [_createSubscription](onData, onError, onDone, cancelOnError) { 800 [_createSubscription](onData, onError, onDone, cancelOnError) {
801 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr ror); 801 return this[_controller][_subscribe](onData, onError, onDone, cancelOnEr ror);
802 } 802 }
803 get hashCode() { 803 get hashCode() {
804 return dart.notNull(this[_controller].hashCode) ^ 892482866; 804 return dart.notNull(dart.hashCode(this[_controller])) ^ 892482866;
805 } 805 }
806 ['=='](other) { 806 ['=='](other) {
807 if (core.identical(this, other)) 807 if (core.identical(this, other))
808 return true; 808 return true;
809 if (!dart.is(other, _ControllerStream)) 809 if (!dart.is(other, _ControllerStream))
810 return false; 810 return false;
811 let otherStream = dart.as(other, _ControllerStream); 811 let otherStream = dart.as(other, _ControllerStream);
812 return core.identical(otherStream[_controller], this[_controller]); 812 return core.identical(otherStream[_controller], this[_controller]);
813 } 813 }
814 } 814 }
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 class DeferredLoadException extends core.Object { 1670 class DeferredLoadException extends core.Object {
1671 DeferredLoadException(s) { 1671 DeferredLoadException(s) {
1672 this[_s] = s; 1672 this[_s] = s;
1673 } 1673 }
1674 toString() { 1674 toString() {
1675 return `DeferredLoadException: '${this[_s]}'`; 1675 return `DeferredLoadException: '${this[_s]}'`;
1676 } 1676 }
1677 } 1677 }
1678 DeferredLoadException[dart.implements] = () => [core.Exception]; 1678 DeferredLoadException[dart.implements] = () => [core.Exception];
1679 let _completeWithValue = Symbol('_completeWithValue'); 1679 let _completeWithValue = Symbol('_completeWithValue');
1680 let _nullFuture = Symbol('_nullFuture');
1680 let Future$ = dart.generic(function(T) { 1681 let Future$ = dart.generic(function(T) {
1681 class Future extends core.Object { 1682 class Future extends core.Object {
1682 Future(computation) { 1683 Future(computation) {
1683 let result = new (_Future$(T))(); 1684 let result = new (_Future$(T))();
1684 Timer.run(() => { 1685 Timer.run(() => {
1685 try { 1686 try {
1686 result[_complete](computation()); 1687 result[_complete](computation());
1687 } catch (e) { 1688 } catch (e) {
1688 let s = dart.stackTrace(e); 1689 let s = dart.stackTrace(e);
1689 _completeWithErrorCallback(result, e, s); 1690 _completeWithErrorCallback(result, e, s);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 dart.dcall(nextIteration, true); 1830 dart.dcall(nextIteration, true);
1830 return doneSignal; 1831 return doneSignal;
1831 } 1832 }
1832 } 1833 }
1833 dart.defineNamedConstructor(Future, 'microtask'); 1834 dart.defineNamedConstructor(Future, 'microtask');
1834 dart.defineNamedConstructor(Future, 'sync'); 1835 dart.defineNamedConstructor(Future, 'sync');
1835 dart.defineNamedConstructor(Future, 'value'); 1836 dart.defineNamedConstructor(Future, 'value');
1836 dart.defineNamedConstructor(Future, 'error'); 1837 dart.defineNamedConstructor(Future, 'error');
1837 dart.defineNamedConstructor(Future, 'delayed'); 1838 dart.defineNamedConstructor(Future, 'delayed');
1838 dart.defineLazyProperties(Future, { 1839 dart.defineLazyProperties(Future, {
1839 get _nullFuture() { 1840 get [_nullFuture]() {
1840 return new Future.value(null); 1841 return new Future.value(null);
1841 } 1842 }
1842 }); 1843 });
1843 return Future; 1844 return Future;
1844 }); 1845 });
1845 let Future = Future$(); 1846 let Future = Future$();
1846 class TimeoutException extends core.Object { 1847 class TimeoutException extends core.Object {
1847 TimeoutException(message, duration) { 1848 TimeoutException(message, duration) {
1848 if (duration === void 0) 1849 if (duration === void 0)
1849 duration = null; 1850 duration = null;
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 }); 2768 });
2768 let _StreamControllerLifecycle = _StreamControllerLifecycle$(); 2769 let _StreamControllerLifecycle = _StreamControllerLifecycle$();
2769 let _varData = Symbol('_varData'); 2770 let _varData = Symbol('_varData');
2770 let _STATE_SUBSCRIBED = Symbol('_STATE_SUBSCRIBED'); 2771 let _STATE_SUBSCRIBED = Symbol('_STATE_SUBSCRIBED');
2771 let _isInitialState = Symbol('_isInitialState'); 2772 let _isInitialState = Symbol('_isInitialState');
2772 let _STATE_SUBSCRIPTION_MASK = Symbol('_STATE_SUBSCRIPTION_MASK'); 2773 let _STATE_SUBSCRIPTION_MASK = Symbol('_STATE_SUBSCRIPTION_MASK');
2773 let _subscription = Symbol('_subscription'); 2774 let _subscription = Symbol('_subscription');
2774 let _pendingEvents = Symbol('_pendingEvents'); 2775 let _pendingEvents = Symbol('_pendingEvents');
2775 let _ensurePendingEvents = Symbol('_ensurePendingEvents'); 2776 let _ensurePendingEvents = Symbol('_ensurePendingEvents');
2776 let _badEventState = Symbol('_badEventState'); 2777 let _badEventState = Symbol('_badEventState');
2777 let _nullFuture = Symbol('_nullFuture');
2778 let _StreamController$ = dart.generic(function(T) { 2778 let _StreamController$ = dart.generic(function(T) {
2779 class _StreamController extends core.Object { 2779 class _StreamController extends core.Object {
2780 _StreamController() { 2780 _StreamController() {
2781 this[_varData] = null; 2781 this[_varData] = null;
2782 this[_state] = _StreamController[_STATE_INITIAL]; 2782 this[_state] = _StreamController[_STATE_INITIAL];
2783 this[_doneFuture] = null; 2783 this[_doneFuture] = null;
2784 } 2784 }
2785 get stream() { 2785 get stream() {
2786 return new (_ControllerStream$(T))(this); 2786 return new (_ControllerStream$(T))(this);
2787 } 2787 }
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 } 4111 }
4112 4112
4113 if (!dart.notNull(isEqual)) { 4113 if (!dart.notNull(isEqual)) {
4114 sink[_add](inputEvent); 4114 sink[_add](inputEvent);
4115 this[_previous] = inputEvent; 4115 this[_previous] = inputEvent;
4116 } 4116 }
4117 } 4117 }
4118 } 4118 }
4119 } 4119 }
4120 dart.defineLazyProperties(_DistinctStream, { 4120 dart.defineLazyProperties(_DistinctStream, {
4121 get _SENTINEL() { 4121 get [_SENTINEL]() {
4122 return new core.Object(); 4122 return new core.Object();
4123 }, 4123 },
4124 set _SENTINEL(_) {} 4124 set [_SENTINEL](_) {}
4125 }); 4125 });
4126 return _DistinctStream; 4126 return _DistinctStream;
4127 }); 4127 });
4128 let _DistinctStream = _DistinctStream$(); 4128 let _DistinctStream = _DistinctStream$();
4129 let _EventSinkWrapper$ = dart.generic(function(T) { 4129 let _EventSinkWrapper$ = dart.generic(function(T) {
4130 class _EventSinkWrapper extends core.Object { 4130 class _EventSinkWrapper extends core.Object {
4131 _EventSinkWrapper(sink) { 4131 _EventSinkWrapper(sink) {
4132 this[_sink] = sink; 4132 this[_sink] = sink;
4133 } 4133 }
4134 add(data) { 4134 add(data) {
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 } 5138 }
5139 createPeriodicTimer(duration, f) { 5139 createPeriodicTimer(duration, f) {
5140 return Timer[_createPeriodicTimer](duration, f); 5140 return Timer[_createPeriodicTimer](duration, f);
5141 } 5141 }
5142 print(line) { 5142 print(line) {
5143 _internal.printToConsole(line); 5143 _internal.printToConsole(line);
5144 } 5144 }
5145 } 5145 }
5146 _RootZone._rootDelegate = null; 5146 _RootZone._rootDelegate = null;
5147 dart.defineLazyProperties(_RootZone, { 5147 dart.defineLazyProperties(_RootZone, {
5148 get _rootMap() { 5148 get [_rootMap]() {
5149 return new collection.HashMap(); 5149 return new collection.HashMap();
5150 }, 5150 },
5151 set _rootMap(_) {} 5151 set [_rootMap](_) {}
5152 }); 5152 });
5153 let _ROOT_ZONE = dart.const(new _RootZone()); 5153 let _ROOT_ZONE = dart.const(new _RootZone());
5154 // Function runZoned: (() → dynamic, {zoneValues: Map<dynamic, dynamic>, zoneS pecification: ZoneSpecification, onError: Function}) → dynamic 5154 // Function runZoned: (() → dynamic, {zoneValues: Map<dynamic, dynamic>, zoneS pecification: ZoneSpecification, onError: Function}) → dynamic
5155 function runZoned(body, opts) { 5155 function runZoned(body, opts) {
5156 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; 5156 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null;
5157 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci fication : null; 5157 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci fication : null;
5158 let onError = opts && 'onError' in opts ? opts.onError : null; 5158 let onError = opts && 'onError' in opts ? opts.onError : null;
5159 let errorHandler = null; 5159 let errorHandler = null;
5160 if (onError != null) { 5160 if (onError != null) {
5161 errorHandler = (self, parent, zone, error, stackTrace) => { 5161 errorHandler = (self, parent, zone, error, stackTrace) => {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
5250 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5250 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5251 exports.CreateTimerHandler = CreateTimerHandler; 5251 exports.CreateTimerHandler = CreateTimerHandler;
5252 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5252 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5253 exports.PrintHandler = PrintHandler; 5253 exports.PrintHandler = PrintHandler;
5254 exports.ForkHandler = ForkHandler; 5254 exports.ForkHandler = ForkHandler;
5255 exports.ZoneSpecification = ZoneSpecification; 5255 exports.ZoneSpecification = ZoneSpecification;
5256 exports.ZoneDelegate = ZoneDelegate; 5256 exports.ZoneDelegate = ZoneDelegate;
5257 exports.Zone = Zone; 5257 exports.Zone = Zone;
5258 exports.runZoned = runZoned; 5258 exports.runZoned = runZoned;
5259 })(async || (async = {})); 5259 })(async || (async = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698