JVM: do not assume that methods have body in BridgeLowering

They don't have bodies in the kapt stub generation mode.

 #KT-58787 Fixed
This commit is contained in:
Alexander Udalov
2023-05-24 15:26:13 +02:00
committed by Space Team
parent b2230327df
commit d32268c5cb
6 changed files with 232 additions and 4 deletions
@@ -539,10 +539,11 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
}
// After the checks, insert the original method body.
if (body is IrExpressionBody) {
+irReturn((body as IrExpressionBody).expression)
} else {
(body as IrBlockBody).statements.forEach { +it }
when (val body = body) {
is IrExpressionBody -> +irReturn(body.expression)
is IrBlockBody -> body.statements.forEach { +it }
null -> {}
else -> error("Unsupported method body kind: ${body.render()}")
}
}
}