render extension functions nicely in kdoc too
This commit is contained in:
@@ -74,19 +74,20 @@ abstract class KDocTemplate() : TextTemplate() {
|
|||||||
val arguments = t.arguments
|
val arguments = t.arguments
|
||||||
return if (c != null) {
|
return if (c != null) {
|
||||||
val prefix = if (c.isAnnotation()) "@" else ""
|
val prefix = if (c.isAnnotation()) "@" else ""
|
||||||
if (c.name.startsWith("jet.Function") && arguments.notEmpty()) {
|
val cname = c.name
|
||||||
|
if ((cname.startsWith("jet.Function") || cname.startsWith("jet.ExtensionFunction")) && arguments.notEmpty()) {
|
||||||
val rt = arguments.last()
|
val rt = arguments.last()
|
||||||
// TODO use drop()
|
// TODO use drop()
|
||||||
val rest = arguments.subList(0, arguments.size - 1).notNull()
|
val rest = arguments.subList(0, arguments.size - 1).notNull()
|
||||||
"${typeArguments(rest, "(", ")", "()")} <A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">-></a> ${link(rt)}"
|
"${typeArguments(rest, "(", ")", "()")} <A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">-></a> ${link(rt)}"
|
||||||
} else if (c.name.startsWith("jet.Tuple")) {
|
} else if (cname.startsWith("jet.Tuple")) {
|
||||||
if (arguments.isEmpty()) {
|
if (arguments.isEmpty()) {
|
||||||
"Unit"
|
"Unit"
|
||||||
} else {
|
} else {
|
||||||
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">#</a>${typeArguments(arguments, "(", ")", "()")}"
|
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">#</a>${typeArguments(arguments, "(", ")", "()")}"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val name = if (fullName) c.name else c.simpleName
|
val name = if (fullName) cname else c.simpleName
|
||||||
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">$prefix$name</A>${typeArguments(arguments)}"
|
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">$prefix$name</A>${typeArguments(arguments)}"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user