mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
- fix SAVE_STACK_BEFORE_TRY insertion:
TRYCATCHBLOCK LA, LB, LC
LA
NOP
try_body
LB
...
LC
handler_body
should be transformed into:
LA
{SAVE_STACK_BEFORE_TRY}
LA' // new TCB start label
NOP
try_body
LB
...
LC
handler_body
with all TCBs start labels remapped
- properly wrap exceptions from MandatoryMethodTransformer
#KT-8608 Fixed
26 lines
433 B
Kotlin
Vendored
26 lines
433 B
Kotlin
Vendored
inline fun catchAll(x: String, block: () -> Unit): String {
|
|
try {
|
|
block()
|
|
} catch (e: Throwable) {
|
|
}
|
|
return x
|
|
}
|
|
|
|
inline fun tryTwice(block: () -> Unit) {
|
|
try {
|
|
block()
|
|
try {
|
|
block()
|
|
} catch (e: Exception) {
|
|
}
|
|
} catch (e: Exception) {
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
return catchAll("OK") {
|
|
tryTwice {
|
|
throw Exception()
|
|
}
|
|
}
|
|
} |