Remove Right Part of Binary Expression Quick-Fix: Split to separate quick fixes for cast- and elvis-expressions

This commit is contained in:
Alexey Sedunov
2016-01-13 14:06:33 +03:00
parent 6be44f59da
commit 2e18ad7160
16 changed files with 108 additions and 81 deletions
@@ -201,4 +201,10 @@ fun KtParameter.dropDefaultValue() {
val from = equalsToken ?: return
val to = defaultValue ?: from
deleteChildRange(from, to)
}
fun dropEnclosingParenthesesIfPossible(expression: KtExpression): KtExpression {
val parent = expression.parent as? KtParenthesizedExpression ?: return expression
if (!KtPsiUtil.areParenthesesUseless(parent)) return expression
return parent.replaced(expression)
}