Extract Function: Allow to extract local variables which are used outside of extracted fragment
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// PARAM_TYPES: kotlin.Int, Comparable<Int>
|
||||
// PARAM_TYPES: kotlin.Int, Number, Comparable<Int>, Any
|
||||
// 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) {
|
||||
val b: Int = 1
|
||||
|
||||
<selection>if(a > 0) {
|
||||
println(a)
|
||||
}
|
||||
val c: Int
|
||||
println(b)</selection>
|
||||
|
||||
c = 1
|
||||
println(c)
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// PARAM_TYPES: kotlin.Int, Comparable<Int>
|
||||
// PARAM_TYPES: kotlin.Int, Number, Comparable<Int>, Any
|
||||
// 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) {
|
||||
val b: Int = 1
|
||||
|
||||
val c: Int
|
||||
unit(a, b)
|
||||
|
||||
c = 1
|
||||
println(c)
|
||||
}
|
||||
|
||||
fun unit(a: Int, b: Int) {
|
||||
if (a > 0) {
|
||||
println(a)
|
||||
}
|
||||
val c: Int
|
||||
println(b)
|
||||
}
|
||||
Reference in New Issue
Block a user