diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-06-21 12:20:57 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-06-24 13:56:49 +0200 |
commit | 75ca42c675a3586c0bdfc9c5320f283d097bb27d (patch) | |
tree | 95e7b1d662e27a7f5d202d8b0e6da4de70d1c8d3 /plugins/base/src/main/kotlin | |
parent | e17b0064e415c52d297455729c220d54341bc403 (diff) | |
download | dokka-75ca42c675a3586c0bdfc9c5320f283d097bb27d.tar.gz dokka-75ca42c675a3586c0bdfc9c5320f283d097bb27d.tar.bz2 dokka-75ca42c675a3586c0bdfc9c5320f283d097bb27d.zip |
Internal links
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 4764fbcb..9dc87d91 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -554,19 +554,15 @@ private class DokkaDescriptorVisitor( getDocumentation()?.toSourceSetDependent() ?: emptyMap() private fun ClassDescriptor.resolveClassDescriptionData(): ClassInfo { - val superClasses = hashSetOf<ClassDescriptor>() - + val interfaces = hashSetOf<DRI>() fun processSuperClasses(supers: List<ClassDescriptor>) { supers.forEach { - superClasses.add(it) + if(it.kind == ClassKind.INTERFACE) interfaces.add(DRI.from(it)) processSuperClasses(it.getSuperInterfaces() + it.getAllSuperclassesWithoutAny()) } } processSuperClasses(getSuperInterfaces() + getAllSuperclassesWithoutAny()) - return ClassInfo( - superClasses.map { Supertype(DRI.from(it), it.kind == ClassKind.INTERFACE) }.toList(), - resolveDescriptorData() - ) + return ClassInfo(getAllSuperclassesWithoutAny().map { DRI.from(it) }, interfaces.toList(), resolveDescriptorData()) } private fun TypeParameterDescriptor.toTypeParameter() = @@ -739,12 +735,9 @@ private class DokkaDescriptorVisitor( private fun ValueArgument.childrenAsText() = this.safeAs<KtValueArgument>()?.children?.map {it.text }.orEmpty() - private data class ClassInfo(private val allSupertypes: List<Supertype>, val docs: SourceSetDependent<DocumentationNode>){ + private data class ClassInfo(val superclasses: List<DRI>, val interfaces: List<DRI>, val docs: SourceSetDependent<DocumentationNode>){ val supertypes: List<DRI> - get() = allSupertypes.map { it.dri } - - val interfaces: List<DRI> - get() = allSupertypes.filter { it.isInterface }.map { it.dri } + get() = (superclasses + interfaces).distinct() } private fun Visibility.toDokkaVisibility(): org.jetbrains.dokka.model.Visibility = when (this) { @@ -759,8 +752,6 @@ private class DokkaDescriptorVisitor( "${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 data class Supertype(val dri: DRI, val isInterface: Boolean) } private fun DRI.withPackageFallbackTo(fallbackPackage: String): DRI { |