diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2019-06-13 14:16:54 +0200 |
---|---|---|
committer | Kamil Doległo <kamilok1965@interia.pl> | 2019-06-13 14:18:31 +0200 |
commit | 2460de3be8010a2e16c5ee91bb5d2a28cb54796f (patch) | |
tree | 28d19f019249930ca0d85854cefab811ad713f1a /core/src | |
parent | b519e0e4f3c795efba1eb6632d6440d142340bb8 (diff) | |
download | dokka-2460de3be8010a2e16c5ee91bb5d2a28cb54796f.tar.gz dokka-2460de3be8010a2e16c5ee91bb5d2a28cb54796f.tar.bz2 dokka-2460de3be8010a2e16c5ee91bb5d2a28cb54796f.zip |
Cherry-pick NPE bugfix
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt b/core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt index c72dbdda..c7187b23 100644 --- a/core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt +++ b/core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt @@ -23,14 +23,11 @@ class KotlinElementSignatureProvider @Inject constructor( } -fun PsiElement.extractDescriptor(resolutionFacade: DokkaResolutionFacade): DeclarationDescriptor? { - val forPsi = this - - return when (forPsi) { +fun PsiElement.extractDescriptor(resolutionFacade: DokkaResolutionFacade): DeclarationDescriptor? = + when (val forPsi = this) { is KtLightClassForFacade -> resolutionFacade.moduleDescriptor.getPackage(forPsi.fqName) - is KtLightElement<*, *> -> return (forPsi.kotlinOrigin!!).extractDescriptor(resolutionFacade) + is KtLightElement<*, *> -> (forPsi.kotlinOrigin!!).extractDescriptor(resolutionFacade) is PsiPackage -> resolutionFacade.moduleDescriptor.getPackage(FqName(forPsi.qualifiedName)) is PsiMember -> forPsi.getJavaOrKotlinMemberDescriptor(resolutionFacade) else -> resolutionFacade.resolveSession.bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, forPsi] } -} |