Rearrange old codegen

This commit is contained in:
Him188 2020-06-24 02:05:17 +08:00
parent 9af8d74f36
commit 47e6328427
4 changed files with 38 additions and 9 deletions

View File

@ -8,7 +8,7 @@
*/
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen
package net.mamoe.mirai.console.codegen.old
/**
* used to generate Java Setting

View File

@ -9,7 +9,7 @@
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen
package net.mamoe.mirai.console.codegen.old
import org.intellij.lang.annotations.Language
import java.io.File
@ -67,18 +67,33 @@ fun genAllValueUseSite(): String = buildString {
// PRIMITIVE ARRAYS
for (number in NUMBERS + OTHER_PRIMITIVES.filterNot { it == "String" }) {
appendln(genValueUseSite("${number}Array", "${number}Array"))
appendln(
genValueUseSite(
"${number}Array",
"${number}Array"
)
)
}
// TYPED ARRAYS
for (number in NUMBERS + OTHER_PRIMITIVES) {
appendln(genValueUseSite("Array<${number}>", "Typed${number}Array"))
appendln(
genValueUseSite(
"Array<${number}>",
"Typed${number}Array"
)
)
}
// PRIMITIVE LISTS / PRIMITIVE SETS
for (collectionName in listOf("List", "Set")) {
for (number in NUMBERS + OTHER_PRIMITIVES) {
appendln(genValueUseSite("${collectionName}<${number}>", "${number}${collectionName}"))
appendln(
genValueUseSite(
"${collectionName}<${number}>",
"${number}${collectionName}"
)
)
}
}

View File

@ -9,7 +9,7 @@
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen
package net.mamoe.mirai.console.codegen.old
import org.intellij.lang.annotations.Language
import java.io.File
@ -59,13 +59,27 @@ fun genAllValueImpl(): String = buildString {
// PRIMITIVE
for (number in NUMBERS + OTHER_PRIMITIVES) {
appendln(genPrimitiveValueImpl(number, number, "$number.serializer()", false))
appendln(
genPrimitiveValueImpl(
number,
number,
"$number.serializer()",
false
)
)
appendLine()
}
// PRIMITIVE ARRAYS
for (number in NUMBERS + OTHER_PRIMITIVES.filterNot { it == "String" }) {
appendln(genPrimitiveValueImpl("${number}Array", "${number}Array", "${number}ArraySerializer()", true))
appendln(
genPrimitiveValueImpl(
"${number}Array",
"${number}Array",
"${number}ArraySerializer()",
true
)
)
appendLine()
}

View File

@ -9,7 +9,7 @@
@file:Suppress("ClassName", "unused", "PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen
package net.mamoe.mirai.console.codegen.old
import org.intellij.lang.annotations.Language
import java.io.File