mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Fix CommandDeclarationChecker
This commit is contained in:
parent
8fde96c50a
commit
6c71783498
@ -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.diagnostics.MiraiConsoleErrors.ILLEGAL_COMMAND_DECLARATION_RECEIVER
|
||||||
import net.mamoe.mirai.console.compiler.common.resolve.COMMAND_SENDER_FQ_NAME
|
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.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.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||||
@ -23,16 +25,15 @@ class CommandDeclarationChecker : DeclarationChecker {
|
|||||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||||
if (declaration !is KtNamedFunction) return
|
if (declaration !is KtNamedFunction) return
|
||||||
|
|
||||||
// exclusive checks
|
// exclusive checks or return
|
||||||
// currently no checks
|
when {
|
||||||
// when {
|
declaration.isSimpleCommandHandler() -> {
|
||||||
// declaration.isSimpleCommandHandler() -> {
|
}
|
||||||
// }
|
|
||||||
//
|
declaration.isCompositeCommandSubCommand() -> {
|
||||||
// declaration.isCompositeCommandSubCommand() -> {
|
}
|
||||||
// }
|
else -> return
|
||||||
// else -> return
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// common checks
|
// common checks
|
||||||
checkCommandReceiverParameter(declaration)?.let { context.report(it) }
|
checkCommandReceiverParameter(declaration)?.let { context.report(it) }
|
||||||
|
Loading…
Reference in New Issue
Block a user