Skip to content

Commit e08d269

Browse files
committed
Scala.js: Handle WhileDo loops with an EmptyTree condition.
1 parent 8dce058 commit e08d269

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,10 @@ class JSCodeGen()(implicit ctx: Context) {
862862
}, label)
863863

864864
case WhileDo(cond, body) =>
865-
js.While(genExpr(cond), genStat(body))
865+
val genCond =
866+
if (cond == EmptyTree) js.BooleanLiteral(true)
867+
else genExpr(cond)
868+
js.While(genCond, genStat(body))
866869

867870
case t: Try =>
868871
genTry(t, isStat)

0 commit comments

Comments
 (0)