Generate proper exception table

Don't forget to split nested try blocks without finally block
 on generating finally blocks from outer ones.

 #KT-31923 InProgress
This commit is contained in:
Mikhael Bogdanov
2019-06-11 11:29:52 +02:00
parent 078cfc02a5
commit c335015c05
20 changed files with 752 additions and 65 deletions
+28
View File
@@ -0,0 +1,28 @@
// !LANGUAGE: -ProperFinally
// TARGET_BACKEND: JVM
var result = ""
fun test() {
try {
try {
result += "try"
return
} catch (fail: Throwable) {
result += " catch"
}
} finally {
result += " finally"
throw RuntimeException()
}
}
fun box(): String {
try {
test()
return "fail: expected exception"
} catch (e: RuntimeException) {
}
return if (result == "try finally catch finally") "OK" else "fail: $result"
}