diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt index f79214b89..cc1486ef2 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt @@ -53,14 +53,14 @@ class CodegenScope : MutableList by mutableListOf() { @RegionCodegenDsl operator fun RegionCodegen.invoke(ktTypes: Collection) { add(Replacer { - it.replace(Regex("""//// region $regionName CODEGEN START ////([\s\S]*?)//// endregion $regionName CODEGEN END ////""")) { + it.replace(Regex("""//// region $regionName CODEGEN ////([\s\S]*?)//// endregion $regionName CODEGEN ////""")) { val code = CodegenScope().apply { (this@invoke as Codegen).invoke(*ktTypes.toTypedArray()) }.applyTo("") """ - |//// region $regionName CODEGEN START //// + |//// region $regionName CODEGEN //// | |$code | - |//// endregion $regionName CODEGEN END //// + |//// endregion $regionName CODEGEN //// """.trimMargin() } }) 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 247a8ced0..1d2b9da28 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 @@ -92,8 +92,8 @@ val KtType.lowerCaseName: String get() = this.standardName.toLowerCase() inline fun kCode(@Language("kt") source: String) = source.trimIndent() fun codegen(targetFile: String, block: CodegenScope.() -> Unit) { - //// region PrimitiveValue CODEGEN START //// - //// region PrimitiveValue CODEGEN END //// + //// region PrimitiveValue CODEGEN //// + //// region PrimitiveValue CODEGEN //// targetFile.findFileSmart().also { println("Codegen target: ${it.absolutePath}") diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Setting.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Setting.kt index c6d68e2cf..2d32ddefc 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Setting.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Setting.kt @@ -40,13 +40,13 @@ internal abstract class SettingImpl { } -//// region Setting.value primitives CODEGEN START //// +//// region Setting.value primitives CODEGEN //// // TODO: 2020/6/19 CODEGEN fun Setting.value(value: Int): IntValue = TODO("codegen") -//// endregion Setting.value primitives CODEGEN END //// +//// endregion Setting.value primitives CODEGEN //// /** diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Value.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Value.kt index 14d29c8e8..8dee45afd 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Value.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/Value.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "unused") package net.mamoe.mirai.console.setting @@ -48,7 +48,7 @@ typealias ValueSerializer = KSerializer> interface PrimitiveValue : Value -//// region PrimitiveValues CODEGEN START //// +//// region PrimitiveValues CODEGEN //// /** * Represents a non-null [Byte] value. @@ -96,7 +96,7 @@ interface BooleanValue : PrimitiveValue interface StringValue : PrimitiveValue -//// endregion PrimitiveValues CODEGEN END //// +//// endregion PrimitiveValues CODEGEN //// @MiraiExperimentalAPI @@ -120,13 +120,13 @@ interface CompositeListValue : ListValue> interface PrimitiveListValue : ListValue -//// region PrimitiveListValue CODEGEN START //// +//// region PrimitiveListValue CODEGEN //// interface PrimitiveIntListValue : PrimitiveListValue interface PrimitiveLongListValue : PrimitiveListValue // TODO + codegen -//// endregion PrimitiveListValue CODEGEN END //// +//// endregion PrimitiveListValue CODEGEN //// /** @@ -147,13 +147,13 @@ interface CompositeSetValue : SetValue> interface PrimitiveSetValue : SetValue -//// region PrimitiveSetValue CODEGEN START //// +//// region PrimitiveSetValue CODEGEN //// interface PrimitiveIntSetValue : PrimitiveSetValue interface PrimitiveLongSetValue : PrimitiveSetValue // TODO + codegen -//// endregion PrimitiveSetValue CODEGEN END //// +//// endregion PrimitiveSetValue CODEGEN //// /** @@ -166,13 +166,13 @@ interface CompositeMapValue : MapValue, Value> interface PrimitiveMapValue : MapValue -//// region PrimitiveMapValue CODEGEN START //// +//// region PrimitiveMapValue CODEGEN //// interface PrimitiveIntIntMapValue : PrimitiveMapValue interface PrimitiveIntLongMapValue : PrimitiveMapValue // TODO + codegen -//// endregion PrimitiveSetValue CODEGEN END //// +//// endregion PrimitiveSetValue CODEGEN ////