Split if intention preserves comments

This commit is contained in:
Valentin Kipyatkov
2015-05-23 22:55:43 +03:00
parent 4a2f2b62ec
commit df0d27b8b2
13 changed files with 178 additions and 19 deletions
@@ -0,0 +1,4 @@
fun foo(p: Int): Boolean {
if (p < 0 /* p < 0 */ <caret>|| p == 5 /* or 5 */) return false
return true
}
@@ -0,0 +1,5 @@
fun foo(p: Int): Boolean {
if (p < 0 /* p < 0 */) return false
if (p == 5 /* or 5 */) return false
return true
}
@@ -0,0 +1,10 @@
fun doSomething<T>(a: T) {}
fun foo() {
val a = true
val b = false
val c = true
if (a /*a*/ && b /*b*/ &<caret>& c /*c*/) {
doSomething("test")
}
}
@@ -0,0 +1,12 @@
fun doSomething<T>(a: T) {}
fun foo() {
val a = true
val b = false
val c = true
if (a /*a*/ && b /*b*/) {
if (c /*c*/) {
doSomething("test")
}
}
}
@@ -0,0 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo(p: Int) {
<caret>if (0 < p /* > 0 */ && p < 100 /* not too much */) {
doSomething("test")
}
}
@@ -0,0 +1,9 @@
fun doSomething<T>(a: T) {}
fun foo(p: Int) {
<caret>if (0 < p /* > 0 */) {
if (p < 100 /* not too much */) {
doSomething("test")
}
}
}
@@ -0,0 +1,7 @@
fun doSomething<T>(a: T) {}
fun foo(p: Int) {
<caret>if (p < 0 /* p < 0 */ || p > 100 /* too much */) {
doSomething("test")
}
}
@@ -0,0 +1,9 @@
fun doSomething<T>(a: T) {}
fun foo(p: Int) {
<caret>if (p < 0 /* p < 0 */) {
doSomething("test")
} else if (p > 100 /* too much */) {
doSomething("test")
}
}