New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transform-es2015-parameters: arguments deoptimized when shadowed in nested function #5656
Comments
Hey @jpommerening! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
I hope I'm not being stupid, but is this really meant to be "expected"? var y = function (foo, ...bar) {
var x = function z(bar) {
bar[1] = 5;
};
}; var y = function (foo) {
for (var _len2 = arguments.length, bar = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
bar[_key2 - 1] = arguments[_key2];
}
var x = function z(bar) {
bar[1] = 5;
};
}; I would have thought that given the inner |
Hey @Qantas94Heavy, thanks for pointing that out! |
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: babel#5656
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: babel#5656
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: babel#5656
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: babel#5656 Refs: babel#2091
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: babel#5656 Refs: babel#2091
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: babel#5656 Refs: babel#2091
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: babel#5656 Refs: babel#2091
This is a feature request (I think). Arguments are not optimized if an inner function shadows the name with a parameter (or rest parameters in my case).
Input Code
Babel Configuration (.babelrc, package.json, cli command)
Expected vs. Current Behavior
I'd expect the code to be optimizable to use
.apply( thisArg, arguments )
throughout.However, in
test_deopt
the outer...args
gets copied just to be passed into the innerfn
.I can verify that the problem disappears if I rename either the
...args
oftest_deopt
or of thefn
arrow function.Environment
The text was updated successfully, but these errors were encountered: