Rearrange implementations

This commit is contained in:
Him188 2020-05-22 20:07:47 +08:00
parent c87e8b07df
commit 6619c0b05a
8 changed files with 22 additions and 8 deletions

View File

@ -16,7 +16,7 @@ import java.io.File
fun main() { fun main() {
println(File("").absolutePath) // default project base dir println(File("").absolutePath) // default project base dir
File("backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/_ValueImpl.kt").apply { File("backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/internal/_ValueImpl.kt").apply {
createNewFile() createNewFile()
}.writeText(buildString { }.writeText(buildString {
appendln(COPYRIGHT) appendln(COPYRIGHT)

View File

@ -74,7 +74,7 @@ fun genPublicApi() = buildString {
appendln( appendln(
""" """
/** /**
* !!! These primitive types are auto-generated by backend/codegen/src/main/kotlin/net.mamoe.mirai.console.codegen.ValuesCodegen.kt * !!! This file is auto-generated by backend/codegen/src/main/kotlin/net.mamoe.mirai.console.codegen.ValuesCodegen.kt
* !!! for better performance * !!! for better performance
* !!! DO NOT MODIFY THIS FILE MANUALLY * !!! DO NOT MODIFY THIS FILE MANUALLY
*/ */

View File

@ -12,6 +12,7 @@
package net.mamoe.mirai.console.setting package net.mamoe.mirai.console.setting
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import net.mamoe.mirai.console.setting.internal.SettingImpl
import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.MiraiExperimentalAPI
import kotlin.properties.ReadWriteProperty import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty import kotlin.reflect.KProperty

View File

@ -10,6 +10,8 @@
package net.mamoe.mirai.console.setting package net.mamoe.mirai.console.setting
import net.mamoe.mirai.console.setting.internal.valueImpl
/** /**
* !!! This file is auto-generated by backend/codegen/src/kotlin/net.mamoe.mirai.console.codegen.SettingValueUseSiteCodegen.kt * !!! This file is auto-generated by backend/codegen/src/kotlin/net.mamoe.mirai.console.codegen.SettingValueUseSiteCodegen.kt
* !!! DO NOT MODIFY THIS FILE MANUALLY * !!! DO NOT MODIFY THIS FILE MANUALLY

View File

@ -7,13 +7,14 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.setting package net.mamoe.mirai.console.setting.internal
import kotlinx.serialization.Decoder import kotlinx.serialization.Decoder
import kotlinx.serialization.Encoder import kotlinx.serialization.Encoder
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialDescriptor import kotlinx.serialization.SerialDescriptor
import kotlinx.serialization.builtins.* import kotlinx.serialization.builtins.*
import net.mamoe.mirai.console.setting.*
/** /**
@ -1353,7 +1354,10 @@ internal fun <T : Setting> Setting.valueImpl(default: T): Value<T> {
} }
override fun serialize(encoder: Encoder, value: T) { override fun serialize(encoder: Encoder, value: T) {
internalValue.updaterSerializer.serialize(encoder, SettingSerializerMark) internalValue.updaterSerializer.serialize(
encoder,
SettingSerializerMark
)
} }
} }
} }

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.setting package net.mamoe.mirai.console.setting.internal
import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.ImplicitReflectionSerializer
import kotlinx.serialization.serializer import kotlinx.serialization.serializer

View File

@ -7,11 +7,14 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.setting package net.mamoe.mirai.console.setting.internal
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer
import net.mamoe.mirai.console.setting.SerialName
import net.mamoe.mirai.console.setting.Setting
import net.mamoe.mirai.console.setting.Value
import net.mamoe.yamlkt.Yaml import net.mamoe.yamlkt.Yaml
import net.mamoe.yamlkt.YamlConfiguration import net.mamoe.yamlkt.YamlConfiguration
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
@ -41,7 +44,10 @@ internal abstract class SettingImpl {
} }
override fun serialize(encoder: Encoder, value: Setting) { override fun serialize(encoder: Encoder, value: Setting) {
this@SettingImpl.updaterSerializer.serialize(encoder, SettingSerializerMark) this@SettingImpl.updaterSerializer.serialize(
encoder,
SettingSerializerMark
)
} }
} }
} }

View File

@ -7,11 +7,12 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.setting package net.mamoe.mirai.console.setting.internal
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.SetSerializer import kotlinx.serialization.builtins.SetSerializer
import net.mamoe.mirai.console.setting.*
import net.mamoe.yamlkt.YamlDynamicSerializer import net.mamoe.yamlkt.YamlDynamicSerializer
import kotlin.reflect.KClass import kotlin.reflect.KClass
import kotlin.reflect.full.createInstance import kotlin.reflect.full.createInstance