-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Wrong Conversion of Let and Const Variables Defined in Block #2627
Comments
kdy1
added a commit
to kdy1/swc
that referenced
this issue
Mar 3, 2022
2 tasks
kdy1
added a commit
to kdy1/swc
that referenced
this issue
Mar 3, 2022
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
Const and let only exist in the blocks they are defined in, but after swc conversion, they all become var variables and can print value out of the block.
Input code
Config
Playground link
https://play.swc.rs/?version=1.2.106&code=H4sIAAAAAAAAA6vm5VJQyEktUUhUsFUwtAbxkvPziksUkuD8ssQihWQor5aXCySdn5Oql5OfrpGoaa2AKpKEIZIMFAEAhYlu3mYAAAA%3D&config=H4sIAAAAAAAAA0WMTQrEIAxG75K1286id5hDBCctFv9IUhgR714tlu7C915ehUMsrBUyshCPS0pU%2FMMKZAOKZZcVTNf6tKEXagYUeScdiiyd%2BZSEJjUQXHRbGSWbQmYSeRHG3T9m66GQfucYKmjJdAc%2F0N7G%2FHPynaLySe0Cj9ke9LUAAAA%3D
Expected behavior
const and let only exist in the blocks they are defined in. After transforming, they should like this
or like this
// const and let only exist in the blocks they are defined in.
Version
@swc/cli: 0.1.51 @swc/core: 1.2.106
Additional context
I run swc use cmd as follows
The environment is ubuntu 20.04 amd64.
The text was updated successfully, but these errors were encountered: