j2k: fix converter
(cherry picked from commit a21e85b)
This commit is contained in:
committed by
Nikolay Krasko
parent
9970289efb
commit
727ff15af3
@@ -27,22 +27,17 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
|||||||
|
|
||||||
class KotlinTypeDeclarationProvider : TypeDeclarationProvider {
|
class KotlinTypeDeclarationProvider : TypeDeclarationProvider {
|
||||||
override fun getSymbolTypeDeclarations(symbol: PsiElement): Array<PsiElement>? {
|
override fun getSymbolTypeDeclarations(symbol: PsiElement): Array<PsiElement>? {
|
||||||
if (symbol is KtElement && symbol.getContainingFile() is KtFile) {
|
if (symbol !is KtElement || symbol.getContainingFile() !is KtFile) return emptyArray()
|
||||||
val bindingContext = symbol.analyze()
|
|
||||||
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, symbol)
|
val bindingContext = symbol.analyze()
|
||||||
if (descriptor is CallableDescriptor) {
|
val callableDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, symbol)
|
||||||
val type = descriptor.returnType
|
if (callableDescriptor !is CallableDescriptor) return emptyArray()
|
||||||
if (type != null) {
|
|
||||||
val classifierDescriptor = type.constructor.declarationDescriptor
|
val type = callableDescriptor.returnType ?: return emptyArray()
|
||||||
if (classifierDescriptor != null) {
|
|
||||||
val typeElement = DescriptorToSourceUtils.descriptorToDeclaration(classifierDescriptor)
|
val classifierDescriptor = type.constructor.declarationDescriptor ?: return emptyArray()
|
||||||
if (typeElement != null) {
|
val typeElement = DescriptorToSourceUtils.descriptorToDeclaration(classifierDescriptor) ?: return emptyArray()
|
||||||
return arrayOf(typeElement)
|
|
||||||
}
|
return arrayOf(typeElement)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return arrayOfNulls(0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user