The arguments of a function would be unnecessarily copied if there was a nested function that had a parameter with the same identifier as the rest parameter for the outer function. This checks the scope of the parameter is correct before deoptimising. Fixes: https://github.com/babel/babel/issues/5656 Refs: https://github.com/babel/babel/issues/2091
23 lines
359 B
JavaScript
23 lines
359 B
JavaScript
function a(...args) {
|
|
const foo = (...list) => bar(...list);
|
|
foo(...args);
|
|
}
|
|
|
|
function b(...args) {
|
|
const foo = (...args) => bar(...args);
|
|
foo(...args);
|
|
}
|
|
|
|
function c(...args) {
|
|
const foo = (...args) => bar(...args);
|
|
foo([]);
|
|
}
|
|
|
|
function d(thing, ...args) {
|
|
const foo = (...args) => bar(...args);
|
|
{
|
|
let args = thing;
|
|
foo(thing);
|
|
}
|
|
}
|