Find enclosing element for object literal in delegate #KT-8187 Fixed

This commit is contained in:
mglukhikh
2017-03-31 11:56:08 +03:00
committed by Mikhail Glukhikh
parent 6277476573
commit 9fa16364e1
3 changed files with 26 additions and 3 deletions
@@ -768,11 +768,14 @@ public class KtPsiUtil {
return (KtElement) parent;
}
}
if (current instanceof KtBlockExpression || current instanceof KtParameter) {
if (current instanceof KtBlockExpression || current instanceof KtParameter || current instanceof KtValueArgument) {
return (KtElement) current;
}
if (current instanceof KtValueArgument) {
return (KtElement) current;
if (current instanceof KtDelegatedSuperTypeEntry) {
PsiElement grandParent = current.getParent().getParent();
if (grandParent instanceof KtClassOrObject && !(grandParent.getParent() instanceof KtObjectLiteralExpression)) {
return (KtElement) grandParent;
}
}
current = parent;