-
-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure default case folding only happens when default is last (#1084)
* Ensure default case folding only happens when default is last I failed to consider if multiple branches could evaluate to the test condition. Eg, ```js switch (true) { case definitely_true: default: return 'definitely'; case maybe_true: return 'maybe'; } ``` Here, both `definitely_true` and `maybe_true` can be `=== true`. And we can't eliminate the `case definitely_true:`, because it prevents us from falling into the `maybe_true` branch (when it is true). * Add test cases for branch reordering
- Loading branch information
1 parent
e61a299
commit aadf03d
Showing
2 changed files
with
247 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters