Rewrite out-of-block modifier increment algorithm
1. Search the top-level function or property (only they can produce blocks that won't affect other declarations)
2. Check if current position is hidden by this declaration
O^2 behaviour is removed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// FALSE
|
||||
|
||||
class Test {
|
||||
class Other {
|
||||
fun test() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// FALSE
|
||||
|
||||
class Test {
|
||||
class Other {
|
||||
fun test() {
|
||||
val a<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// FALSE
|
||||
fun test() {
|
||||
class Test {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// TRUE
|
||||
// (Investigation starts from parent)
|
||||
|
||||
fun test() : Int = <caret>12
|
||||
@@ -0,0 +1,3 @@
|
||||
// FALSE
|
||||
|
||||
fun test() : Int = 12 + <caret>12
|
||||
@@ -0,0 +1,6 @@
|
||||
// TRUE
|
||||
class Test {
|
||||
class Other {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// TRUE
|
||||
|
||||
val a = 1
|
||||
fun test() = if (a) {
|
||||
fun hello() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// FALSE
|
||||
fun test() {
|
||||
val some = if () {
|
||||
fun other() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// FALSE
|
||||
trait Some
|
||||
|
||||
fun test() {
|
||||
val foo = object: Some {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// FALSE
|
||||
trait Some
|
||||
|
||||
fun test() {
|
||||
object : Some {
|
||||
fun test(<caret>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// FALSE
|
||||
object Some {
|
||||
fun test() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// FALSE
|
||||
|
||||
object Some {
|
||||
fun test() {
|
||||
if (<caret>)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// TRUE
|
||||
|
||||
// TODO: Investigate
|
||||
|
||||
val test = "so<caret>me"
|
||||
@@ -0,0 +1,3 @@
|
||||
// FALSE
|
||||
|
||||
val test: String = "<caret>"
|
||||
Reference in New Issue
Block a user