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
Invalid dead code removal for return statement due to ASI #3729
Comments
Similar ASI issues are also present in throw
expected:
actual:
yield
expected:
actual:
I didn't investigate whether |
Thanks for spotting, I will have a look. I know I already fixed a similar group of issues in #3035 but apparently I missed something 🙄 |
Ah I see, I forgot to pass down the preventASI flag for nested expressions... Fix at #3732 |
@lukastaegert PR #3732 does not address the ASI bug in |
There's also still an issue with
expected:
actual:
|
Ah I see, I did not consider that due to execution order, the AST is nested so the first logical expression is nested into the second one, not the other way around. So if the second one is indeterminate, the first one could still be simplified to cause the issue, but the preventASI flag needs to be passed through the second one.
I do not think so because I am quite sure that there is no ASI after |
Input:
Expected Behavior
Actual Behavior
A function which returns true is incorrectly transformed into a function which returns undefined. This is a reduced test case from real-world code here that looks like this:
The text was updated successfully, but these errors were encountered: