account for computed variables in properties
This commit is contained in:
parent
200edc8e8c
commit
5cbe963dde
@ -143,14 +143,27 @@ Please remove the call or use 'useBuiltIns: "entry"' instead.
|
||||
warnOnInstanceMethod(state, getObjectString(node));
|
||||
const builtIn = definitions.instanceMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else if (
|
||||
node.computed &&
|
||||
t.isStringLiteral(prop) &&
|
||||
has(definitions.instanceMethods, prop.value)
|
||||
) {
|
||||
warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`);
|
||||
const builtIn = definitions.instanceMethods[prop.value];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else if (node.computed) {
|
||||
if (
|
||||
t.isStringLiteral(prop) &&
|
||||
has(definitions.instanceMethods, prop.value)
|
||||
) {
|
||||
const builtIn = definitions.instanceMethods[prop.value];
|
||||
warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`);
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else {
|
||||
const res = path.get("property").evaluate();
|
||||
if (res.confident) {
|
||||
const builtIn = definitions.instanceMethods[res.value];
|
||||
warnOnInstanceMethod(state, `${obj.name}['${res.value}']`);
|
||||
addUnsupported(
|
||||
path.get("property"),
|
||||
state.opts.polyfills,
|
||||
builtIn,
|
||||
this.builtIns,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -10,3 +10,11 @@ e.padStart.apply(); // .apply
|
||||
f.padEnd.call(); // .call
|
||||
String.prototype.startsWith.call; // prototype.call
|
||||
var { codePointAt, endsWith } = k; // destructuring
|
||||
|
||||
var asdf = "copyWithin";
|
||||
var asdf2 = "split";
|
||||
var asdf3 = "re" + "place";
|
||||
i[asdf]; // computed with identifier
|
||||
j[`search`]; // computed with template
|
||||
k[asdf3] // computed with concat strings
|
||||
var { [asdf2]: _a } = k; // computed
|
||||
|
||||
@ -1,15 +1,19 @@
|
||||
import 'core-js/modules/es6.string.ends-with';
|
||||
import 'core-js/modules/es6.string.code-point-at';
|
||||
import 'core-js/modules/es6.string.starts-with';
|
||||
import 'core-js/modules/es7.string.pad-end';
|
||||
import 'core-js/modules/es7.string.pad-start';
|
||||
import 'core-js/modules/es6.array.fill';
|
||||
import 'core-js/modules/es6.array.find-index';
|
||||
import 'core-js/modules/es6.array.find';
|
||||
import 'core-js/modules/es7.array.includes';
|
||||
import 'core-js/modules/es6.string.includes';
|
||||
import 'core-js/modules/es6.map';
|
||||
import 'core-js/modules/es6.array.from';
|
||||
import "core-js/modules/es6.regexp.split";
|
||||
import "core-js/modules/es6.regexp.replace";
|
||||
import "core-js/modules/es6.regexp.search";
|
||||
import "core-js/modules/es6.array.copy-within";
|
||||
import "core-js/modules/es6.string.ends-with";
|
||||
import "core-js/modules/es6.string.code-point-at";
|
||||
import "core-js/modules/es6.string.starts-with";
|
||||
import "core-js/modules/es7.string.pad-end";
|
||||
import "core-js/modules/es7.string.pad-start";
|
||||
import "core-js/modules/es6.array.fill";
|
||||
import "core-js/modules/es6.array.find-index";
|
||||
import "core-js/modules/es6.array.find";
|
||||
import "core-js/modules/es7.array.includes";
|
||||
import "core-js/modules/es6.string.includes";
|
||||
import "core-js/modules/es6.map";
|
||||
import "core-js/modules/es6.array.from";
|
||||
Array.from; // static function
|
||||
Map; // top level built-in
|
||||
|
||||
@ -23,4 +27,13 @@ f.padEnd.call(); // .call
|
||||
String.prototype.startsWith.call; // prototype.call
|
||||
var _k = k,
|
||||
codePointAt = _k.codePointAt,
|
||||
endsWith = _k.endsWith; // destructuring
|
||||
endsWith = _k.endsWith; // destructuring
|
||||
|
||||
var asdf = "copyWithin";
|
||||
var asdf2 = "split";
|
||||
var asdf3 = "re" + "place";
|
||||
i[asdf]; // computed with identifier
|
||||
j["search"]; // computed with template
|
||||
k[asdf3]; // computed with concat strings
|
||||
var _k2 = k,
|
||||
_a = _k2[asdf2]; // computed
|
||||
|
||||
@ -16,9 +16,3 @@ _arr9[Symbol.iterator2]();
|
||||
|
||||
G.assign; // static method
|
||||
function H(WeakMap) { var blah = new WeakMap(); } // shadowed
|
||||
|
||||
// not covered by this plugin
|
||||
var asdf = 'copyWithin';
|
||||
i[asdf] // computed with identifier
|
||||
j[`copyWithin`] // computed with template
|
||||
var { [asdf]: _a } = k; // computed
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import 'core-js/modules/es6.symbol';
|
||||
import 'core-js/modules/es6.regexp.match';
|
||||
import 'core-js/modules/es6.promise';
|
||||
import 'core-js/modules/es6.map';
|
||||
import 'core-js/modules/es6.array.from';
|
||||
import "core-js/modules/es6.symbol";
|
||||
import "core-js/modules/es6.regexp.match";
|
||||
import "core-js/modules/es6.promise";
|
||||
import "core-js/modules/es6.map";
|
||||
import "core-js/modules/es6.array.from";
|
||||
Array.from; // static method
|
||||
Map; // built-in
|
||||
new Promise(); // new builtin
|
||||
@ -23,10 +23,3 @@ G.assign; // static method
|
||||
function H(WeakMap) {
|
||||
var blah = new WeakMap();
|
||||
} // shadowed
|
||||
|
||||
// not covered by this plugin
|
||||
var asdf = 'copyWithin';
|
||||
i[asdf]; // computed with identifier
|
||||
j['copyWithin']; // computed with template
|
||||
var _k = k,
|
||||
_a = _k[asdf]; // computed
|
||||
Loading…
x
Reference in New Issue
Block a user