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
Hey @Yangfan2016! 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.
Yangfan2016
changed the title
The scope of the parameter default value is different from what was expected in ES2015 (参数默认值的作用域与 ES2015 的预期结果不同)
The scope of the arguments default value is different from what was expected in ES2015 (参数默认值的作用域与 ES2015 的预期结果不同)
May 6, 2019
Thanks for the reproducing examples. It helps a lot narrow down the problem.
The possible solution you mentioned above is promising. In fact there is a iife state in the transform-parameters to determine whether the whole function body should be wrapped into an extra closure.
It is interesting to find that there was a similar bug people had already solved here, so as a workaround, you can replace
functionbar(func=()=>foo){}
to
functionbar(func=()=>eval("foo")){}
And babel will work this time. I admit that it is ugly hack and the bug should be fixed in transform-parameters. I would look into this in a couple of days.
Bug Report
Current Behavior
The scope of the arguments default value is different from what was expected in ES2015
Input Code
online view
This is source code of ES2015:
The result of run it:
outer
This is transform code by babel:
The result of run it:
inner
Expected behavior/code
Expect the results of the Babel conversion to be consistent with ES2015 performance
Babel Configuration (.babelrc, package.json, cli command)
Environment
Possible Solution
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
The text was updated successfully, but these errors were encountered: