Revert "Refactoring: Remove hard-coded augmented assignment check with a Name check"
This reverts commit 016e78e4
This commit is contained in:
+2
-6
@@ -8,11 +8,9 @@ package org.jetbrains.kotlin.idea.intentions
|
||||
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
class ReplaceWithOrdinaryAssignmentIntention : SelfTargetingIntention<KtBinaryExpression>(
|
||||
@@ -26,9 +24,7 @@ class ReplaceWithOrdinaryAssignmentIntention : SelfTargetingIntention<KtBinaryEx
|
||||
val left = element.left ?: return false
|
||||
if ((left.safeAs<KtQualifiedExpression>()?.selectorExpression ?: left) !is KtNameReferenceExpression) return false
|
||||
if (element.right == null) return false
|
||||
|
||||
val resultingDescriptor = operationReference.resolveToCall(BodyResolveMode.PARTIAL)?.resultingDescriptor ?: return false
|
||||
return resultingDescriptor.name !in OperatorNameConventions.ASSIGNMENT_OPERATIONS
|
||||
return operationReference.mainReference.resolve().safeAs<KtFunction>()?.name?.endsWith("Assign") != true
|
||||
}
|
||||
|
||||
override fun applyTo(element: KtBinaryExpression, editor: Editor?) {
|
||||
|
||||
Reference in New Issue
Block a user