Translate intention classes to Kotlin and apply refactoring
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
res = if (ok) {
|
||||
"ok"
|
||||
} else {
|
||||
"failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
if (ok) {
|
||||
res = "ok"
|
||||
} else {
|
||||
res = "failed"
|
||||
}
|
||||
+1
-1
@@ -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>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
return if (ok) {
|
||||
"ok"
|
||||
} else "failed"
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
if (ok) {
|
||||
return "ok"
|
||||
}
|
||||
return "failed"
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
res = when (n) {
|
||||
1 -> "one"
|
||||
2 -> "two"
|
||||
else -> "many"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
}
|
||||
+1
-1
@@ -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>
|
||||
Reference in New Issue
Block a user