Update codegen, rearrange entry point

This commit is contained in:
Him188 2020-06-21 13:43:28 +08:00
parent 3743d9230e
commit 907b2ad946
2 changed files with 13 additions and 18 deletions

View File

@ -9,27 +9,28 @@
package net.mamoe.mirai.console.codegen package net.mamoe.mirai.console.codegen
object SettingCodegen {
object PrimitiveValuesCodegen : RegionCodegen(), DefaultInvoke {
override val defaultInvokeArgs: List<KtType>
get() = KtType.Primitives + KtString
override fun StringBuilder.apply(ktType: KtType) { object ValueKtCodegen {
@Suppress("ClassName") object SettingCodegen {
appendKCode( object PrimitiveValuesCodegen : RegionCodegen(), DefaultInvoke {
""" override val defaultInvokeArgs: List<KtType>
get() = KtType.Primitives + KtString
override fun StringBuilder.apply(ktType: KtType) {
@Suppress("ClassName")
appendKCode(
"""
/** /**
* Represents a non-null [$ktType] value. * Represents a non-null [$ktType] value.
*/ */
interface ${ktType}Value : PrimitiveValue<$ktType> interface ${ktType}Value : PrimitiveValue<$ktType>
""" """
) )
}
} }
} }
}
object ValueKtCodegen {
@JvmStatic @JvmStatic
fun main(args: Array<String>) { fun main(args: Array<String>) {
codegen("Value.kt") { codegen("Value.kt") {

View File

@ -120,9 +120,3 @@ fun String.findFileSmart(): File = kotlin.run {
}.also { }.also {
require(it.exists()) { "file doesn't exist" } require(it.exists()) { "file doesn't exist" }
} }
fun main() {
codegen("Value.kt") {
SettingCodegen.PrimitiveValuesCodegen()
}
}