use of org.jetbrains.kotlin.asJava.elements.KtLightMethod in project kotlin by JetBrains.
the class KotlinCalleeMethodsTreeStructure method buildChildren.
@NotNull
@Override
protected Object[] buildChildren(@NotNull HierarchyNodeDescriptor descriptor) {
PsiElement targetElement = getTargetElement(descriptor);
// Kotlin class constructor invoked from Java code
if (targetElement instanceof PsiMethod) {
PsiMethod psiMethod = (PsiMethod) targetElement;
if (psiMethod.isConstructor()) {
PsiClass psiClass = psiMethod.getContainingClass();
PsiElement navigationElement = psiClass != null ? psiClass.getNavigationElement() : null;
if (navigationElement instanceof KtClass) {
return buildChildrenByKotlinTarget(descriptor, (KtElement) navigationElement);
}
}
}
// Kotlin function or property invoked from Java code
if (targetElement instanceof KtLightMethod) {
return buildChildrenByKotlinTarget(descriptor, ((KtLightMethod) targetElement).getKotlinOrigin());
}
if (targetElement instanceof KtElement) {
return buildChildrenByKotlinTarget(descriptor, (KtElement) targetElement);
}
CallHierarchyNodeDescriptor javaDescriptor = descriptor instanceof CallHierarchyNodeDescriptor ? (CallHierarchyNodeDescriptor) descriptor : ((KotlinCallHierarchyNodeDescriptor) descriptor).getJavaDelegate();
return javaTreeStructure.getChildElements(javaDescriptor);
}
Aggregations