diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-26 15:40:23 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-31 15:10:04 +0200 |
commit | 9bf535bf8c0b758fc0abf99b61208fa5430239d6 (patch) | |
tree | f11c932bb8314e8d9aa885825f678c628ce6fef9 /kotlin-analysis/src | |
parent | ee13af00483887fb6cfdde10a58cbb43542cf2d7 (diff) | |
download | dokka-9bf535bf8c0b758fc0abf99b61208fa5430239d6.tar.gz dokka-9bf535bf8c0b758fc0abf99b61208fa5430239d6.tar.bz2 dokka-9bf535bf8c0b758fc0abf99b61208fa5430239d6.zip |
Let `DRI.packageName` always be a real package name for root packages ("")
Diffstat (limited to 'kotlin-analysis/src')
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt index 217a3b7d..e74f9f6a 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull fun DRI.Companion.from(descriptor: DeclarationDescriptor) = descriptor.parentsWithSelf.run { val callable = firstIsInstanceOrNull<CallableDescriptor>() DRI( - firstIsInstanceOrNull<PackageFragmentDescriptor>()?.fqName?.asString(), + firstIsInstanceOrNull<PackageFragmentDescriptor>()?.fqName?.asString() ?: "", (filterIsInstance<ClassDescriptor>() + filterIsInstance<TypeAliasDescriptor>()).toList() .takeIf { it.isNotEmpty() } ?.asReversed() @@ -27,7 +27,7 @@ fun DRI.Companion.from(psi: PsiElement) = psi.parentsWithSelf.run { val psiField = firstIsInstanceOrNull<PsiField>() val classes = filterIsInstance<PsiClass>().filterNot { it is PsiTypeParameter }.toList() // We only want exact PsiClass types, not PsiTypeParameter subtype DRI( - classes.lastOrNull()?.qualifiedName?.substringBeforeLast('.', ""), + classes.lastOrNull()?.qualifiedName?.substringBeforeLast('.', "") ?: "", classes.toList().takeIf { it.isNotEmpty() }?.asReversed()?.mapNotNull { it.name }?.joinToString("."), psiMethod?.let { Callable.from(it) } ?: psiField?.let { Callable.from(it) }, DriTarget.from(psi) |