-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Add option to prevent reversing AST_Binary nodes #1359
Comments
Upon further investigation, the fix involves adding an option check to Line 2134 of I believe that the default value of this option needs to be |
Hello! As an unrelated hint, you can set Would you be open to issuing a PR for this? |
Thanks for the hint about I think the "move constants to left-hand side" option should be disabled with |
* First pass at #1359 * Adding test case for lhs_constants
In version 5.16.9. |
Bug report or Feature request?
Feature request
Version (complete output of
terser -V
or specific git commit) 5.16.6Complete CLI command or
minify()
options usedterser
inputif (foo == 42) { bar(); }
terser
output or errorif (42 == foo) bar()
Expected result
if (foo == 42) bar()
Notes
Right now, if you turn on
compress
, there is no way of opting-out of AST_Binary'sreversible()
/reverse()
logic, even whencomparisons
is set to false. Could there be a new option to prevent this, or could thecomparisons
option prevent reversing.Specifically, in our use case, we need to run with
compress
fordead_code
andunused
, but we want to prevent as many additional transformations as possible.The text was updated successfully, but these errors were encountered: