aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
authorAndrey Tyrin <andrei.tyrin@jetbrains.com>2023-01-31 13:25:38 +0100
committerGitHub <noreply@github.com>2023-01-31 13:25:38 +0100
commiteb54d69a5cd8e27b1235a23b9098e285c408cb23 (patch)
tree6b67c54d27e7c09bc0b818f56ba826d3504329e8 /plugins/base/src/main
parente43249b992ba087b3ce0f2f1226281210015a8d1 (diff)
downloaddokka-eb54d69a5cd8e27b1235a23b9098e285c408cb23.tar.gz
dokka-eb54d69a5cd8e27b1235a23b9098e285c408cb23.tar.bz2
dokka-eb54d69a5cd8e27b1235a23b9098e285c408cb23.zip
fill packageName and classNames for constructors from parent (#2837)
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index f67ee15c..c410104c 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -300,7 +300,7 @@ class DefaultPsiToDocumentableTranslator(
classlikes = classlikes.await(),
visibility = visibility,
companion = null,
- constructors = parseConstructors(),
+ constructors = parseConstructors(dri),
generics = mapTypeParameters(dri),
sourceSets = setOf(sourceSetData),
isExpectActual = false,
@@ -340,7 +340,7 @@ class DefaultPsiToDocumentableTranslator(
classlikes = classlikes.await(),
visibility = visibility,
companion = null,
- constructors = parseConstructors(),
+ constructors = parseConstructors(dri),
supertypes = ancestors,
sourceSets = setOf(sourceSetData),
isExpectActual = false,
@@ -376,7 +376,7 @@ class DefaultPsiToDocumentableTranslator(
else -> DClass(
dri = dri,
name = name.orEmpty(),
- constructors = parseConstructors(),
+ constructors = parseConstructors(dri),
functions = allFunctions.await(),
properties = allFields.await(),
classlikes = classlikes.await(),
@@ -401,13 +401,17 @@ class DefaultPsiToDocumentableTranslator(
}
}
- private fun PsiClass.parseConstructors(): List<DFunction> {
+ /*
+ * Parameter `parentDRI` required for substitute package name:
+ * in the case of synthetic constructor, it will return empty from [DRI.Companion.from].
+ */
+ private fun PsiClass.parseConstructors(parentDRI: DRI): List<DFunction> {
val constructors = when {
isAnnotationType || isInterface -> emptyArray()
isEnum -> this.constructors
else -> this.constructors.takeIf { it.isNotEmpty() } ?: arrayOf(createDefaultConstructor())
}
- return constructors.map { parseFunction(it, true) }
+ return constructors.map { parseFunction(psi = it, isConstructor = true, parentDRI = parentDRI) }
}
/**