JVM IR: Improve codegen for try/catch statements
This commit is contained in:
committed by
Dmitry Petrov
parent
af74fd047a
commit
b1b70e503c
+2
-2
@@ -519,7 +519,7 @@ class ExpressionCodegen(
|
||||
override fun visitSetVariable(expression: IrSetVariable, data: BlockInfo): PromisedValue {
|
||||
expression.markLineNumber(startOffset = true)
|
||||
setVariable(expression.symbol, expression.value, data)
|
||||
return defaultValue(expression.type)
|
||||
return immaterialUnitValue
|
||||
}
|
||||
|
||||
fun setVariable(symbol: IrValueSymbol, value: IrExpression, data: BlockInfo) {
|
||||
@@ -751,7 +751,7 @@ class ExpressionCodegen(
|
||||
mv.nop()
|
||||
val tryAsmType = aTry.asmType
|
||||
val tryResult = aTry.tryResult.accept(this, data)
|
||||
val isExpression = true //TODO: more wise check is required
|
||||
val isExpression = !aTry.type.isUnit()
|
||||
var savedValue: Int? = null
|
||||
if (isExpression) {
|
||||
tryResult.coerce(tryAsmType, aTry.type).materialize()
|
||||
|
||||
-1
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.visitAnnotableParameterCount
|
||||
|
||||
Reference in New Issue
Block a user