Translate intention classes to Kotlin and apply refactoring

This commit is contained in:
Alexey Sedunov
2013-11-18 13:37:56 +04:00
parent 6b971fa50c
commit 72f4ae3a13
54 changed files with 527 additions and 505 deletions
@@ -0,0 +1,5 @@
res = if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
if (ok) {
res = "ok"
} else {
res = "failed"
}
@@ -2,4 +2,4 @@
<body>
This intention converts 'if' expression where each branch is terminated with assignment into a single assignment with 'if' expression as a right-hand side
</body>
</html>
</html>
@@ -0,0 +1,3 @@
return if (ok) {
"ok"
} else "failed"
@@ -0,0 +1,4 @@
if (ok) {
return "ok"
}
return "failed"
@@ -2,4 +2,4 @@
<body>
This intention converts single-branch 'if' expression immediately followed by 'return' into a single 'return' with 'if' expression as an argument
</body>
</html>
</html>
@@ -0,0 +1,5 @@
return if (ok) {
"ok"
} else {
"failed"
}
@@ -0,0 +1,5 @@
if (ok) {
return "ok"
} else {
return "failed"
}
@@ -2,4 +2,4 @@
<body>
This intention converts 'if' expression where each branch is terminated with 'return' into a single 'return' with 'if' expression as a right-hand side
</body>
</html>
</html>
@@ -0,0 +1,5 @@
res = when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "many"
}
@@ -2,4 +2,4 @@
<body>
This intention converts 'when' expression where each branch is terminated with assignment into a single assignment with 'when' expression as right-hand side
</body>
</html>
</html>
@@ -0,0 +1,5 @@
return when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -0,0 +1,5 @@
when (n) {
1 -> return "one"
2 -> return "two"
else -> return "many"
}
@@ -2,4 +2,4 @@
<body>
This intention converts 'when' expression where each branch is terminated with 'return' into a single 'return' with 'when' expression as a right-hand side
</body>
</html>
</html>
@@ -0,0 +1,5 @@
if (ok) {
res = "ok"
} else {
res = "failed"
}
@@ -0,0 +1,5 @@
res = if (ok) {
"ok"
} else {
"failed"
}
@@ -2,4 +2,4 @@
<body>
This intention converts assignment with 'if' right-hand side to 'if' expression where each branch is terminated with assignment
</body>
</html>
</html>
@@ -0,0 +1,5 @@
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "many"
}
@@ -0,0 +1,5 @@
res = when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -2,4 +2,4 @@
<body>
This intention converts assignment with 'when' right-hand side to 'when' expression where each branch is terminated with assignment
</body>
</html>
</html>
@@ -0,0 +1,6 @@
val res: String
if (ok) {
res = "ok"
} else {
res = "failed"
}
@@ -0,0 +1,5 @@
val res = if (ok) {
"ok"
} else {
"failed"
}
@@ -2,4 +2,4 @@
<body>
This intention converts property with 'if' initializer to uninitialized property followed by 'if' expression where each branch is terminated with assignment
</body>
</html>
</html>
@@ -0,0 +1,6 @@
val res: String
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "many"
}
@@ -0,0 +1,5 @@
val res = when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -2,4 +2,4 @@
<body>
This intention converts property with 'when' initializer to uninitialized property followed by 'when' expression where each branch is terminated with assignment
</body>
</html>
</html>
@@ -0,0 +1,5 @@
if (ok) {
return "ok"
} else {
return "failed"
}
@@ -0,0 +1,5 @@
return if (ok) {
"ok"
} else {
"failed"
}
@@ -2,4 +2,4 @@
<body>
This intention converts 'return' with 'if' expression as a result to 'if' expression where each branch is terminated with 'return'
</body>
</html>
</html>
@@ -0,0 +1,5 @@
when (n) {
1 -> return "one"
2 -> return "two"
else -> return "many"
}
@@ -0,0 +1,5 @@
return when (n) {
1 -> "one"
2 -> "two"
else -> "many"
}
@@ -2,4 +2,4 @@
<body>
This intention converts 'return' with 'when' expression as a result to 'when' expression where each branch is terminated with 'return'
</body>
</html>
</html>