Fix CommandDeclarationChecker

This commit is contained in:
Him188 2021-01-29 12:43:42 +08:00
parent 8fde96c50a
commit 6c71783498

View File

@ -12,6 +12,8 @@ package net.mamoe.mirai.console.intellij.diagnostics
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_COMMAND_DECLARATION_RECEIVER
import net.mamoe.mirai.console.compiler.common.resolve.COMMAND_SENDER_FQ_NAME
import net.mamoe.mirai.console.intellij.resolve.hasSuperType
import net.mamoe.mirai.console.intellij.resolve.isCompositeCommandSubCommand
import net.mamoe.mirai.console.intellij.resolve.isSimpleCommandHandler
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.psi.KtDeclaration
@ -23,16 +25,15 @@ class CommandDeclarationChecker : DeclarationChecker {
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
if (declaration !is KtNamedFunction) return
// exclusive checks
// currently no checks
// when {
// declaration.isSimpleCommandHandler() -> {
// }
//
// declaration.isCompositeCommandSubCommand() -> {
// }
// else -> return
// }
// exclusive checks or return
when {
declaration.isSimpleCommandHandler() -> {
}
declaration.isCompositeCommandSubCommand() -> {
}
else -> return
}
// common checks
checkCommandReceiverParameter(declaration)?.let { context.report(it) }