diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2021-02-05 15:52:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 15:52:49 +0100 |
commit | cb010f5988667ec1114c11a09815538361f10d48 (patch) | |
tree | aa42d8b0d7229560add204207e1e8504069e24b7 /kotlin-analysis/src/main | |
parent | a78e47a8d3d0dae7b68b0e414967e20ffb6e9a18 (diff) | |
download | dokka-cb010f5988667ec1114c11a09815538361f10d48.tar.gz dokka-cb010f5988667ec1114c11a09815538361f10d48.tar.bz2 dokka-cb010f5988667ec1114c11a09815538361f10d48.zip |
Fix links to method parameters from documentation (#1713)
Diffstat (limited to 'kotlin-analysis/src/main')
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt | 6 | ||||
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRITargetFactory.kt | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt index f47bf34b..3dd28fed 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt @@ -10,7 +10,9 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull fun DRI.Companion.from(descriptor: DeclarationDescriptor) = descriptor.parentsWithSelf.run { - val callable = firstIsInstanceOrNull<CallableDescriptor>() + val parameter = firstIsInstanceOrNull<ValueParameterDescriptor>() + val callable = parameter?.containingDeclaration ?: firstIsInstanceOrNull<CallableDescriptor>() + DRI( firstIsInstanceOrNull<PackageFragmentDescriptor>()?.fqName?.asString() ?: "", (filterIsInstance<ClassDescriptor>() + filterIsInstance<TypeAliasDescriptor>()).toList() @@ -18,7 +20,7 @@ fun DRI.Companion.from(descriptor: DeclarationDescriptor) = descriptor.parentsWi ?.asReversed() ?.joinToString(separator = ".") { it.name.asString() }, callable?.let { Callable.from(it) }, - DriTarget.from(descriptor) + DriTarget.from(parameter ?: descriptor) ) } diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRITargetFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRITargetFactory.kt index 031a5a32..e1e93962 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRITargetFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRITargetFactory.kt @@ -8,10 +8,7 @@ import org.jetbrains.dokka.links.DriTarget import org.jetbrains.dokka.links.PointingToCallableParameters import org.jetbrains.dokka.links.PointingToDeclaration import org.jetbrains.dokka.links.PointingToGenericParameters -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.descriptors.ParameterDescriptor -import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull @@ -19,6 +16,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull fun DriTarget.Companion.from(descriptor: DeclarationDescriptor): DriTarget = descriptor.parentsWithSelf.run { return when (descriptor) { is TypeParameterDescriptor -> PointingToGenericParameters(descriptor.index) + is ValueParameterDescriptor -> PointingToCallableParameters(descriptor.index) else -> { val callable = firstIsInstanceOrNull<CallableDescriptor>() val params = |