Extract Function: Allow to extract local variables which are used outside of extracted fragment
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
// PARAM_DESCRIPTOR: value-parameter val a: kotlin.Int defined in foo
|
||||
// PARAM_DESCRIPTOR: val b: kotlin.Int defined in foo
|
||||
// SIBLING:
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<selection>if (a + b > 0) break
|
||||
val c: Int
|
||||
println(a - b)
|
||||
if (a - b > 0) break
|
||||
println(a + b)</selection>
|
||||
c = 1
|
||||
println(c)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
// PARAM_DESCRIPTOR: value-parameter val a: kotlin.Int defined in foo
|
||||
// PARAM_DESCRIPTOR: val b: kotlin.Int defined in foo
|
||||
// SIBLING:
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
val c: Int
|
||||
if (b(a, b)) break
|
||||
c = 1
|
||||
println(c)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun b(a: Int, b: Int): Boolean {
|
||||
if (a + b > 0) return true
|
||||
val c: Int
|
||||
println(a - b)
|
||||
if (a - b > 0) return true
|
||||
println(a + b)
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user