PsiExpression (PsiExpression expression) { PsiElement ancestor = expression.getParent(); while (true) { if (ancestor == null) { return null; } if (!(ancestor instanceof PsiExpression)) { return null; } if (!(ancestor instanceof PsiParenthesizedExpression)) { return (PsiExpression)ancestor; } ancestor = ancestor.getParent(); } }