aboutsummaryrefslogtreecommitdiff
path: root/kotlin-analysis/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'kotlin-analysis/src/main/kotlin')
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt6
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRITargetFactory.kt6
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 =