[JS BE] Set enclosing exception state in finally block

[Fix KT-28207]
This commit is contained in:
Roman Artemev
2018-11-15 15:20:30 +03:00
committed by romanart
parent 353b469f4a
commit d5acc8ff5b
9 changed files with 186 additions and 1 deletions
@@ -295,6 +295,7 @@ class CoroutineBodyTransformer(private val context: CoroutineTransformationConte
// Handle finally node
if (finallyNode != null) {
currentBlock = finallyBlock
currentStatements += exceptionState(oldCatchBlock, x)
finallyNode.statements.forEach { it.accept(this) }
generateFinallyExit()
hasFinallyBlocks = true
@@ -6373,6 +6373,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines");
}
@TestMetadata("rethrowInFinallyWithSuspension.kt")
public void testRethrowInFinallyWithSuspension_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines");
}
@TestMetadata("rethrowInFinally.kt")
public void testRethrowInFinally_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines");
}
@TestMetadata("simple.kt")
public void testSimple_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines");
@@ -7223,6 +7223,26 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines");
}
@TestMetadata("rethrowInFinallyWithSuspension.kt")
public void testRethrowInFinallyWithSuspension_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("rethrowInFinallyWithSuspension.kt")
public void testRethrowInFinallyWithSuspension_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines");
}
@TestMetadata("rethrowInFinally.kt")
public void testRethrowInFinally_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("rethrowInFinally.kt")
public void testRethrowInFinally_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines");
}
@TestMetadata("simple.kt")
public void testSimple_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines.experimental");