KT-19355 fix for "Variable expected" error after J2K for increment/decrement of an object field

This commit is contained in:
Alex Chmyr
2019-09-19 17:33:31 +01:00
committed by Ilya Kirillov
parent 748e458ad7
commit b8cce67d2e
11 changed files with 59 additions and 2 deletions
@@ -534,9 +534,16 @@ public class KtPsiUtil {
return ((KtBinaryExpression) parentElement).getRight() == currentInner;
}
//'-(-x)' case
if (parentElement instanceof KtPrefixExpression && innerExpression instanceof KtPrefixExpression) {
return innerOperation == parentOperation && (innerOperation == KtTokens.PLUS || innerOperation == KtTokens.MINUS);
// +(++x) or +(+x) case
if (parentOperation == KtTokens.PLUS) {
return innerOperation == KtTokens.PLUS || innerOperation == KtTokens.PLUSPLUS;
}
// -(--x) or -(-x) case
if (parentOperation == KtTokens.MINUS) {
return innerOperation == KtTokens.MINUS || innerOperation == KtTokens.MINUSMINUS;
}
}
return false;
}