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

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

Issue 1487213002: Special-case top-level final JS fields. (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/_js_mirrors.js ('k') | lib/src/codegen/js_codegen.dart » ('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/js', null, /* Imports */[ 1 dart_library.library('dart/js', null, /* Imports */[
2 "dart/_runtime", 2 "dart/_runtime",
3 'dart/core', 3 'dart/core',
4 'dart/collection', 4 'dart/collection',
5 'dart/_js_helper' 5 'dart/_js_helper'
6 ], /* Lazy imports */[ 6 ], /* Lazy imports */[
7 ], function(exports, dart, core, collection, _js_helper) { 7 ], function(exports, dart, core, collection, _js_helper) {
8 'use strict'; 8 'use strict';
9 let dartx = dart.dartx; 9 let dartx = dart.dartx;
10 dart.defineLazyProperties(exports, { 10 dart.defineLazyProperties(exports, {
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 constructors: () => ({_DartObject: [_DartObject, [dart.dynamic]]}) 328 constructors: () => ({_DartObject: [_DartObject, [dart.dynamic]]})
329 }); 329 });
330 function _convertToJS(o) { 330 function _convertToJS(o) {
331 if (o == null || typeof o == 'string' || typeof o == 'number' || typeof o == 'boolean' || dart.notNull(_isBrowserType(o))) { 331 if (o == null || typeof o == 'string' || typeof o == 'number' || typeof o == 'boolean' || dart.notNull(_isBrowserType(o))) {
332 return o; 332 return o;
333 } else if (dart.is(o, core.DateTime)) { 333 } else if (dart.is(o, core.DateTime)) {
334 return _js_helper.Primitives.lazyAsJsDate(o); 334 return _js_helper.Primitives.lazyAsJsDate(o);
335 } else if (dart.is(o, JsObject)) { 335 } else if (dart.is(o, JsObject)) {
336 return dart.dload(o, _jsObject); 336 return dart.dload(o, _jsObject);
337 } else if (dart.is(o, core.Function)) { 337 } else if (dart.is(o, core.Function)) {
338 return _putIfAbsent(exports._jsProxies, o, _wrapDartFunction); 338 return _putIfAbsent(_jsProxies, o, _wrapDartFunction);
339 } else { 339 } else {
340 return _putIfAbsent(exports._jsProxies, o, dart.fn(o => new _DartObject(o) , _DartObject, [dart.dynamic])); 340 return _putIfAbsent(_jsProxies, o, dart.fn(o => new _DartObject(o), _DartO bject, [dart.dynamic]));
341 } 341 }
342 } 342 }
343 dart.fn(_convertToJS); 343 dart.fn(_convertToJS);
344 function _wrapDartFunction(f) { 344 function _wrapDartFunction(f) {
345 let wrapper = function() { 345 let wrapper = function() {
346 let args = Array.prototype.map.call(arguments, _convertToDart); 346 let args = Array.prototype.map.call(arguments, _convertToDart);
347 return _convertToJS(f(...args)); 347 return _convertToJS(f(...args));
348 }; 348 };
349 dart.dsetindex(exports._dartProxies, wrapper, f); 349 dart.dsetindex(_dartProxies, wrapper, f);
350 return wrapper; 350 return wrapper;
351 } 351 }
352 dart.fn(_wrapDartFunction); 352 dart.fn(_wrapDartFunction);
353 function _convertToDart(o) { 353 function _convertToDart(o) {
354 if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(_isBrowserType(o))) { 354 if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(_isBrowserType(o))) {
355 return o; 355 return o;
356 } else if (o instanceof Date) { 356 } else if (o instanceof Date) {
357 let ms = o.getTime(); 357 let ms = o.getTime();
358 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms)); 358 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms));
359 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType( o)) { 359 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType( o)) {
360 return dart.dload(o, _dartObj); 360 return dart.dload(o, _dartObj);
361 } else { 361 } else {
362 return _putIfAbsent(exports._dartProxies, o, _wrapToDart); 362 return _putIfAbsent(_dartProxies, o, _wrapToDart);
363 } 363 }
364 } 364 }
365 dart.fn(_convertToDart, core.Object, [dart.dynamic]); 365 dart.fn(_convertToDart, core.Object, [dart.dynamic]);
366 function _wrapToDart(o) { 366 function _wrapToDart(o) {
367 if (typeof o == "function") { 367 if (typeof o == "function") {
368 return new JsFunction._fromJs(o); 368 return new JsFunction._fromJs(o);
369 } 369 }
370 if (o instanceof Array) { 370 if (o instanceof Array) {
371 return new JsArray._fromJs(o); 371 return new JsArray._fromJs(o);
372 } 372 }
373 return new JsObject._fromJs(o); 373 return new JsObject._fromJs(o);
374 } 374 }
375 dart.fn(_wrapToDart, JsObject, [dart.dynamic]); 375 dart.fn(_wrapToDart, JsObject, [dart.dynamic]);
376 dart.defineLazyProperties(exports, { 376 const _dartProxies = new WeakMap();
377 get _dartProxies() { 377 const _jsProxies = new WeakMap();
378 return new WeakMap();
379 },
380 get _jsProxies() {
381 return new WeakMap();
382 }
383 });
384 function _putIfAbsent(weakMap, o, getValue) { 378 function _putIfAbsent(weakMap, o, getValue) {
385 let value = weakMap.get(o); 379 let value = weakMap.get(o);
386 if (value == null) { 380 if (value == null) {
387 value = dart.dcall(getValue, o); 381 value = dart.dcall(getValue, o);
388 weakMap.set(o, value); 382 weakMap.set(o, value);
389 } 383 }
390 return value; 384 return value;
391 } 385 }
392 dart.fn(_putIfAbsent, core.Object, [dart.dynamic, dart.dynamic, dart.functionT ype(dart.dynamic, [dart.dynamic])]); 386 dart.fn(_putIfAbsent, core.Object, [dart.dynamic, dart.dynamic, dart.functionT ype(dart.dynamic, [dart.dynamic])]);
393 function allowInterop(f) { 387 function allowInterop(f) {
(...skipping 27 matching lines...) Expand all
421 }); 415 });
422 let __CastType0 = __CastType0$(); 416 let __CastType0 = __CastType0$();
423 // Exports: 417 // Exports:
424 exports.JsObject = JsObject; 418 exports.JsObject = JsObject;
425 exports.JsFunction = JsFunction; 419 exports.JsFunction = JsFunction;
426 exports.JsArray$ = JsArray$; 420 exports.JsArray$ = JsArray$;
427 exports.JsArray = JsArray; 421 exports.JsArray = JsArray;
428 exports.allowInterop = allowInterop; 422 exports.allowInterop = allowInterop;
429 exports.allowInteropCaptureThis = allowInteropCaptureThis; 423 exports.allowInteropCaptureThis = allowInteropCaptureThis;
430 }); 424 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_mirrors.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698