diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt similarity index 66% rename from backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingCodegen.kt rename to backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt index d6ac306e1..5f44ba567 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt @@ -9,27 +9,28 @@ package net.mamoe.mirai.console.codegen -object SettingCodegen { - object PrimitiveValuesCodegen : RegionCodegen(), DefaultInvoke { - override val defaultInvokeArgs: List - get() = KtType.Primitives + KtString - override fun StringBuilder.apply(ktType: KtType) { - @Suppress("ClassName") - appendKCode( - """ +object ValueKtCodegen { + object SettingCodegen { + object PrimitiveValuesCodegen : RegionCodegen(), DefaultInvoke { + override val defaultInvokeArgs: List + get() = KtType.Primitives + KtString + + override fun StringBuilder.apply(ktType: KtType) { + @Suppress("ClassName") + appendKCode( + """ /** * Represents a non-null [$ktType] value. */ interface ${ktType}Value : PrimitiveValue<$ktType> """ - ) + ) + } } + } -} - -object ValueKtCodegen { @JvmStatic fun main(args: Array) { codegen("Value.kt") { diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt index 1d2b9da28..241f971cf 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt @@ -119,10 +119,4 @@ fun String.findFileSmart(): File = kotlin.run { } }.also { require(it.exists()) { "file doesn't exist" } -} - -fun main() { - codegen("Value.kt") { - SettingCodegen.PrimitiveValuesCodegen() - } } \ No newline at end of file