forked from scala-js/scala-js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
Match
nodes with non-int-literals in the back-end.
Since Scala 2.13.2, the pattern matcher will keep `Match` nodes that match on `String`s and `null`s as is, to be desugared later in `cleanup`. This was implemented upstream in scala/scala#8451 We implement a more general translation that will accept any kind of scalac `Literal`. If the scrutinee is an integer and all cases are int literals, we emit a `js.Match` as before. Otherwise, we emit an `if..else` chain with `===` comparisons.
- Loading branch information
Showing
2 changed files
with
120 additions
and
28 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