Simplify logic in ReplaceWithInfixFunctionCallIntention

This commit is contained in:
Pavel V. Talanov
2014-05-22 15:40:39 +04:00
parent 3334857870
commit ca15d77f1d
@@ -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<JetValueArgument>()
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(