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

Constant folding doesn't simplify inequalities #3645

Closed
LorisSigrist opened this issue Feb 13, 2024 · 0 comments
Closed

Constant folding doesn't simplify inequalities #3645

LorisSigrist opened this issue Feb 13, 2024 · 0 comments

Comments

@LorisSigrist
Copy link

Esbuild performs Constant Folding on equality checks where both sides are constant and known. So if(5 == 5) get's simplified to if(true), which get's simplified further to omit the branching all together.

Esbuild currently doesn't do this for inequality checks, such as <=, >=, >, <.
if(5 >= 5) does not get simplified to if(true). I would expect inequalities to also get folded.

Playground Link

@evanw evanw closed this as completed in 555db48 Feb 18, 2024
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

No branches or pull requests

1 participant