Skip to content
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

Variable assignment incorrectly pruned within catch clause #3869

Closed
SquidDev opened this issue Nov 13, 2020 · 2 comments · Fixed by #3871
Closed

Variable assignment incorrectly pruned within catch clause #3869

SquidDev opened this issue Nov 13, 2020 · 2 comments · Fixed by #3871

Comments

@SquidDev
Copy link

SquidDev commented Nov 13, 2020

  • Rollup Version: 2.33.1
  • Operating System (or Browser): Browser
  • Node Version (if applicable): 12.3.1
  • Link to reproduction (IMPORTANT, read below): Repl link

First, a disclaimer: I didn't actually write code this horrendous. This is produced by a compiler, hence the rather ... non-conventional JS code.

The REPL example above should be relatively clear. It appears Rollup's optimiser/DCE pass is incorrectly removing a variable assignment within a catch clause.

Expected Behavior

The variable assignment would not be removed. One would expect the above program to print Oh no.

Actual Behavior

The variable assignment is removed, and so result is never assigned. The program prints undefined.

@lukastaegert
Copy link
Member

Thanks for spotting this, this was indeed a tricky and interesting one. Fix at #3871.

@SquidDev
Copy link
Author

Thank you for the speedy fix ❤️. I know how hard optimiser bugs can be to debug :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants