Make JetOperationExpression an inheritor of JetExpression

This commit is contained in:
Alexey Sedunov
2014-10-22 19:12:40 +04:00
parent 8c87b242b3
commit 5b3a4ed7e0
3 changed files with 3 additions and 5 deletions
@@ -16,10 +16,9 @@
package org.jetbrains.jet.lang.psi; package org.jetbrains.jet.lang.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public interface JetOperationExpression extends PsiElement { public interface JetOperationExpression extends JetExpression {
@NotNull @NotNull
JetSimpleNameExpression getOperationReference(); JetSimpleNameExpression getOperationReference();
} }
@@ -88,7 +88,7 @@ public class SimplifyNegatedBinaryExpressionIntention : JetSelfTargetingIntentio
expression.getRight() expression.getRight()
) )
else -> throw IllegalStateException( else -> throw IllegalStateException(
"Expression is neither a JetIsExpression or JetBinaryExpression (checked by isApplicableTo): ${(expression : PsiElement).getText()}" "Expression is neither a JetIsExpression or JetBinaryExpression (checked by isApplicableTo): ${expression.getText()}"
) )
} }
) )
@@ -23,7 +23,6 @@ import org.jetbrains.jet.lang.psi.JetBlockExpression
import org.jetbrains.jet.lang.psi.JetElement import org.jetbrains.jet.lang.psi.JetElement
import org.jetbrains.jet.lang.psi.JetParameter import org.jetbrains.jet.lang.psi.JetParameter
import org.jetbrains.jet.lang.psi.JetOperationExpression import org.jetbrains.jet.lang.psi.JetOperationExpression
import com.intellij.psi.PsiElement
public class ConvertToForEachFunctionCallIntention : JetSelfTargetingIntention<JetForExpression>("convert.to.for.each.function.call.intention", javaClass()) { public class ConvertToForEachFunctionCallIntention : JetSelfTargetingIntention<JetForExpression>("convert.to.for.each.function.call.intention", javaClass()) {
override fun isApplicableTo(element: JetForExpression): Boolean { override fun isApplicableTo(element: JetForExpression): Boolean {
@@ -50,7 +49,7 @@ public class ConvertToForEachFunctionCallIntention : JetSelfTargetingIntention<J
val loopRange = element.getLoopRange()!! val loopRange = element.getLoopRange()!!
return when (loopRange) { return when (loopRange) {
is JetOperationExpression -> "(${(loopRange : PsiElement).getText()})" is JetOperationExpression -> "(${loopRange.getText()})"
else -> loopRange.getText() ?: throw AssertionError("LoopRange in ForExpression shouldn't be empty: expressionText = ${element.getText()}") else -> loopRange.getText() ?: throw AssertionError("LoopRange in ForExpression shouldn't be empty: expressionText = ${element.getText()}")
} }
} }