From c2b741232c0dbf4e44dbb477b6a11fb836cf0c33 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Fri, 11 Sep 2020 14:13:25 +0200 Subject: Hide derived members that are not public --- .../DefaultDescriptorToDocumentableTranslator.kt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'plugins/base/src/main/kotlin/translators/descriptors') diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index e1ba3cea..fe0c090b 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -388,12 +388,13 @@ private class DokkaDescriptorVisitor( } } - private suspend fun visitPropertyDescriptor(descriptor: PropertyDescriptor, parent: DRIWithPlatformInfo): DProperty { - val dri = parent.dri.copy(callable = Callable.from(descriptor)) + private suspend fun visitPropertyDescriptor(originalDescriptor: PropertyDescriptor, parent: DRIWithPlatformInfo): DProperty { + val dri = parent.dri.copy(callable = Callable.from(originalDescriptor)) + val descriptor = originalDescriptor.getConcreteDescriptor() val isExpect = descriptor.isExpect val isActual = descriptor.isActual - val actual = descriptor.createSources() + val actual = originalDescriptor.createSources() return coroutineScope { val generics = async { descriptor.typeParameters.parallelMap { it.toVariantTypeParameter() } } @@ -435,12 +436,13 @@ private class DokkaDescriptorVisitor( else overriddenDescriptors.first().createDRI(DRI.from(this)) - private suspend fun visitFunctionDescriptor(descriptor: FunctionDescriptor, parent: DRIWithPlatformInfo): DFunction { - val (dri, inheritedFrom) = descriptor.createDRI() + private suspend fun visitFunctionDescriptor(originalDescriptor: FunctionDescriptor, parent: DRIWithPlatformInfo): DFunction { + val (dri, inheritedFrom) = originalDescriptor.createDRI() + val descriptor = originalDescriptor.getConcreteDescriptor() val isExpect = descriptor.isExpect val isActual = descriptor.isActual - val actual = descriptor.createSources() + val actual = originalDescriptor.createSources() return coroutineScope { val generics = async { descriptor.typeParameters.parallelMap { it.toVariantTypeParameter() } } @@ -920,7 +922,11 @@ private class DokkaDescriptorVisitor( } } - private suspend fun ValueParameterDescriptor.getDefaultValue(): String? = + private fun T.getConcreteDescriptor(): T = + if (kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) this + else overriddenDescriptors.first().getConcreteDescriptor() as T + + private fun ValueParameterDescriptor.getDefaultValue(): String? = (source as? KotlinSourceElement)?.psi?.children?.find { it is KtExpression }?.text private suspend fun PropertyDescriptor.getDefaultValue(): String? = -- cgit