PsiElement (PsiElement place) { PsiElement parent = place; while (true) { if (parent == null) { return null; } if (parent instanceof GrDeclarationHolder && !(parent instanceof GrClosableBlock && parent.getParent() instanceof GrStringInjection)) { return parent; } if (parent instanceof GrLoopStatement) { return parent; } parent = parent.getParent(); } }