New J2K: Do not throw away incorrect code in switch statements

This commit is contained in:
Ilya Kirillov
2019-04-08 18:40:13 +03:00
parent a98382a3cb
commit 7d5793184f
@@ -828,8 +828,13 @@ class JavaToJKTreeBuilder constructor(
emptyList()
).withAssignedNonCodeElements(statement)
else ->
//TODO Handle case then there is no last case
cases.lastOrNull()?.also { it.statements = it.statements + statement.toJK() }
?: run {
cases += JKJavaLabelSwitchCaseImpl(
JKStubExpressionImpl(),
listOf(statement.toJK())
)
}
}
}
JKJavaSwitchStatementImpl(with(expressionTreeMapper) { expression.toJK() }, cases)