aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-26 15:40:23 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-31 15:10:04 +0200
commit9bf535bf8c0b758fc0abf99b61208fa5430239d6 (patch)
treef11c932bb8314e8d9aa885825f678c628ce6fef9 /plugins/base/src/main/kotlin/translators
parentee13af00483887fb6cfdde10a58cbb43542cf2d7 (diff)
downloaddokka-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 'plugins/base/src/main/kotlin/translators')
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt16
1 files changed, 3 insertions, 13 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index fccbe716..18b05df4 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -104,7 +104,7 @@ private class DokkaDescriptorVisitor(
descriptor: PackageFragmentDescriptor,
parent: DRIWithPlatformInfo
): DPackage {
- val name = descriptor.fqName.asString().takeUnless { it.isBlank() } ?: fallbackPackageName()
+ val name = descriptor.fqName.asString().takeUnless { it.isBlank() } ?: ""
val driWithPlatform = DRI(packageName = name).withEmptyInfo()
val scope = descriptor.getMemberScope()
@@ -590,7 +590,7 @@ private class DokkaDescriptorVisitor(
private fun TypeParameterDescriptor.toVariantTypeParameter() =
DTypeParameter(
variantTypeParameter(
- TypeParameter(DRI.from(this).withPackageFallbackTo(fallbackPackageName()), name.identifier)
+ TypeParameter(DRI.from(this), name.identifier)
),
resolveDescriptorData(),
null,
@@ -603,7 +603,7 @@ private class DokkaDescriptorVisitor(
is DynamicType -> Dynamic
else -> when (val ctor = constructor.declarationDescriptor) {
is TypeParameterDescriptor -> TypeParameter(
- dri = DRI.from(ctor).withPackageFallbackTo(fallbackPackageName()),
+ dri = DRI.from(ctor),
name = ctor.name.asString()
)
else -> TypeConstructor(
@@ -776,14 +776,4 @@ private class DokkaDescriptorVisitor(
private fun ConstantsEnumValue.fullEnumEntryName() =
"${this.enumClassId.relativeClassName.asString()}.${this.enumEntryName.identifier}"
- private fun fallbackPackageName(): String =
- "[${sourceSet.displayName} root]"// TODO: error-prone, find a better way to do it
-}
-
-private fun DRI.withPackageFallbackTo(fallbackPackage: String): DRI {
- return if (packageName.isNullOrBlank()) {
- copy(packageName = fallbackPackage)
- } else {
- this
- }
}