1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-27 12:38:45 +00:00

update klassindex code

This commit is contained in:
InsanusMokrassar 2021-06-23 22:18:06 +06:00
parent ccf89830bd
commit bf9268a30f

View File

@ -33,7 +33,8 @@ fun printlnInstancesSubclassesFuns(kclass: KClass<*>, subclasses: Set<KClass<*>>
val imports = "import ${subclass.qualifiedName}" + if (typeUpperBounds.isEmpty()) "" else typeUpperBounds.joinToString("\nimport ", "\nimport ")
val subtype = "${subclass.simpleName}${if (typeUpperBounds.isEmpty()) "" else "<${typeUpperBounds.joinToString() { (it.classifier as KClass<*>).simpleName!! }}>"}"
val code = "@PreviewFeature\ninline fun ${kclass.simpleName}.as${subclass.simpleName}(): $subtype? = this as? $subtype\n" +
"@PreviewFeature\ninline fun ${kclass.simpleName}.require${subclass.simpleName}(): $subtype = this as $subtype"
"@PreviewFeature\ninline fun ${kclass.simpleName}.require${subclass.simpleName}(): $subtype = this as $subtype\n" +
"@PreviewFeature\ninline fun <T> ${kclass.simpleName}.when${subclass.simpleName}(block: (${subclass.simpleName}) -> T): $subtype = as${subclass.simpleName}() ?.let(block)"
imports to code
}
}