From ca15d77f1df0bc9b83fe16d87a49e33bc28c0a93 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Thu, 22 May 2014 15:40:39 +0400 Subject: [PATCH] Simplify logic in ReplaceWithInfixFunctionCallIntention --- .../ReplaceWithInfixFunctionCallIntention.kt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceWithInfixFunctionCallIntention.kt b/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceWithInfixFunctionCallIntention.kt index d68f59361f1..54906496c0f 100644 --- a/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceWithInfixFunctionCallIntention.kt +++ b/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceWithInfixFunctionCallIntention.kt @@ -25,7 +25,6 @@ import org.jetbrains.jet.plugin.JetBundle import com.intellij.openapi.ui.popup.JBPopupFactory import org.jetbrains.jet.lang.psi.JetValueArgument import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache -import org.jetbrains.jet.analyzer.computeTypeInfoInContext import org.jetbrains.jet.lang.types.PackageType import org.jetbrains.jet.lang.psi.JetPsiUnparsingUtils import org.jetbrains.jet.lang.psi.JetPsiFactory @@ -91,20 +90,16 @@ public open class ReplaceWithInfixFunctionCallIntention : JetSelfTargetingIntent val valueArguments = element.getValueArgumentList()?.getArguments() ?: listOf() val functionLiteralArguments = element.getFunctionLiteralArguments() val bindingContext = AnalyzerFacadeWithCache.getContextForElement(parent) - val scope = bindingContext[BindingContext.RESOLUTION_SCOPE, parent] - + val receiverType = bindingContext[BindingContext.EXPRESSION_TYPE, receiver] when { - scope == null -> { + receiverType == null -> { intentionFailed(editor, "resolution.failed") return } - else -> - when (receiver.computeTypeInfoInContext(scope).getType()) { - is PackageType -> { - intentionFailed(editor, "package.call") - return - } - } + receiverType is PackageType -> { + intentionFailed(editor, "package.call") + return + } } rightHandTextStringBuilder.append(