Add quickfix removing names of function expressions

This commit is contained in:
Denis Zharkov
2015-05-16 22:09:04 +03:00
parent b650753643
commit 5b1f3080d3
10 changed files with 228 additions and 0 deletions
@@ -0,0 +1,7 @@
// "Remove identifier from function expression" "true"
fun foo() {
(fun bar<caret>() {
return@bar
})
}
@@ -0,0 +1,7 @@
// "Remove identifier from function expression" "true"
fun foo() {
(bar@ fun() {
return@bar
})
}
@@ -0,0 +1,46 @@
// "Remove identifier from function expressions in the whole project" "true"
inline fun run(block: () -> Unit) = block()
annotation class ann
fun foo() {
l2@ @ann l2@ fun local() {
run(l1@ fun() { return@l1 })
run(label@ expr@ fun() {
return@label
return@expr
})
}
}
class A {
fun bar() {
run(toRun@ fun() {
if (1 == 1) return@toRun
return@bar
})
run(
/* abc */ fun /* cde */ () {
return@bar
}
)
run(
/* abc */
foo@ fun /* cde */ () {
return@foo
}
)
}
init {
(foo@ fun A.() {
(fun() {
val x = 1
})
return@foo
})
}
}
@@ -0,0 +1,46 @@
// "Remove identifier from function expressions in the whole project" "true"
inline fun run(block: () -> Unit) = block()
annotation class ann
fun foo() {
l2@ @ann l2@ fun local() {
run(l1@ fun() { return@l1 })
run(label@ fun expr<caret>() {
return@label
return@expr
})
}
}
class A {
fun bar() {
run(fun toRun() {
if (1 == 1) return@toRun
return@bar
})
run(
/* abc */ fun /* cde */ toRun() {
return@bar
}
)
run(
/* abc */
fun /* cde */ foo() {
return@foo
}
)
}
init {
(fun A.foo() {
(fun bar() {
val x = 1
})
return@foo
})
}
}
@@ -0,0 +1,3 @@
fun main() {
(fun foo() {})
}