Commit 00d4216
committed
Partial fix for lampepfl#7113: Fix Scala.js codegen for Explicit Returns
In order to use an explicit return statement in Scala.js IR, a label
must be placed wrapping the whole function body to serve as a jump/break
point for all control structures inside the function. While a fresh return
label had been generated for such methods (in the LocalNameGenerator),
it had not been placed at the top level of its method, and was otherwise
unused. This affected the tree created by the TailRec MiniPhase, as well
as user-written early return statements.
After generating a method's body, if a enclosing return label had been
generated, use it to wrap the method body (just as Scala 2's JS codegen
does) for such breaks.
Enable the tests of ReadersTest.scala of the Scala.js test suite, of
which InputStreamReaderTest used a tail-recursive method that depended
on this fix.1 parent 5e8e26f commit 00d4216
File tree
3 files changed
+15
-2
lines changed- compiler/src/dotty/tools/backend/sjs
- project
3 files changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
726 | | - | |
| 726 | + | |
727 | 727 | | |
728 | 728 | | |
| 729 | + | |
729 | 730 | | |
730 | 731 | | |
731 | 732 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
95 | 107 | | |
96 | 108 | | |
97 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
982 | | - | |
| 982 | + | |
983 | 983 | | |
984 | 984 | | |
985 | 985 | | |
| |||
0 commit comments