mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-24 20:43:33 +08:00
fix compile error from pr-changes
This commit is contained in:
parent
575b7edad6
commit
7ace541597
mirai-console/backend/mirai-console/src
@ -27,7 +27,7 @@ public abstract class AbstractSubCommandGroup(
|
||||
private val reflector by lazy { SubCommandReflector(this, GroupedCommandSubCommandAnnotationResolver) }
|
||||
|
||||
@ExperimentalCommandDescriptors
|
||||
public final override val provideOverloads: List<CommandSignatureFromKFunction> by lazy {
|
||||
public final override val overloads: List<CommandSignatureFromKFunction> by lazy {
|
||||
reflector.findSubCommands().also {
|
||||
reflector.validate(it)
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ internal object GroupedCommandSubCommandAnnotationResolver :
|
||||
override fun getDescription(ownerCommand: Any, function: KFunction<*>): String? =
|
||||
function.findAnnotation<AbstractSubCommandGroup.AnotherDescription>()?.value
|
||||
|
||||
override fun hasPropertyAnnotation(command: Any, kProperty: KProperty<*>): Boolean =
|
||||
override fun isCombinedCommand(command: Any, kProperty: KProperty<*>): Boolean =
|
||||
kProperty.hasAnnotation<AbstractSubCommandGroup.AnotherCombinedCommand>()
|
||||
|
||||
}
|
||||
@ -125,7 +125,7 @@ internal object SimpleCommandSubCommandAnnotationResolver :
|
||||
override fun getDescription(ownerCommand: Command, function: KFunction<*>): String =
|
||||
ownerCommand.description
|
||||
|
||||
override fun hasPropertyAnnotation(command: Command, kProperty: KProperty<*>): Boolean = false
|
||||
override fun isCombinedCommand(command: Command, kProperty: KProperty<*>): Boolean = false
|
||||
}
|
||||
|
||||
internal interface SubCommandAnnotationResolver<T> {
|
||||
@ -133,7 +133,7 @@ internal interface SubCommandAnnotationResolver<T> {
|
||||
fun getSubCommandNames(ownerCommand: T, function: KFunction<*>): Array<out String>
|
||||
fun getAnnotatedName(ownerCommand: T, parameter: KParameter): String?
|
||||
fun getDescription(ownerCommand: T, function: KFunction<*>): String?
|
||||
fun hasPropertyAnnotation(command: T, kProperty: KProperty<*>): Boolean
|
||||
fun isCombinedCommand(command: T, kProperty: KProperty<*>): Boolean
|
||||
}
|
||||
|
||||
@ConsoleExperimentalApi
|
||||
@ -232,7 +232,7 @@ internal class SubCommandReflector<T: Any>(
|
||||
throw IllegalCommandDeclarationException(owner, this, message)
|
||||
}
|
||||
|
||||
private fun KProperty<*>.isSubCommandProviderProperty(): Boolean = annotationResolver.hasPropertyAnnotation(owner, this)
|
||||
private fun KProperty<*>.isSubCommandProviderProperty(): Boolean = annotationResolver.isCombinedCommand(owner, this)
|
||||
private fun KFunction<*>.isSubCommandFunction(): Boolean = annotationResolver.hasAnnotation(owner, this)
|
||||
private fun KFunction<*>.checkExtensionReceiver() {
|
||||
this.extensionReceiverParameter?.let { receiver ->
|
||||
@ -396,7 +396,7 @@ internal class SubCommandReflector<T: Any>(
|
||||
.filter { it is SubCommandGroup }
|
||||
.flatMap { property ->
|
||||
property as SubCommandGroup
|
||||
property.provideOverloads
|
||||
property.overloads
|
||||
}.toList()
|
||||
|
||||
val list: MutableList<CommandSignatureFromKFunction> = ArrayList()
|
||||
|
Loading…
Reference in New Issue
Block a user