TODOs
This commit is contained in:
+4
-1
@@ -67,10 +67,13 @@ public class DeprecatedCallableAddReplaceWithIntention : JetSelfTargetingRangeIn
|
|||||||
.replace("\\", "\\\\")
|
.replace("\\", "\\\\")
|
||||||
.replace("\"", "\\\"")
|
.replace("\"", "\\\"")
|
||||||
|
|
||||||
|
//TODO: escape $!
|
||||||
|
|
||||||
val argumentText = StringBuilder {
|
val argumentText = StringBuilder {
|
||||||
append("kotlin.ReplaceWith(\"")
|
append("kotlin.ReplaceWith(\"")
|
||||||
append(escapedText)
|
append(escapedText)
|
||||||
append("\"")
|
append("\"")
|
||||||
|
//TODO: who should escape keywords here?
|
||||||
replaceWith.imports.forEach { append(",\"").append(it).append("\"") }
|
replaceWith.imports.forEach { append(",\"").append(it).append("\"") }
|
||||||
append(")")
|
append(")")
|
||||||
}.toString()
|
}.toString()
|
||||||
@@ -164,7 +167,7 @@ public class DeprecatedCallableAddReplaceWithIntention : JetSelfTargetingRangeIn
|
|||||||
if (!hasBlockBody()) return body
|
if (!hasBlockBody()) return body
|
||||||
val block = body as? JetBlockExpression ?: return null
|
val block = body as? JetBlockExpression ?: return null
|
||||||
val statement = block.getStatements().singleOrNull() as? JetExpression ?: return null
|
val statement = block.getStatements().singleOrNull() as? JetExpression ?: return null
|
||||||
val returnsUnit = (analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this] as? FunctionDescriptor)?.getReturnType()?.isUnit() ?: true
|
val returnsUnit = (analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this] as? FunctionDescriptor)?.getReturnType()?.isUnit() ?: return null
|
||||||
return when (statement) {
|
return when (statement) {
|
||||||
is JetReturnExpression -> statement.getReturnedExpression()
|
is JetReturnExpression -> statement.getReturnedExpression()
|
||||||
else -> if (returnsUnit) statement else null
|
else -> if (returnsUnit) statement else null
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
fun foo(p: Int) {
|
fun foo(p: Int) {
|
||||||
if (p > 0) {
|
if (p > 0) {
|
||||||
val v = p + 1
|
val v = p + 1
|
||||||
bar(v)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user