Extract Function: Allow to extract local variables which are used outside of extracted fragment
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
// SIBLING:
|
||||
fun foo() {
|
||||
<selection>val a = 1
|
||||
val b = 2</selection>
|
||||
println(a + b)
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Selected code fragment has multiple output values: a b
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// SIBLING:
|
||||
fun main(args: Array<String>) {
|
||||
<selection>val a = 1</selection>
|
||||
val t = object: T {
|
||||
override fun foo(n: Int) = n + a
|
||||
}
|
||||
}
|
||||
|
||||
trait T {
|
||||
fun foo(n: Int): Int
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
Following variables are used outside of selected code fragment: a
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// SIBLING:
|
||||
fun main(args: Array<String>) {
|
||||
<selection>val a = 1</selection>
|
||||
lambda {
|
||||
a
|
||||
}
|
||||
}
|
||||
|
||||
fun lambda(f: () -> Unit) {}
|
||||
-1
@@ -1 +0,0 @@
|
||||
Following variables are used outside of selected code fragment: a
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// SIBLING:
|
||||
fun main(args: Array<String>) {
|
||||
<selection>val a = 1</selection>
|
||||
fun foo() = a
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
Following variables are used outside of selected code fragment: a
|
||||
Reference in New Issue
Block a user