aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2019-06-13 14:16:54 +0200
committerKamil Doległo <kamilok1965@interia.pl>2019-06-13 14:18:31 +0200
commit2460de3be8010a2e16c5ee91bb5d2a28cb54796f (patch)
tree28d19f019249930ca0d85854cefab811ad713f1a /core/src/main/kotlin/Kotlin
parentb519e0e4f3c795efba1eb6632d6440d142340bb8 (diff)
downloaddokka-2460de3be8010a2e16c5ee91bb5d2a28cb54796f.tar.gz
dokka-2460de3be8010a2e16c5ee91bb5d2a28cb54796f.tar.bz2
dokka-2460de3be8010a2e16c5ee91bb5d2a28cb54796f.zip
Cherry-pick NPE bugfix
Diffstat (limited to 'core/src/main/kotlin/Kotlin')
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt9
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]
}
-}