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

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

Issue 1121993004: Inference through conditional expressions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/collection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var async; 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 }
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 } 3200 }
3201 } 3201 }
3202 _StreamSinkWrapper[dart.implements] = () => [StreamSink$(T)]; 3202 _StreamSinkWrapper[dart.implements] = () => [StreamSink$(T)];
3203 return _StreamSinkWrapper; 3203 return _StreamSinkWrapper;
3204 }); 3204 });
3205 let _StreamSinkWrapper = _StreamSinkWrapper$(); 3205 let _StreamSinkWrapper = _StreamSinkWrapper$();
3206 let _AddStreamState$ = dart.generic(function(T) { 3206 let _AddStreamState$ = dart.generic(function(T) {
3207 class _AddStreamState extends core.Object { 3207 class _AddStreamState extends core.Object {
3208 _AddStreamState(controller, source, cancelOnError) { 3208 _AddStreamState(controller, source, cancelOnError) {
3209 this.addStreamFuture = new _Future(); 3209 this.addStreamFuture = new _Future();
3210 this.addSubscription = source.listen(controller[_add].bind(controller), {onError: dart.as(cancelOnError ? _AddStreamState.makeErrorHandler(controller) : controller[_addError].bind(controller), core.Function), onDone: controller[_clo se].bind(controller), cancelOnError: cancelOnError}); 3210 this.addSubscription = source.listen(controller[_add].bind(controller), {onError: cancelOnError ? dart.as(_AddStreamState.makeErrorHandler(controller), core.Function) : controller[_addError].bind(controller), onDone: controller[_clo se].bind(controller), cancelOnError: cancelOnError});
3211 } 3211 }
3212 static makeErrorHandler(controller) { 3212 static makeErrorHandler(controller) {
3213 return (e, s) => { 3213 return (e, s) => {
3214 controller[_addError](e, s); 3214 controller[_addError](e, s);
3215 controller[_close](); 3215 controller[_close]();
3216 }; 3216 };
3217 } 3217 }
3218 pause() { 3218 pause() {
3219 this.addSubscription.pause(); 3219 this.addSubscription.pause();
3220 } 3220 }
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
4584 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; 4584 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null;
4585 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null; 4585 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null;
4586 let registerUnaryCallback = opts && 'registerUnaryCallback' in opts ? opts .registerUnaryCallback : null; 4586 let registerUnaryCallback = opts && 'registerUnaryCallback' in opts ? opts .registerUnaryCallback : null;
4587 let registerBinaryCallback = opts && 'registerBinaryCallback' in opts ? op ts.registerBinaryCallback : null; 4587 let registerBinaryCallback = opts && 'registerBinaryCallback' in opts ? op ts.registerBinaryCallback : null;
4588 let errorCallback = opts && 'errorCallback' in opts ? opts.errorCallback : null; 4588 let errorCallback = opts && 'errorCallback' in opts ? opts.errorCallback : null;
4589 let scheduleMicrotask = opts && 'scheduleMicrotask' in opts ? opts.schedul eMicrotask : null; 4589 let scheduleMicrotask = opts && 'scheduleMicrotask' in opts ? opts.schedul eMicrotask : null;
4590 let createTimer = opts && 'createTimer' in opts ? opts.createTimer : null; 4590 let createTimer = opts && 'createTimer' in opts ? opts.createTimer : null;
4591 let createPeriodicTimer = opts && 'createPeriodicTimer' in opts ? opts.cre atePeriodicTimer : null; 4591 let createPeriodicTimer = opts && 'createPeriodicTimer' in opts ? opts.cre atePeriodicTimer : null;
4592 let print = opts && 'print' in opts ? opts.print : null; 4592 let print = opts && 'print' in opts ? opts.print : null;
4593 let fork = opts && 'fork' in opts ? opts.fork : null; 4593 let fork = opts && 'fork' in opts ? opts.fork : null;
4594 return new ZoneSpecification({handleUncaughtError: dart.as(handleUncaughtE rror != null ? handleUncaughtError : other.handleUncaughtError, __CastType38), r un: dart.as(run != null ? run : other.run, __CastType44), runUnary: dart.as(runU nary != null ? runUnary : other.runUnary, __CastType49), runBinary: dart.as(runB inary != null ? runBinary : other.runBinary, __CastType56), registerCallback: da rt.as(registerCallback != null ? registerCallback : other.registerCallback, __Ca stType65), registerUnaryCallback: dart.as(registerUnaryCallback != null ? regist erUnaryCallback : other.registerUnaryCallback, __CastType70), registerBinaryCall back: dart.as(registerBinaryCallback != null ? registerBinaryCallback : other.re gisterBinaryCallback, __CastType76), errorCallback: dart.as(errorCallback != nul l ? errorCallback : other.errorCallback, __CastType83), scheduleMicrotask: dart. as(scheduleMicrotask != null ? scheduleMicrotask : other.scheduleMicrotask, __Ca stType89), createTimer: dart.as(createTimer != null ? createTimer : other.create Timer, __CastType94), createPeriodicTimer: dart.as(createPeriodicTimer != null ? createPeriodicTimer : other.createPeriodicTimer, __CastType100), print: dart.as (print != null ? print : other.print, __CastType107), fork: dart.as(fork != null ? fork : other.fork, __CastType112)}); 4594 return new ZoneSpecification({handleUncaughtError: handleUncaughtError != null ? handleUncaughtError : other.handleUncaughtError, run: run != null ? run : other.run, runUnary: runUnary != null ? runUnary : other.runUnary, runBinary: r unBinary != null ? runBinary : other.runBinary, registerCallback: registerCallba ck != null ? registerCallback : other.registerCallback, registerUnaryCallback: r egisterUnaryCallback != null ? registerUnaryCallback : other.registerUnaryCallba ck, registerBinaryCallback: registerBinaryCallback != null ? registerBinaryCallb ack : other.registerBinaryCallback, errorCallback: errorCallback != null ? error Callback : other.errorCallback, scheduleMicrotask: scheduleMicrotask != null ? s cheduleMicrotask : other.scheduleMicrotask, createTimer: createTimer != null ? c reateTimer : other.createTimer, createPeriodicTimer: createPeriodicTimer != null ? createPeriodicTimer : other.createPeriodicTimer, print: print != null ? print : other.print, fork: fork != null ? fork : other.fork});
4595 } 4595 }
4596 } 4596 }
4597 dart.defineNamedConstructor(ZoneSpecification, 'from'); 4597 dart.defineNamedConstructor(ZoneSpecification, 'from');
4598 class _ZoneSpecification extends core.Object { 4598 class _ZoneSpecification extends core.Object {
4599 _ZoneSpecification(opts) { 4599 _ZoneSpecification(opts) {
4600 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han dleUncaughtError : null; 4600 let handleUncaughtError = opts && 'handleUncaughtError' in opts ? opts.han dleUncaughtError : null;
4601 let run = opts && 'run' in opts ? opts.run : null; 4601 let run = opts && 'run' in opts ? opts.run : null;
4602 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null; 4602 let runUnary = opts && 'runUnary' in opts ? opts.runUnary : null;
4603 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null; 4603 let runBinary = opts && 'runBinary' in opts ? opts.runBinary : null;
4604 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null; 4604 let registerCallback = opts && 'registerCallback' in opts ? opts.registerC allback : null;
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
5012 // Function _rootCreateTimer: (Zone, ZoneDelegate, Zone, Duration, () → void) → Timer 5012 // Function _rootCreateTimer: (Zone, ZoneDelegate, Zone, Duration, () → void) → Timer
5013 function _rootCreateTimer(self, parent, zone, duration, callback) { 5013 function _rootCreateTimer(self, parent, zone, duration, callback) {
5014 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) { 5014 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) {
5015 callback = zone.bindCallback(callback); 5015 callback = zone.bindCallback(callback);
5016 } 5016 }
5017 return Timer._createTimer(duration, callback); 5017 return Timer._createTimer(duration, callback);
5018 } 5018 }
5019 // Function _rootCreatePeriodicTimer: (Zone, ZoneDelegate, Zone, Duration, (Ti mer) → void) → Timer 5019 // Function _rootCreatePeriodicTimer: (Zone, ZoneDelegate, Zone, Duration, (Ti mer) → void) → Timer
5020 function _rootCreatePeriodicTimer(self, parent, zone, duration, callback) { 5020 function _rootCreatePeriodicTimer(self, parent, zone, duration, callback) {
5021 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) { 5021 if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) {
5022 callback = dart.as(zone.bindUnaryCallback(callback), __CastType118); 5022 callback = dart.as(zone.bindUnaryCallback(callback), __CastType38);
5023 } 5023 }
5024 return Timer._createPeriodicTimer(duration, callback); 5024 return Timer._createPeriodicTimer(duration, callback);
5025 } 5025 }
5026 // Function _rootPrint: (Zone, ZoneDelegate, Zone, String) → void 5026 // Function _rootPrint: (Zone, ZoneDelegate, Zone, String) → void
5027 function _rootPrint(self, parent, zone, line) { 5027 function _rootPrint(self, parent, zone, line) {
5028 _internal.printToConsole(line); 5028 _internal.printToConsole(line);
5029 } 5029 }
5030 // Function _printToZone: (String) → void 5030 // Function _printToZone: (String) → void
5031 function _printToZone(line) { 5031 function _printToZone(line) {
5032 Zone.current.print(line); 5032 Zone.current.print(line);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
5274 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null; 5274 let zoneValues = opts && 'zoneValues' in opts ? opts.zoneValues : null;
5275 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci fication : null; 5275 let zoneSpecification = opts && 'zoneSpecification' in opts ? opts.zoneSpeci fication : null;
5276 let onError = opts && 'onError' in opts ? opts.onError : null; 5276 let onError = opts && 'onError' in opts ? opts.onError : null;
5277 let errorHandler = null; 5277 let errorHandler = null;
5278 if (onError != null) { 5278 if (onError != null) {
5279 errorHandler = (self, parent, zone, error, stackTrace) => { 5279 errorHandler = (self, parent, zone, error, stackTrace) => {
5280 try { 5280 try {
5281 if (dart.is(onError, ZoneBinaryCallback)) { 5281 if (dart.is(onError, ZoneBinaryCallback)) {
5282 return self.parent.runBinary(onError, error, stackTrace); 5282 return self.parent.runBinary(onError, error, stackTrace);
5283 } 5283 }
5284 return self.parent.runUnary(dart.as(onError, __CastType120), error); 5284 return self.parent.runUnary(dart.as(onError, __CastType40), error);
5285 } catch (e) { 5285 } catch (e) {
5286 let s = dart.stackTrace(e); 5286 let s = dart.stackTrace(e);
5287 if (core.identical(e, error)) { 5287 if (core.identical(e, error)) {
5288 return parent.handleUncaughtError(zone, error, stackTrace); 5288 return parent.handleUncaughtError(zone, error, stackTrace);
5289 } else { 5289 } else {
5290 return parent.handleUncaughtError(zone, e, s); 5290 return parent.handleUncaughtError(zone, e, s);
5291 } 5291 }
5292 } 5292 }
5293 5293
5294 }; 5294 };
5295 } 5295 }
5296 if (zoneSpecification == null) { 5296 if (zoneSpecification == null) {
5297 zoneSpecification = new ZoneSpecification({handleUncaughtError: errorHandl er}); 5297 zoneSpecification = new ZoneSpecification({handleUncaughtError: errorHandl er});
5298 } else if (errorHandler != null) { 5298 } else if (errorHandler != null) {
5299 zoneSpecification = new ZoneSpecification.from(zoneSpecification, {handleU ncaughtError: errorHandler}); 5299 zoneSpecification = new ZoneSpecification.from(zoneSpecification, {handleU ncaughtError: errorHandler});
5300 } 5300 }
5301 let zone = Zone.current.fork({specification: zoneSpecification, zoneValues: zoneValues}); 5301 let zone = Zone.current.fork({specification: zoneSpecification, zoneValues: zoneValues});
5302 if (onError != null) { 5302 if (onError != null) {
5303 return zone.runGuarded(body); 5303 return zone.runGuarded(body);
5304 } else { 5304 } else {
5305 return zone.run(body); 5305 return zone.run(body);
5306 } 5306 }
5307 } 5307 }
5308 let __CastType38 = dart.typedef('__CastType38', () => dart.functionType(dart.d ynamic, [Zone, ZoneDelegate, Zone, dart.dynamic, core.StackTrace])); 5308 let __CastType38 = dart.typedef('__CastType38', () => dart.functionType(dart.v oid, [Timer]));
5309 let __CastType44 = dart.typedef('__CastType44', () => dart.functionType(dart.d ynamic, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [])])); 5309 let __CastType40 = dart.typedef('__CastType40', () => dart.functionType(dart.d ynamic, [dart.dynamic]));
5310 let __CastType49 = dart.typedef('__CastType49', () => dart.functionType(dart.d ynamic, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [dart.dynamic ]), dart.dynamic]));
5311 let __CastType56 = dart.typedef('__CastType56', () => dart.functionType(dart.d ynamic, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [dart.dynamic , dart.dynamic]), dart.dynamic, dart.dynamic]));
5312 let __CastType65 = dart.typedef('__CastType65', () => dart.functionType(ZoneCa llback, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [])]));
5313 let __CastType70 = dart.typedef('__CastType70', () => dart.functionType(ZoneUn aryCallback, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [dart.dy namic])]));
5314 let __CastType76 = dart.typedef('__CastType76', () => dart.functionType(ZoneBi naryCallback, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [dart.d ynamic, dart.dynamic])]));
5315 let __CastType83 = dart.typedef('__CastType83', () => dart.functionType(AsyncE rror, [Zone, ZoneDelegate, Zone, core.Object, core.StackTrace]));
5316 let __CastType89 = dart.typedef('__CastType89', () => dart.functionType(dart.v oid, [Zone, ZoneDelegate, Zone, dart.functionType(dart.dynamic, [])]));
5317 let __CastType94 = dart.typedef('__CastType94', () => dart.functionType(Timer, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.void, [])]));
5318 let __CastType100 = dart.typedef('__CastType100', () => dart.functionType(Time r, [Zone, ZoneDelegate, Zone, core.Duration, dart.functionType(dart.void, [Timer ])]));
5319 let __CastType107 = dart.typedef('__CastType107', () => dart.functionType(dart .void, [Zone, ZoneDelegate, Zone, core.String]));
5320 let __CastType112 = dart.typedef('__CastType112', () => dart.functionType(Zone , [Zone, ZoneDelegate, Zone, ZoneSpecification, core.Map]));
5321 let __CastType118 = dart.typedef('__CastType118', () => dart.functionType(dart .void, [Timer]));
5322 let __CastType120 = dart.typedef('__CastType120', () => dart.functionType(dart .dynamic, [dart.dynamic]));
5323 dart.copyProperties(exports, { 5310 dart.copyProperties(exports, {
5324 get _hasDocument() { 5311 get _hasDocument() {
5325 return typeof document == 'object'; 5312 return typeof document == 'object';
5326 } 5313 }
5327 }); 5314 });
5328 // Exports: 5315 // Exports:
5329 exports.AsyncError = AsyncError; 5316 exports.AsyncError = AsyncError;
5330 exports.Stream$ = Stream$; 5317 exports.Stream$ = Stream$;
5331 exports.Stream = Stream; 5318 exports.Stream = Stream;
5332 exports.DeferredLibrary = DeferredLibrary; 5319 exports.DeferredLibrary = DeferredLibrary;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5368 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler; 5355 exports.ScheduleMicrotaskHandler = ScheduleMicrotaskHandler;
5369 exports.CreateTimerHandler = CreateTimerHandler; 5356 exports.CreateTimerHandler = CreateTimerHandler;
5370 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler; 5357 exports.CreatePeriodicTimerHandler = CreatePeriodicTimerHandler;
5371 exports.PrintHandler = PrintHandler; 5358 exports.PrintHandler = PrintHandler;
5372 exports.ForkHandler = ForkHandler; 5359 exports.ForkHandler = ForkHandler;
5373 exports.ZoneSpecification = ZoneSpecification; 5360 exports.ZoneSpecification = ZoneSpecification;
5374 exports.ZoneDelegate = ZoneDelegate; 5361 exports.ZoneDelegate = ZoneDelegate;
5375 exports.Zone = Zone; 5362 exports.Zone = Zone;
5376 exports.runZoned = runZoned; 5363 exports.runZoned = runZoned;
5377 })(async || (async = {})); 5364 })(async || (async = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698