You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
transform-es2015-parameters: arguments deoptimized when shadowed in nested function #5656
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).
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 inner fn.
I can verify that the problem disappears if I rename either the ...args of test_deopt or of the fn arrow function.
Hey @jpommerening! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
Hey @Qantas94Heavy, thanks for pointing that out!
I was under the impression that this was merely an oversight / missing optimization. I didn't know there was actually a test verifying the (arguably) incorrect behavior. I'm as confused as you are that the transform is expected to copy the arguments in the test case you linked.
Activity
babel-bot commentedon Apr 21, 2017
Hey @jpommerening! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
Qantas94Heavy commentedon May 9, 2017
I hope I'm not being stupid, but is this really meant to be "expected"?
Test code:
Current "expected" result:
I would have thought that given the inner
barshadows the outer restbar, we wouldn't need to copy the arguments.jpommerening commentedon May 9, 2017
Hey @Qantas94Heavy, thanks for pointing that out!
I was under the impression that this was merely an oversight / missing optimization. I didn't know there was actually a test verifying the (arguably) incorrect behavior. I'm as confused as you are that the transform is expected to copy the arguments in the test case you linked.
Improve optimisation of shadowed rest parameters
Improve optimisation of shadowed rest parameters
Improve optimisation of shadowed rest parameters
Improve optimisation of shadowed rest parameters
Fix optimisation of shadowed rest parameters
Fix optimisation of shadowed rest parameters
Fix optimisation of shadowed rest parameters
Fix optimisation of shadowed rest parameters
Fix optimisation of shadowed rest parameters