mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
assignment expr: left op must be a variable/array access possibly wrapped in parenthesis
GitOrigin-RevId: 188dea30e5fb680b608cfa4afd1d3a0e6d8759c7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4b2770ab58
commit
c4eb244441
+9
-1
@@ -24,6 +24,7 @@ import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.tree.ChildRoleBase;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiAssignmentExpressionImpl extends ExpressionPsiElement implements PsiAssignmentExpression {
|
||||
@@ -58,7 +59,14 @@ public class PsiAssignmentExpressionImpl extends ExpressionPsiElement implements
|
||||
|
||||
@Override
|
||||
public PsiType getType() {
|
||||
return getLExpression().getType();
|
||||
//15.26.1 left side must be variable/array access probably wrapped in parenthesis, otherwise it's an invalid expression
|
||||
//because assignment expression itself is not a poly expression, its type may be calculated at any time
|
||||
//thus it's important to ensure that type of left side is not calculated for invalid expression, e.g. bar() = ""
|
||||
PsiExpression lExpression = PsiUtil.deparenthesizeExpression(getLExpression());
|
||||
if (lExpression instanceof PsiReferenceExpression || lExpression instanceof PsiArrayAccessExpression) {
|
||||
return lExpression.getType();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user