Generate catch-block body within proper scope

This commit is contained in:
Dmitry Petrov
2017-04-28 17:04:16 +03:00
parent acefd0d891
commit 90ec53b3b0
5 changed files with 43 additions and 10 deletions
@@ -0,0 +1,2 @@
fun test(f: () -> Unit) =
try { f() } catch (e: Exception) { throw e }
@@ -0,0 +1,14 @@
FILE /catchParameterAccess.kt
FUN public fun test(f: () -> kotlin.Unit): kotlin.Unit
VALUE_PARAMETER value-parameter f: () -> kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='test(() -> Unit): Unit'
TRY type=kotlin.Unit
try: BLOCK type=kotlin.Unit origin=null
CALL 'invoke(): Unit' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'value-parameter f: () -> Unit' type=() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION
CATCH parameter=e: Exception /* = Exception */
VAR CATCH_PARAMETER val e: kotlin.Exception /* = java.lang.Exception */
BLOCK type=kotlin.Nothing origin=null
THROW type=kotlin.Nothing
GET_VAR 'e: Exception /* = Exception */' type=kotlin.Exception /* = java.lang.Exception */ origin=null