List<GrExpression> (PsiElement elementAtCaret, boolean acceptVoidCalls) { final List<GrExpression> expressions = new ArrayList<>(); for (GrExpression expression = PsiTreeUtil.getParentOfType(elementAtCaret, GrExpression.class); expression != null; expression = PsiTreeUtil.getParentOfType(expression, GrExpression.class)) { if (expressions.contains(expression)) continue; if (expression instanceof GrParenthesizedExpression && !expressions.contains(((GrParenthesizedExpression)expression).getOperand())) { expressions.add(((GrParenthesizedExpression)expression).getOperand()); } if (expressionIsIncorrect(expression, acceptVoidCalls)) continue; expressions.add(expression); } return expressions; }