Replace fold/unfold intentions with a set of specialized ones
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
res = if (n == 1) {
|
||||
println("***")
|
||||
"one"
|
||||
} else {
|
||||
println("***")
|
||||
"two"
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
if (n == 1) {
|
||||
println("***")
|
||||
res = "one"
|
||||
} else {
|
||||
println("***")
|
||||
res = "two"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts branched (if/when) expression where each branch is terminated with assignment/return/method call into single
|
||||
assignment/return/method call with branched expression as argument
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
res = if (ok) {
|
||||
"ok"
|
||||
} else {
|
||||
"failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
if (ok) {
|
||||
res = "ok"
|
||||
} else {
|
||||
res = "failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<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>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
return if (ok) {
|
||||
"ok"
|
||||
} else "failed"
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
if (ok) {
|
||||
return "ok"
|
||||
}
|
||||
return "failed"
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts single-branch 'if' expression immediately followed by 'return' into a single 'return' with 'if' expression as an argument
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
return if (ok) {
|
||||
"ok"
|
||||
} else {
|
||||
"failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
if (ok) {
|
||||
return "ok"
|
||||
} else {
|
||||
return "failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<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>
|
||||
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<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>
|
||||
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<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>
|
||||
@@ -0,0 +1,5 @@
|
||||
if (ok) {
|
||||
res = "ok"
|
||||
} else {
|
||||
res = "failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
res = if (ok) {
|
||||
"ok"
|
||||
} else {
|
||||
"failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts assignment with 'if' right-hand side to 'if' expression where each branch is terminated with assignment
|
||||
</body>
|
||||
</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"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts assignment with 'when' right-hand side to 'when' expression where each branch is terminated with assignment
|
||||
</body>
|
||||
</html>
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
if (n == 1) {
|
||||
println("***")
|
||||
res = "one"
|
||||
} else {
|
||||
println("***")
|
||||
res = "two"
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
res = if (n == 1) {
|
||||
println("***")
|
||||
"one"
|
||||
} else {
|
||||
println("***")
|
||||
"two"
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts assignment/return/method call with branched (if/when) expression as argument
|
||||
to branched expression where each branch is terminated with assignment/return/method call
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
if (ok) {
|
||||
return "ok"
|
||||
} else {
|
||||
return "failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
return if (ok) {
|
||||
"ok"
|
||||
} else {
|
||||
"failed"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts 'return' with 'if' expression as a result to 'if' expression where each branch is terminated with 'return'
|
||||
</body>
|
||||
</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"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts 'return' with 'when' expression as a result to 'when' expression where each branch is terminated with 'return'
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user