-
Notifications
You must be signed in to change notification settings - Fork 335
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
Broken parens on return statement #365
Comments
This only happens when comments are included inside the parentheses. |
Fix broken parens on return statements with leading comments
Same problem for throw statements. |
This issue is still present in v2.0.0. |
The problem is more general. An expression that is within parentheses and contains a comment in the beginning, compiles incorrectly.
compiles into:
This does not happen in all cases, such as it does not happen if the expression is within an Note: the compiled code still works correctly, so this may not be a good example of the problem, but I think the parentheses should still be generated. |
The issue is about wrong code generation when using comments in |
Repro
escodegen strips parenthesis from return statements, changing the behavior of the code. This breaks ast serialization/deserialization for react here.
Output
original
generated
The text was updated successfully, but these errors were encountered: