boolean (@NotNull PsiElement element) { PsiElement e = element.getParent(); int parentsVisited = 0; while (e != null && !(e instanceof PsiStatement) && parentsVisited < 5) { if (e instanceof PsiExpressionList) { return true; } e = e.getParent(); parentsVisited++; } return false; }