[devirtualization] Fixed bug with handling empty IrBlock
This commit is contained in:
+4
@@ -1729,6 +1729,9 @@ internal object Devirtualization {
|
|||||||
|
|
||||||
is IrBlock -> {
|
is IrBlock -> {
|
||||||
val statements = expression.statements
|
val statements = expression.statements
|
||||||
|
if (statements.isEmpty())
|
||||||
|
PossiblyFoldedExpression(expression, false)
|
||||||
|
else {
|
||||||
val lastStatement = statements.last() as IrExpression
|
val lastStatement = statements.last() as IrExpression
|
||||||
val foldedLastStatement = fold(lastStatement, coercion, cast, transformRecursively)
|
val foldedLastStatement = fold(lastStatement, coercion, cast, transformRecursively)
|
||||||
statements.transform {
|
statements.transform {
|
||||||
@@ -1750,6 +1753,7 @@ internal object Devirtualization {
|
|||||||
}
|
}
|
||||||
PossiblyFoldedExpression(transformedBlock, foldedLastStatement.folded)
|
PossiblyFoldedExpression(transformedBlock, foldedLastStatement.folded)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
is IrWhen -> {
|
is IrWhen -> {
|
||||||
val foldedBranches = expression.branches.map { fold(it.result, coercion, cast, transformRecursively) }
|
val foldedBranches = expression.branches.map { fold(it.result, coercion, cast, transformRecursively) }
|
||||||
|
|||||||
Reference in New Issue
Block a user