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

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

Issue 1052693004: move => bind this workaround to js_ast (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: 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
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/async.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 _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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 this.cachedSortedIndices = new core.List(this.optionalParameterCount); 1675 this.cachedSortedIndices = new core.List(this.optionalParameterCount);
1676 let positions = dart.map(); 1676 let positions = dart.map();
1677 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) { 1677 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) {
1678 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i ); 1678 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i );
1679 positions.set(this.parameterName(index), index); 1679 positions.set(this.parameterName(index), index);
1680 } 1680 }
1681 let index = 0; 1681 let index = 0;
1682 ((_$) => { 1682 ((_$) => {
1683 _$.sort(); 1683 _$.sort();
1684 return _$; 1684 return _$;
1685 }).bind(this)(positions.keys.toList()).forEach(((name) => { 1685 })(positions.keys.toList()).forEach(((name) => {
1686 this.cachedSortedIndices.set(((x$) => index = dart.notNull(x$) + 1, x$ )(index), positions.get(name)); 1686 this.cachedSortedIndices.set(((x$) => index = dart.notNull(x$) + 1, x$ )(index), positions.get(name));
1687 }).bind(this)); 1687 }).bind(this));
1688 } 1688 }
1689 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int); 1689 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int);
1690 } 1690 }
1691 computeFunctionRti(jsConstructor) { 1691 computeFunctionRti(jsConstructor) {
1692 if (typeof this.functionType == "number") { 1692 if (typeof this.functionType == "number") {
1693 return getMetadata(dart.as(this.functionType, core.int)); 1693 return getMetadata(dart.as(this.functionType, core.int));
1694 } else if (typeof this.functionType == "function") { 1694 } else if (typeof this.functionType == "function") {
1695 let fakeInstance = new jsConstructor(); 1695 let fakeInstance = new jsConstructor();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 return; 1832 return;
1833 let window = window; 1833 let window = window;
1834 if (window == null) 1834 if (window == null)
1835 return; 1835 return;
1836 let performance = window.performance; 1836 let performance = window.performance;
1837 if (performance == null) 1837 if (performance == null)
1838 return; 1838 return;
1839 if (typeof performance.now != "function") 1839 if (typeof performance.now != "function")
1840 return; 1840 return;
1841 Primitives.timerFrequency = 1000000; 1841 Primitives.timerFrequency = 1000000;
1842 Primitives.timerTicks = (() => (1000 * performance.now()).floor()).bind(th is); 1842 Primitives.timerTicks = () => (1000 * performance.now()).floor();
1843 } 1843 }
1844 static get isD8() { 1844 static get isD8() {
1845 return typeof version == "function" && typeof os == "object" && "system" i n os; 1845 return typeof version == "function" && typeof os == "object" && "system" i n os;
1846 } 1846 }
1847 static get isJsshell() { 1847 static get isJsshell() {
1848 return typeof version == "function" && typeof system == "function"; 1848 return typeof version == "function" && typeof system == "function";
1849 } 1849 }
1850 static currentUri() { 1850 static currentUri() {
1851 requiresPreamble(); 1851 requiresPreamble();
1852 if (!!self.location) { 1852 if (!!self.location) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 static functionNoSuchMethod(func, positionalArguments, namedArguments) { 2019 static functionNoSuchMethod(func, positionalArguments, namedArguments) {
2020 let argumentCount = 0; 2020 let argumentCount = 0;
2021 let arguments$ = new core.List.from([]); 2021 let arguments$ = new core.List.from([]);
2022 let namedArgumentList = new core.List.from([]); 2022 let namedArgumentList = new core.List.from([]);
2023 if (positionalArguments != null) { 2023 if (positionalArguments != null) {
2024 argumentCount = positionalArguments.length; 2024 argumentCount = positionalArguments.length;
2025 arguments$.addAll(positionalArguments); 2025 arguments$.addAll(positionalArguments);
2026 } 2026 }
2027 let names = ''; 2027 let names = '';
2028 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) { 2028 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) {
2029 namedArguments.forEach(((name, argument) => { 2029 namedArguments.forEach((name, argument) => {
2030 names = `${names}$${name}`; 2030 names = `${names}$${name}`;
2031 namedArgumentList.add(name); 2031 namedArgumentList.add(name);
2032 arguments$.add(argument); 2032 arguments$.add(argument);
2033 argumentCount = dart.notNull(argumentCount) + 1; 2033 argumentCount = dart.notNull(argumentCount) + 1;
2034 }).bind(this)); 2034 });
2035 } 2035 }
2036 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`; 2036 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`;
2037 return dart.dinvoke(func, 'noSuchMethod', createUnmangledInvocationMirror( dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMir ror.METHOD, arguments$, namedArgumentList)); 2037 return dart.dinvoke(func, 'noSuchMethod', createUnmangledInvocationMirror( dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMir ror.METHOD, arguments$, namedArgumentList));
2038 } 2038 }
2039 static applyFunction(func, positionalArguments, namedArguments) { 2039 static applyFunction(func, positionalArguments, namedArguments) {
2040 return namedArguments == null ? Primitives.applyFunctionWithPositionalArgu ments(func, positionalArguments) : Primitives.applyFunctionWithNamedArguments(fu nc, positionalArguments, namedArguments); 2040 return namedArguments == null ? Primitives.applyFunctionWithPositionalArgu ments(func, positionalArguments) : Primitives.applyFunctionWithNamedArguments(fu nc, positionalArguments, namedArguments);
2041 } 2041 }
2042 static applyFunctionWithPositionalArguments(func, positionalArguments) { 2042 static applyFunctionWithPositionalArguments(func, positionalArguments) {
2043 let argumentCount = 0; 2043 let argumentCount = 0;
2044 let arguments$ = null; 2044 let arguments$ = null;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 } 2082 }
2083 let defaultArguments = new core.Map(); 2083 let defaultArguments = new core.Map();
2084 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) { 2084 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) {
2085 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount); 2085 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount);
2086 let parameterName = info.parameterNameInOrder(index); 2086 let parameterName = info.parameterNameInOrder(index);
2087 let value = info.defaultValueInOrder(index); 2087 let value = info.defaultValueInOrder(index);
2088 let defaultValue = getMetadata(value); 2088 let defaultValue = getMetadata(value);
2089 defaultArguments.set(parameterName, defaultValue); 2089 defaultArguments.set(parameterName, defaultValue);
2090 } 2090 }
2091 let bad = false; 2091 let bad = false;
2092 namedArguments.forEach(((parameter, value) => { 2092 namedArguments.forEach((parameter, value) => {
2093 if (defaultArguments.containsKey(parameter)) { 2093 if (defaultArguments.containsKey(parameter)) {
2094 defaultArguments.set(parameter, value); 2094 defaultArguments.set(parameter, value);
2095 } else { 2095 } else {
2096 bad = true; 2096 bad = true;
2097 } 2097 }
2098 }).bind(this)); 2098 });
2099 if (bad) { 2099 if (bad) {
2100 return Primitives.functionNoSuchMethod(func, positionalArguments, namedA rguments); 2100 return Primitives.functionNoSuchMethod(func, positionalArguments, namedA rguments);
2101 } 2101 }
2102 positionalArguments.addAll(defaultArguments.values); 2102 positionalArguments.addAll(defaultArguments.values);
2103 return jsFunction.apply(func, positionalArguments); 2103 return jsFunction.apply(func, positionalArguments);
2104 } 2104 }
2105 static [_mangledNameMatchesType](mangledName, type) { 2105 static [_mangledNameMatchesType](mangledName, type) {
2106 return mangledName == type[_typeName]; 2106 return mangledName == type[_typeName];
2107 } 2107 }
2108 static identicalImplementation(a, b) { 2108 static identicalImplementation(a, b) {
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; 4002 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError;
4003 exports.random64 = random64; 4003 exports.random64 = random64;
4004 exports.jsonEncodeNative = jsonEncodeNative; 4004 exports.jsonEncodeNative = jsonEncodeNative;
4005 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4005 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4006 exports.loadDeferredLibrary = loadDeferredLibrary; 4006 exports.loadDeferredLibrary = loadDeferredLibrary;
4007 exports.MainError = MainError; 4007 exports.MainError = MainError;
4008 exports.missingMain = missingMain; 4008 exports.missingMain = missingMain;
4009 exports.badMain = badMain; 4009 exports.badMain = badMain;
4010 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4010 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4011 })(_js_helper || (_js_helper = {})); 4011 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698