[kotlin] KTIJ-24123 Extract OperatorToFunctionConverter from OperatorToFunctionIntention

Put it into the common module so it can be used from
any other module without any classloading issues

^KTIJ-24123 Fixed

GitOrigin-RevId: 961600131f26e2635ee19222523c26b351d7f1ce
This commit is contained in:
Roman Golyshev
2023-01-10 14:42:54 +01:00
committed by intellij-monorepo-bot
parent f86fff54e4
commit a2cec2d168
15 changed files with 337 additions and 325 deletions

View File

@@ -19,8 +19,8 @@ import org.jetbrains.kotlin.idea.codeInsight.shorten.addToShorteningWaitSet
import org.jetbrains.kotlin.idea.core.ShortenReferences
import org.jetbrains.kotlin.idea.core.canMoveLambdaOutsideParentheses
import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParentheses
import org.jetbrains.kotlin.idea.codeInsight.intentions.shared.OperatorToFunctionIntention
import org.jetbrains.kotlin.idea.kdoc.KDocElementFactory
import org.jetbrains.kotlin.idea.refactoring.intentions.OperatorToFunctionConverter
import org.jetbrains.kotlin.idea.references.*
import org.jetbrains.kotlin.idea.util.application.isDispatchThread
import org.jetbrains.kotlin.lexer.KtSingleValueToken
@@ -296,7 +296,7 @@ class K1ReferenceMutateService : KtReferenceMutateServiceBase() {
override fun replaceWithImplicitInvokeInvocation(newExpression: KtDotQualifiedExpression): KtExpression? {
val canMoveLambda = newExpression.getPossiblyQualifiedCallExpression()?.canMoveLambdaOutsideParentheses() == true
return OperatorToFunctionIntention.replaceExplicitInvokeCallWithImplicit(newExpression)?.let { newQualifiedExpression ->
return OperatorToFunctionConverter.replaceExplicitInvokeCallWithImplicit(newExpression)?.let { newQualifiedExpression ->
newQualifiedExpression.getPossiblyQualifiedCallExpression()
?.takeIf { canMoveLambda }
?.let(KtCallExpression::moveFunctionLiteralOutsideParentheses)