org.jetbrains.dokka.analysis.CallableFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dokka-analysis Show documentation
Show all versions of dokka-analysis Show documentation
Dokka is an API documentation engine for Kotlin and Java, performing the same function as Javadoc for Java
package org.jetbrains.dokka.analysis
import com.intellij.psi.PsiField
import com.intellij.psi.PsiMethod
import org.jetbrains.dokka.links.Callable
import org.jetbrains.dokka.links.JavaClassReference
import org.jetbrains.dokka.links.TypeReference
import org.jetbrains.kotlin.descriptors.CallableDescriptor
fun Callable.Companion.from(descriptor: CallableDescriptor, name: String? = null) = with(descriptor) {
Callable(
name ?: descriptor.name.asString(),
extensionReceiverParameter?.let { TypeReference.from(it) },
valueParameters.mapNotNull { TypeReference.from(it) }
)
}
fun Callable.Companion.from(psi: PsiMethod) = with(psi) {
Callable(
name,
null,
parameterList.parameters.map { param -> JavaClassReference(param.type.canonicalText) })
}
fun Callable.Companion.from(psi: PsiField): Callable {
return Callable(
name = psi.name,
receiver = null,
params = emptyList()
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy