mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Improve performance
This commit is contained in:
parent
9a91c9b2a7
commit
927943322a
@ -19,10 +19,6 @@ import net.mamoe.mirai.console.setting.internal.isOdd
|
||||
import net.mamoe.mirai.console.setting.internal.valueFromKTypeImpl
|
||||
import net.mamoe.mirai.console.setting.internal.valueImpl
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.yamlkt.Yaml
|
||||
import net.mamoe.yamlkt.YamlConfiguration
|
||||
import net.mamoe.yamlkt.YamlConfiguration.ListSerialization.FLOW_SEQUENCE
|
||||
import net.mamoe.yamlkt.YamlConfiguration.MapSerialization.FLOW_MAP
|
||||
import net.mamoe.yamlkt.YamlNullableDynamicSerializer
|
||||
import kotlin.internal.LowPriorityInOverloadResolution
|
||||
import kotlin.reflect.KProperty
|
||||
@ -66,8 +62,7 @@ internal abstract class SettingImpl {
|
||||
|
||||
internal val valueNodes: MutableList<Node<*>> = mutableListOf()
|
||||
|
||||
internal open val updaterSerializer: KSerializer<Unit> by lazy {
|
||||
object : KSerializer<Unit> {
|
||||
internal open val updaterSerializer: KSerializer<Unit> = object : KSerializer<Unit> {
|
||||
override val descriptor: SerialDescriptor get() = settingUpdaterSerializerDescriptor
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@ -135,7 +130,6 @@ internal abstract class SettingImpl {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* flatten
|
||||
@ -145,22 +139,9 @@ internal abstract class SettingImpl {
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private val ABSENT_STUB = Any()
|
||||
|
||||
private val settingUpdaterSerializerTypeArguments = arrayOf(String.serializer(), YamlNullableDynamicSerializer)
|
||||
private val settingUpdaterSerializerDescriptor =
|
||||
MapSerializer(settingUpdaterSerializerTypeArguments[0], settingUpdaterSerializerTypeArguments[1]).descriptor
|
||||
|
||||
val allFlow = Yaml(
|
||||
YamlConfiguration(
|
||||
nonStrictNullability = true,
|
||||
nonStrictNumber = true,
|
||||
mapSerialization = FLOW_MAP,
|
||||
listSerialization = FLOW_SEQUENCE,
|
||||
classSerialization = FLOW_MAP
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
package net.mamoe.mirai.console.setting
|
||||
|
||||
interface SettingStorage
|
Loading…
Reference in New Issue
Block a user