This commit is contained in:
Dmitry Petrov
2016-08-24 19:08:12 +03:00
committed by Dmitry Petrov
parent ebd8f1266d
commit 17758d8c00
12 changed files with 285 additions and 8 deletions
+31
View File
@@ -0,0 +1,31 @@
fun test1() {
try {
println()
}
catch (e: Throwable) {
println()
}
finally {
println()
}
}
fun test2(): Int {
return try {
println()
42
}
catch (e: Throwable) {
println()
24
}
finally {
println()
}
}
fun testImplicitCast(a: Any) {
if (a !is String) return
val t: String = try { a } catch (e: Throwable) { "" }
}
+38
View File
@@ -0,0 +1,38 @@
IrFile /tryCatch.kt
IrFunction public fun test1(): kotlin.Unit
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
TRY_CATCH type=kotlin.Unit
try: BLOCK type=<no-type> hasResult=false operator=null
CALL .println type=kotlin.Unit operator=null
catch e: BLOCK type=<no-type> hasResult=false operator=null
CALL .println type=kotlin.Unit operator=null
finally: BLOCK type=<no-type> hasResult=false operator=null
CALL .println type=kotlin.Unit operator=null
IrFunction public fun test2(): kotlin.Int
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
TRY_CATCH type=kotlin.Int
try: BLOCK type=kotlin.Int hasResult=true operator=null
CALL .println type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='42'
catch e: BLOCK type=kotlin.Int hasResult=true operator=null
CALL .println type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='24'
finally: BLOCK type=<no-type> hasResult=false operator=null
CALL .println type=kotlin.Unit operator=null
IrFunction public fun testImplicitCast(/*0*/ a: kotlin.Any): kotlin.Unit
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
WHEN type=kotlin.Unit operator=IF
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR a type=kotlin.Any operator=null
then: RETURN type=<no-type>
VAR val t: kotlin.String
TRY_CATCH type=kotlin.String
try: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
BLOCK type=kotlin.Any hasResult=true operator=null
GET_VAR a type=kotlin.Any operator=null
catch e: BLOCK type=kotlin.String hasResult=true operator=null
CONST String type=kotlin.String value=''