Safely transform multiple rest arguments
This commit is contained in:
@@ -121,7 +121,7 @@ export let visitor = {
|
||||
argsId._shadowedFunctionLiteral = path;
|
||||
|
||||
function optimiseCandidate(parent, parentPath, offset) {
|
||||
if (t.isReturnStatement(parentPath.parent) || t.isIdentifier(parentPath.parent.id)) {
|
||||
if (t.isReturnStatement(parentPath.parent) || t.isIdentifier(parentPath.parent.id) || t.isIdentifier(parentPath.parent.left)) {
|
||||
parentPath.replaceWith(loadRest({
|
||||
ARGUMENTS: argsId,
|
||||
INDEX: t.numericLiteral(parent.property.value + offset)
|
||||
|
||||
@@ -9,3 +9,10 @@ function t(f, ...items) {
|
||||
x = items[0];
|
||||
x = items[1];
|
||||
}
|
||||
|
||||
function u(f, g, ...items) {
|
||||
var x = f;
|
||||
var y = g;
|
||||
x = items[0];
|
||||
y = items[1];
|
||||
}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
var t = function (f) {
|
||||
var x = f;
|
||||
x = arguments[1];
|
||||
x = arguments[2];
|
||||
x = arguments.length <= 1 ? undefined : arguments[1];
|
||||
x = arguments.length <= 2 ? undefined : arguments[2];
|
||||
};
|
||||
|
||||
function t(f) {
|
||||
var x = f;
|
||||
x = arguments[1];
|
||||
x = arguments[2];
|
||||
x = arguments.length <= 1 ? undefined : arguments[1];
|
||||
x = arguments.length <= 2 ? undefined : arguments[2];
|
||||
}
|
||||
|
||||
function u(f, g) {
|
||||
var x = f;
|
||||
var y = g;
|
||||
x = arguments.length <= 2 ? undefined : arguments[2];
|
||||
y = arguments.length <= 3 ? undefined : arguments[3];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user