T2965: Patterns as rest parameter operands are not valid, therefore this relic should go
This commit is contained in:
@@ -105,7 +105,6 @@ export let visitor = {
|
||||
// otherwise `arguments` will be remapped in arrow functions
|
||||
argsId._shadowedFunctionLiteral = path;
|
||||
|
||||
|
||||
function optimiseCandidate(parent, parentPath, offset) {
|
||||
if (t.isReturnStatement(parentPath.parent) || t.isIdentifier(parentPath.parent.id)) {
|
||||
parentPath.replaceWith(loadRest({
|
||||
@@ -127,18 +126,6 @@ export let visitor = {
|
||||
}
|
||||
}
|
||||
|
||||
// support patterns // no test case?
|
||||
if (t.isPattern(rest)) {
|
||||
let pattern = rest;
|
||||
rest = scope.generateUidIdentifier("ref");
|
||||
|
||||
let declar = t.variableDeclaration("let", pattern.elements.map(function (elem, index) {
|
||||
let accessExpr = t.memberExpression(rest, t.numericLiteral(index), true);
|
||||
return t.variableDeclarator(elem, accessExpr);
|
||||
}));
|
||||
node.body.body.unshift(declar);
|
||||
}
|
||||
|
||||
// check and optimise for extremely common cases
|
||||
let state = {
|
||||
references: [],
|
||||
@@ -175,8 +162,6 @@ export let visitor = {
|
||||
// deopt shadowed functions as transforms like regenerator may try touch the allocation loop
|
||||
state.deopted = state.deopted || !!node.shadow;
|
||||
|
||||
//
|
||||
|
||||
let start = t.numericLiteral(node.params.length);
|
||||
let key = scope.generateUidIdentifier("key");
|
||||
let len = scope.generateUidIdentifier("len");
|
||||
|
||||
Reference in New Issue
Block a user