boolean (@NotNull PsiPolyadicExpression expression, @NotNull PsiElement token) { List<PsiExpression> afterOperands = new ArrayList<>(); for (PsiElement after = token; after != null; after = after.getNextSibling()) { if (after instanceof PsiExpression) { afterOperands.add((PsiExpression)after); } } for (PsiElement child = expression.getFirstChild(); child != token; child = child.getNextSibling()) { if (child instanceof PsiExpression) { for (PsiPatternVariable variable : JavaPsiPatternUtil.getExposedPatternVariables((PsiExpression)child)) { for (PsiExpression operand : afterOperands) { if (VariableAccessUtils.variableIsUsed(variable, operand)) return true; } } } } return false; }