aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/descriptors
diff options
context:
space:
mode:
authorFilip Zybała <fzybala@virtuslab.com>2020-03-17 09:30:24 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-25 13:19:31 +0100
commitba16f209faaf02e3300f2c04fec6c9e5b9ebc152 (patch)
tree2020e93477be4beacdfadd1917ec75f8b0b66c20 /plugins/base/src/main/kotlin/translators/descriptors
parent9110dbc70e42d10c56d1e080fdaeecd1ea13d84f (diff)
downloaddokka-ba16f209faaf02e3300f2c04fec6c9e5b9ebc152.tar.gz
dokka-ba16f209faaf02e3300f2c04fec6c9e5b9ebc152.tar.bz2
dokka-ba16f209faaf02e3300f2c04fec6c9e5b9ebc152.zip
Refactored extension method and signature builder. Added indentation to class signature.
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/descriptors')
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt31
1 files changed, 14 insertions, 17 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index bd21f9df..c30d99b7 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -296,7 +296,9 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
modifier = descriptor.modifier(),
generics = descriptor.typeParameters.map { it.toTypeParameter() },
platformData = listOf(platformData),
- extra = PropertyContainer.withAll(descriptor.additionalExtras(), descriptor.getAnnotations())
+ extra = PropertyContainer.withAll<DFunction>(descriptor.additionalExtras(), descriptor.getAnnotations()).let {
+ if(descriptor.isPrimary) { it + PrimaryConstructorExtra } else it
+ }
)
}
@@ -475,23 +477,18 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
} else {
PlatformDependent(mapOf(platformData to DescriptorDocumentableSource(this)))
}
-
+
fun FunctionDescriptor.additionalExtras() = listOfNotNull(
- ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
- ExtraModifiers.INFIX.takeIf { isInfix },
- ExtraModifiers.INLINE.takeIf { isInline },
- ExtraModifiers.SUSPEND.takeIf { isSuspend },
- ExtraModifiers.OPERATOR.takeIf { isOperator },
- ExtraModifiers.STATIC.takeIf { isJvmStaticInObjectOrClassOrInterface() },
- ExtraModifiers.TAILREC.takeIf { isTailrec },
- ExtraModifiers.EXTERNAL.takeIf { isExternal },
- ExtraModifiers.OVERRIDE.takeIf { DescriptorUtils.isOverride(this) }
- ).toProperty()
-
- inline fun <reified D : Documentable> ConstructorDescriptor.additionalExtras(): PropertyContainer<D> =
- if(this.isPrimary)
- (this as FunctionDescriptor).additionalExtras<D>() + PrimaryConstructorExtra
- else (this as FunctionDescriptor).additionalExtras()
+ ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
+ ExtraModifiers.INFIX.takeIf { isInfix },
+ ExtraModifiers.INLINE.takeIf { isInline },
+ ExtraModifiers.SUSPEND.takeIf { isSuspend },
+ ExtraModifiers.OPERATOR.takeIf { isOperator },
+ ExtraModifiers.STATIC.takeIf { isJvmStaticInObjectOrClassOrInterface() },
+ ExtraModifiers.TAILREC.takeIf { isTailrec },
+ ExtraModifiers.EXTERNAL.takeIf { isExternal },
+ ExtraModifiers.OVERRIDE.takeIf { DescriptorUtils.isOverride(this) }
+ ).toProperty()
fun ClassDescriptor.additionalExtras() = listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },