Fixes for inline fun finally block generation before lambda non-local returns

This commit is contained in:
Michael Bogdanov
2014-10-23 11:27:53 +04:00
parent 25d7c9f20a
commit dd8c3f0e49
10 changed files with 462 additions and 40 deletions
@@ -0,0 +1,28 @@
inline fun test(s: ()->Int): Int {
var i = 0;
i = s()
try {
i = i + 10
} finally {
return i
}
}
fun box() : String {
var p: Int = 1
test {
try {
p = 1
return "OK" //finally from inline fun doen't split this try
} catch(e: Exception) {
p = -1;
p
} finally {
p++
}
}
return "fail"
}
// 10 TRYCATCHBLOCK
@@ -0,0 +1,55 @@
inline fun test(s: ()->Int): Int {
var i = 0;
try {
i = s()
i = i + 10
} finally {
return i
}
}
fun box() : String {
var p: Int = 1
test {
try {
p = 1
return "OK" //finally from inline fun doen't split this try
} catch(e: Exception) {
p = -1;
p
} finally {
p++
}
}
return "fail"
}
// maybe we shouldinline fun test(s: ()->Int): Int {
var i = 0;
try {
i = s()
i = i + 10
} finally {
return i
}
}
fun box() : String {
var p: Int = 1
test {
try {
p = 1
return "OK" //finally from inline fun doen't split this try
} catch(e: Exception) {
p = -1;
p
} finally {
p++
}
}
return "fail"
}
check test data
// 13 TRYCATCHBLOCK