diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameter.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameter.java index 98a33cc04d3..20b8f9cd756 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameter.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameter.java @@ -173,10 +173,8 @@ public class KtParameter extends KtNamedDeclarationStub imp @Nullable public KtFunction getOwnerFunction() { - PsiElement parent = getParent(); - if (parent == null) return null; - PsiElement grandparent = parent.getParent(); - if (!(grandparent instanceof KtFunction)) return null; - return (KtFunction) grandparent; + PsiElement parent = getParentByStub(); + if (!(parent instanceof KtParameterList)) return null; + return ((KtParameterList) parent).getOwnerFunction(); } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameterList.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameterList.java index 53f60a742aa..06842f35fdb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameterList.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtParameterList.java @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub; @@ -61,4 +62,10 @@ public class KtParameterList extends KtElementImplStub