[JS IR BE] Workaround empty blocks in state machine builder

This commit is contained in:
Svyatoslav Kuzmich
2018-08-23 19:56:49 +03:00
parent e0237a4480
commit 5192783669
@@ -372,7 +372,9 @@ class StateMachineBuilder(
currentBlock = branchBlock
branch.result.acceptVoid(this)
if (currentBlock.statements.last() !is IrContinue) {
// TODO: block should not be empty
val lastStatement = currentBlock.statements.lastOrNull()
if (lastStatement != null && lastStatement !is IrContinue) {
if (currentState !== rootState) {
doDispatch(exitState)
}
@@ -382,7 +384,10 @@ class StateMachineBuilder(
currentBlock = elseBlock
} else {
branch.result.acceptVoid(this)
if (currentBlock.statements.last() !is IrContinue) {
// TODO: block should not be empty
val lastStatement = currentBlock.statements.lastOrNull()
if (lastStatement != null && lastStatement !is IrContinue) {
if (currentState !== rootState) {
doDispatch(exitState)
}