Extraction Engine: Fix extraction of labeled and non-local returns

This commit is contained in:
Alexey Sedunov
2015-03-23 15:58:30 +03:00
parent 3bea49eedd
commit a90d020859
17 changed files with 258 additions and 93 deletions
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(a: Int): Int {
a.let {
<selection>if (it > 0) return it else return@foo -it</selection>
}
return 0
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(a: Int): Int {
a.let {
return i(it)
}
return 0
}
private fun i(it: Int): Int {
if (it > 0) return it else return -it
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(a: Int): Int {
a.let {
<selection>if (it > 0) return@foo it else return -it</selection>
}
return 0
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(a: Int): Int {
a.let {
return@foo i(it)
}
return 0
}
private fun i(it: Int): Int {
if (it > 0) return it else return -it
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(): Int {
1.let { <selection>return it + 1</selection> }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(): Int {
1.let { return i(it) }
}
private fun i(it: Int): Int {
return it + 1
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(): Int {
1.let { <selection>return@foo it + 1</selection> }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Int defined in foo.<anonymous>
// PARAM_TYPES: kotlin.Int
fun foo(): Int {
1.let { return@foo i(it) }
}
private fun i(it: Int): Int {
return it + 1
}
@@ -0,0 +1,3 @@
fun foo(): Int {
<selection>return@foo 1</selection>
}
@@ -0,0 +1,7 @@
fun foo(): Int {
return@foo i()
}
private fun i(): Int {
return 1
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun foo(a: Int): Int {
a.let {
<selection>if (it > 0) return@let it else return@foo -it</selection>
}
return 0
}
@@ -0,0 +1 @@
Selected code fragment has multiple exit points