aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt5
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt16
2 files changed, 7 insertions, 14 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
index 096104cc..f25f85a6 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
@@ -89,7 +89,10 @@ open class DokkaLocationProvider(
private fun PageNode.parent() = pageGraphRoot.parentMap[this]
private val PageNode.pathName: String
- get() = if (this is PackagePageNode) name else identifierToFilename(name)
+ get() = when (this) {
+ is PackagePageNode -> if (name.isBlank()) "[root]" else name
+ else -> identifierToFilename(name)
+ }
companion object {
internal val reservedFilenames = setOf("index", "con", "aux", "lst", "prn", "nul", "eof", "inp", "out")
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
- }
}