[JVM_IR] Keep track of catch variable gaps.
This ensures that catch variables are not visible in duplicated finally blocks generated at an exit within the catch variable scope. ^KT-46449 Fixed
This commit is contained in:
+5
-6
@@ -1159,18 +1159,17 @@ class ExpressionCodegen(
|
||||
val afterStore = markNewLabel()
|
||||
|
||||
val catchBody = clause.result
|
||||
val catchResult = catchBody.accept(this, data)
|
||||
var catchBlockInfo = BlockInfo(data)
|
||||
catchBlockInfo.variables.add(VariableInfo(parameter, index, descriptorType, afterStore))
|
||||
|
||||
val catchResult = catchBody.accept(this, catchBlockInfo)
|
||||
if (savedValue != null) {
|
||||
catchResult.materializeAt(tryAsmType, aTry.type, true)
|
||||
mv.store(savedValue, tryAsmType)
|
||||
} else {
|
||||
catchResult.discard()
|
||||
}
|
||||
|
||||
frameMap.leave(clause.catchParameter)
|
||||
|
||||
val clauseEnd = markNewLabel()
|
||||
mv.visitLocalVariable(parameter.name.asString(), descriptorType.descriptor, null, afterStore, clauseEnd, index)
|
||||
writeLocalVariablesInTable(catchBlockInfo, markNewLabel())
|
||||
|
||||
if (tryInfo is TryWithFinallyInfo) {
|
||||
data.handleBlock { genFinallyBlock(tryInfo, tryCatchBlockEnd, null, data) }
|
||||
|
||||
Reference in New Issue
Block a user