@Override public void visitJSBinaryExpression(@NotNull JSBinaryExpression expression) { super.visitJSBinaryExpression(expression); final IElementType sign = expression.getOperationSign(); if (!bitwiseTokens.contains(sign)) { return; } final JSExpression rhs = expression.getROperand(); if (rhs == null) { return; } final JSExpression lhs = expression.getLOperand(); final boolean isPointless; if (JSTokenTypes.AND.equals(sign)) { isPointless = andExpressionIsPointless(lhs, rhs); } else if (JSTokenTypes.OR.equals(sign)) { isPointless = orExpressionIsPointless(lhs, rhs); } else if (JSTokenTypes.XOR.equals(sign)) { isPointless = xorExpressionIsPointless(lhs, rhs); } else if (JSTokenTypes.LTLT.equals(sign) || JSTokenTypes.GTGT.equals(sign) || JSTokenTypes.GTGTGT.equals(sign)) { isPointless = shiftExpressionIsPointless(rhs); } else { isPointless = false; } if (isPointless) { registerError(expression, expression); } }
@Override public void visitJSConditionalExpression(JSConditionalExpression jsConditionalExpression) { super.visitJSConditionalExpression(jsConditionalExpression); final JSConditionalExpression containingConditionalExpression = PsiTreeUtil.getParentOfType(jsConditionalExpression, JSConditionalExpression.class, true); if (containingConditionalExpression == null) { return; } registerError(jsConditionalExpression); }