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

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

Issue 1207313002: initial sync*, part of #221 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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/isolate.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/dart", 2 "dart_runtime/dart",
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 23 matching lines...) Expand all
34 return dart.as(_wrapToDart(_convertToJS(object)), JsObject); 34 return dart.as(_wrapToDart(_convertToJS(object)), JsObject);
35 } 35 }
36 static jsify(object) { 36 static jsify(object) {
37 if (!dart.is(object, core.Map) && !dart.is(object, core.Iterable)) { 37 if (!dart.is(object, core.Map) && !dart.is(object, core.Iterable)) {
38 throw new core.ArgumentError("object must be a Map or Iterable"); 38 throw new core.ArgumentError("object must be a Map or Iterable");
39 } 39 }
40 return dart.as(_wrapToDart(JsObject._convertDataTree(object)), JsObject); 40 return dart.as(_wrapToDart(JsObject._convertDataTree(object)), JsObject);
41 } 41 }
42 static _convertDataTree(data) { 42 static _convertDataTree(data) {
43 let _convertedObjects = collection.HashMap.identity(); 43 let _convertedObjects = collection.HashMap.identity();
44 let _convert = o => { 44 function _convert(o) {
45 if (dart.notNull(_convertedObjects.containsKey(o))) { 45 if (dart.notNull(_convertedObjects.containsKey(o))) {
46 return _convertedObjects.get(o); 46 return _convertedObjects.get(o);
47 } 47 }
48 if (dart.is(o, core.Map)) { 48 if (dart.is(o, core.Map)) {
49 let convertedMap = {}; 49 let convertedMap = {};
50 _convertedObjects.set(o, convertedMap); 50 _convertedObjects.set(o, convertedMap);
51 for (let key of dart.as(dart.dload(o, 'keys'), core.Iterable)) { 51 for (let key of dart.as(dart.dload(o, 'keys'), core.Iterable)) {
52 convertedMap[key] = _convert(dart.dindex(o, key)); 52 convertedMap[key] = _convert(dart.dindex(o, key));
53 } 53 }
54 return convertedMap; 54 return convertedMap;
55 } else if (dart.is(o, core.Iterable)) { 55 } else if (dart.is(o, core.Iterable)) {
56 let convertedList = []; 56 let convertedList = [];
57 _convertedObjects.set(o, convertedList); 57 _convertedObjects.set(o, convertedList);
58 convertedList[dartx.addAll](dart.as(dart.dsend(o, 'map', _convert), co re.Iterable)); 58 convertedList[dartx.addAll](dart.as(dart.dsend(o, 'map', _convert), co re.Iterable));
59 return convertedList; 59 return convertedList;
60 } else { 60 } else {
61 return _convertToJS(o); 61 return _convertToJS(o);
62 } 62 }
63 }; 63 }
64 dart.fn(_convert); 64 dart.fn(_convert);
65 return _convert(data); 65 return _convert(data);
66 } 66 }
67 get(property) { 67 get(property) {
68 if (!(typeof property == 'string') && !dart.is(property, core.num)) { 68 if (!(typeof property == 'string') && !dart.is(property, core.num)) {
69 throw new core.ArgumentError("property is not a String or num"); 69 throw new core.ArgumentError("property is not a String or num");
70 } 70 }
71 return _convertToDart(this[_jsObject][property]); 71 return _convertToDart(this[_jsObject][property]);
72 } 72 }
73 set(property, value) { 73 set(property, value) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d ynamic, [E])); 392 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d ynamic, [E]));
393 return __CastType0; 393 return __CastType0;
394 }); 394 });
395 let __CastType0 = __CastType0$(); 395 let __CastType0 = __CastType0$();
396 // Exports: 396 // Exports:
397 exports.JsObject = JsObject; 397 exports.JsObject = JsObject;
398 exports.JsFunction = JsFunction; 398 exports.JsFunction = JsFunction;
399 exports.JsArray$ = JsArray$; 399 exports.JsArray$ = JsArray$;
400 exports.JsArray = JsArray; 400 exports.JsArray = JsArray;
401 }); 401 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/isolate.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698