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

Side by Side Diff: test/codegen/expect/dart/_js_helper.js

Issue 1010893004: Allow S->T <: dynamic->T (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Add comment Created 5 years, 9 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 _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 let keys = this[_keys]; 93 let keys = this[_keys];
94 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) { 94 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
95 let key = dart.dindex(keys, i); 95 let key = dart.dindex(keys, i);
96 f(dart.as(key, K), dart.as(this[_fetch](key), V)); 96 f(dart.as(key, K), dart.as(this[_fetch](key), V));
97 } 97 }
98 } 98 }
99 get keys() { 99 get keys() {
100 return new _ConstantMapKeyIterable(this); 100 return new _ConstantMapKeyIterable(this);
101 } 101 }
102 get values() { 102 get values() {
103 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[ _fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); 103 return new _internal.MappedIterable(this[_keys], dart.closureWrap(((key) => this[_fetch](key)).bind(this), "(K) → V"));
104 } 104 }
105 } 105 }
106 dart.defineNamedConstructor(ConstantStringMap, '_'); 106 dart.defineNamedConstructor(ConstantStringMap, '_');
107 return ConstantStringMap; 107 return ConstantStringMap;
108 }); 108 });
109 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic); 109 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic);
110 let _protoValue = Symbol('_protoValue'); 110 let _protoValue = Symbol('_protoValue');
111 let ConstantProtoMap$ = dart.generic(function(K, V) { 111 let ConstantProtoMap$ = dart.generic(function(K, V) {
112 class ConstantProtoMap extends ConstantStringMap$(K, V) { 112 class ConstantProtoMap extends ConstantStringMap$(K, V) {
113 ConstantProtoMap$_(length, jsObject, keys, $_protoValue) { 113 ConstantProtoMap$_(length, jsObject, keys, $_protoValue) {
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 hash = Math.random() * 0x3fffffff | 0; 1718 hash = Math.random() * 0x3fffffff | 0;
1719 object.$identityHash = hash; 1719 object.$identityHash = hash;
1720 } 1720 }
1721 return hash; 1721 return hash;
1722 } 1722 }
1723 static [_throwFormatException](string) { 1723 static [_throwFormatException](string) {
1724 throw new core.FormatException(string); 1724 throw new core.FormatException(string);
1725 } 1725 }
1726 static parseInt(source, radix, handleError) { 1726 static parseInt(source, radix, handleError) {
1727 if (handleError === null) 1727 if (handleError === null)
1728 handleError = dart.as(_throwFormatException, dart.throw_("Unimplemented type (String) → int")); 1728 handleError = dart.closureWrap(_throwFormatException, "(String) → int");
1729 checkString(source); 1729 checkString(source);
1730 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ; 1730 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
1731 let digitsIndex = 1; 1731 let digitsIndex = 1;
1732 let hexIndex = 2; 1732 let hexIndex = 2;
1733 let decimalIndex = 3; 1733 let decimalIndex = 3;
1734 let nonDecimalHexIndex = 4; 1734 let nonDecimalHexIndex = 4;
1735 if (radix === null) { 1735 if (radix === null) {
1736 radix = 10; 1736 radix = 10;
1737 if (match !== null) { 1737 if (match !== null) {
1738 if (dart.dindex(match, hexIndex) !== null) { 1738 if (dart.dindex(match, hexIndex) !== null) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 } 1770 }
1771 } 1771 }
1772 } 1772 }
1773 if (match === null) 1773 if (match === null)
1774 return handleError(source); 1774 return handleError(source);
1775 return parseInt(source, radix); 1775 return parseInt(source, radix);
1776 } 1776 }
1777 static parseDouble(source, handleError) { 1777 static parseDouble(source, handleError) {
1778 checkString(source); 1778 checkString(source);
1779 if (handleError === null) 1779 if (handleError === null)
1780 handleError = dart.as(_throwFormatException, dart.throw_("Unimplemented type (String) → double")); 1780 handleError = dart.closureWrap(_throwFormatException, "(String) → double ");
1781 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) { 1781 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) {
1782 return handleError(source); 1782 return handleError(source);
1783 } 1783 }
1784 let result = parseFloat(source); 1784 let result = parseFloat(source);
1785 if (result.isNaN) { 1785 if (result.isNaN) {
1786 let trimmed = source.trim(); 1786 let trimmed = source.trim();
1787 if (dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNull(dart.equal s(trimmed, '+NaN')) || dart.notNull(dart.equals(trimmed, '-NaN'))) { 1787 if (dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNull(dart.equal s(trimmed, '+NaN')) || dart.notNull(dart.equals(trimmed, '-NaN'))) {
1788 return result; 1788 return result;
1789 } 1789 }
1790 return handleError(source); 1790 return handleError(source);
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3608 }); 3608 });
3609 exports.deferredLoadHook = null; 3609 exports.deferredLoadHook = null;
3610 // Function loadDeferredLibrary: (String) → Future<Null> 3610 // Function loadDeferredLibrary: (String) → Future<Null>
3611 function loadDeferredLibrary(loadId) { 3611 function loadDeferredLibrary(loadId) {
3612 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_na mes.DEFERRED_LIBRARY_URIS, core.String)); 3612 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_na mes.DEFERRED_LIBRARY_URIS, core.String));
3613 let uris = dart.as(urisMap[loadId], core.List$(core.String)); 3613 let uris = dart.as(urisMap[loadId], core.List$(core.String));
3614 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_ names.DEFERRED_LIBRARY_HASHES, core.String)); 3614 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_ names.DEFERRED_LIBRARY_HASHES, core.String));
3615 let hashes = dart.as(hashesMap[loadId], core.List$(core.String)); 3615 let hashes = dart.as(hashesMap[loadId], core.List$(core.String));
3616 if (uris === null) 3616 if (uris === null)
3617 return dart.as(new async.Future.value(null), async.Future$(core.Null)); 3617 return dart.as(new async.Future.value(null), async.Future$(core.Null));
3618 let indices = dart.as(new core.List.generate(uris.length, (i) => i), core.Li st$(core.int)); 3618 let indices = dart.as(new core.List.generate(uris.length, dart.closureWrap(( i) => i, "(int) → dynamic")), core.List$(core.int));
3619 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedd ed_names.IS_HUNK_LOADED, core.String)); 3619 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedd ed_names.IS_HUNK_LOADED, core.String));
3620 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_e mbedded_names.IS_HUNK_INITIALIZED, core.String)); 3620 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_e mbedded_names.IS_HUNK_INITIALIZED, core.String));
3621 let indicesToLoad = indices.where((i) => !isHunkLoaded(hashes.get(i))).toLis t(); 3621 let indicesToLoad = indices.where((i) => !isHunkLoaded(hashes.get(i))).toLis t();
3622 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk( uris.get(i))), core.Iterable$(async.Future))).then((_) => { 3622 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk( uris.get(i))), core.Iterable$(async.Future))).then(dart.closureWrap((_) => {
3623 let indicesToInitialize = indices.where((i) => !isHunkInitialized(hashes.g et(i))).toList(); 3623 let indicesToInitialize = indices.where((i) => !isHunkInitialized(hashes.g et(i))).toList();
3624 for (let i of indicesToInitialize) { 3624 for (let i of indicesToInitialize) {
3625 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_emb edded_names.INITIALIZE_LOADED_HUNK, core.String)); 3625 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_emb edded_names.INITIALIZE_LOADED_HUNK, core.String));
3626 initializer(hashes.get(i)); 3626 initializer(hashes.get(i));
3627 } 3627 }
3628 let updated = exports._loadedLibraries.add(loadId); 3628 let updated = exports._loadedLibraries.add(loadId);
3629 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook !== nul l)) { 3629 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook !== nul l)) {
3630 exports.deferredLoadHook(); 3630 exports.deferredLoadHook();
3631 } 3631 }
3632 }), async.Future$(core.Null)); 3632 }, "(List<dynamic>) → dynamic")), async.Future$(core.Null));
3633 } 3633 }
3634 // Function _loadHunk: (String) → Future<Null> 3634 // Function _loadHunk: (String) → Future<Null>
3635 function _loadHunk(hunkName) { 3635 function _loadHunk(hunkName) {
3636 let future = exports._loadingLibraries.get(hunkName); 3636 let future = exports._loadingLibraries.get(hunkName);
3637 if (future !== null) { 3637 if (future !== null) {
3638 return dart.as(future.then((_) => null), async.Future$(core.Null)); 3638 return dart.as(future.then(dart.closureWrap((_) => null, "(Null) → dynamic ")), async.Future$(core.Null));
3639 } 3639 }
3640 let uri = _isolate_helper.IsolateNatives.thisScript; 3640 let uri = _isolate_helper.IsolateNatives.thisScript;
3641 let index = uri.lastIndexOf('/'); 3641 let index = uri.lastIndexOf('/');
3642 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`; 3642 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`;
3643 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) { 3643 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) {
3644 return exports._loadingLibraries.set(hunkName, new async.Future(() => { 3644 return exports._loadingLibraries.set(hunkName, new async.Future(() => {
3645 try { 3645 try {
3646 new Function(`load("${uri}")`)(); 3646 new Function(`load("${uri}")`)();
3647 } catch (error) { 3647 } catch (error) {
3648 let stackTrace = dart.stackTrace(error); 3648 let stackTrace = dart.stackTrace(error);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3948 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; 3948 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError;
3949 exports.random64 = random64; 3949 exports.random64 = random64;
3950 exports.jsonEncodeNative = jsonEncodeNative; 3950 exports.jsonEncodeNative = jsonEncodeNative;
3951 exports.getIsolateAffinityTag = getIsolateAffinityTag; 3951 exports.getIsolateAffinityTag = getIsolateAffinityTag;
3952 exports.loadDeferredLibrary = loadDeferredLibrary; 3952 exports.loadDeferredLibrary = loadDeferredLibrary;
3953 exports.MainError = MainError; 3953 exports.MainError = MainError;
3954 exports.missingMain = missingMain; 3954 exports.missingMain = missingMain;
3955 exports.badMain = badMain; 3955 exports.badMain = badMain;
3956 exports.mainHasTooManyParameters = mainHasTooManyParameters; 3956 exports.mainHasTooManyParameters = mainHasTooManyParameters;
3957 })(_js_helper || (_js_helper = {})); 3957 })(_js_helper || (_js_helper = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698