From 64e0d545f48b33221e84115ce3db8cc392f01e1b Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 30 Nov 2020 12:09:10 +0800 Subject: [PATCH] Correct package (not affecting API) --- .../src/common/ResolveContext.kt | 93 ------------------- .../src/common/RestrictedScope.kt | 28 ------ tools/intellij-plugin/README.md | 2 +- 3 files changed, 1 insertion(+), 122 deletions(-) delete mode 100644 backend/mirai-console/src/common/ResolveContext.kt delete mode 100644 backend/mirai-console/src/common/RestrictedScope.kt diff --git a/backend/mirai-console/src/common/ResolveContext.kt b/backend/mirai-console/src/common/ResolveContext.kt deleted file mode 100644 index 592c2179f..000000000 --- a/backend/mirai-console/src/common/ResolveContext.kt +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("unused") - -package net.mamoe.mirai.console.compiler.common - -import net.mamoe.mirai.console.command.Command -import net.mamoe.mirai.console.data.PluginData -import net.mamoe.mirai.console.data.value -import net.mamoe.mirai.console.permission.PermissionId -import net.mamoe.mirai.console.plugin.description.PluginDescription -import net.mamoe.mirai.console.util.SemVersion -import kotlin.annotation.AnnotationTarget.* - -/** - * 标记一个参数的语境类型, 用于帮助编译器和 IntelliJ 插件进行语境推断. - */ -@Target(VALUE_PARAMETER, PROPERTY, FIELD, FUNCTION, TYPE, TYPE_PARAMETER) -@Retention(AnnotationRetention.BINARY) -public annotation class ResolveContext( - vararg val kinds: Kind, -) { - /** - * 元素数量可能在任意时间被改动 - */ - public enum class Kind { - /////////////////////////////////////////////////////////////////////////// - // ConstantKind - /////////////////////////////////////////////////////////////////////////// - - /* - * WARNING: IF YOU CHANGE NAMES HERE, - * YOU SHOULD ALSO CHANGE THEIR COUNTERPARTS AT net.mamoe.mirai.console.compiler.common.resolve.ResolveContextKind - */ - - /** - * @see PluginDescription.id - */ - PLUGIN_ID, // ILLEGAL_PLUGIN_DESCRIPTION - - /** - * @see PluginDescription.name - */ - PLUGIN_NAME, // ILLEGAL_PLUGIN_DESCRIPTION - - /** - * @see PluginDescription.version - * @see SemVersion.Companion.invoke - */ - SEMANTIC_VERSION, // ILLEGAL_PLUGIN_DESCRIPTION - - /** - * @see SemVersion.Companion.parseRangeRequirement - */ - VERSION_REQUIREMENT, // ILLEGAL_VERSION_REQUIREMENT - - /** - * @see Command.allNames - */ - COMMAND_NAME, // ILLEGAL_COMMAND_NAME - - /** - * @see PermissionId.name - */ - PERMISSION_NAMESPACE, // ILLEGAL_PERMISSION_NAMESPACE - - /** - * @see PermissionId.name - */ - PERMISSION_NAME, // ILLEGAL_PERMISSION_NAME - - /** - * @see PermissionId.parseFromString - */ - PERMISSION_ID, // ILLEGAL_PERMISSION_ID - - /** - * 标注一个泛型, 要求这个泛型必须拥有一个公开无参 (或所有参数都可选) 构造器. - * - * @see PluginData.value - */ - RESTRICTED_NO_ARG_CONSTRUCTOR, // NOT_CONSTRUCTABLE_TYPE - - RESTRICTED_CONSOLE_COMMAND_OWNER, - } -} \ No newline at end of file diff --git a/backend/mirai-console/src/common/RestrictedScope.kt b/backend/mirai-console/src/common/RestrictedScope.kt deleted file mode 100644 index f4f4f1215..000000000 --- a/backend/mirai-console/src/common/RestrictedScope.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.console.compiler.common - -import net.mamoe.mirai.console.util.ConsoleExperimentalApi -import kotlin.annotation.AnnotationTarget.FUNCTION - -/** - * 标记一个函数, 在其函数体内限制特定一些函数的使用. - */ -@ConsoleExperimentalApi -@Target(FUNCTION) -@Retention(AnnotationRetention.BINARY) -public annotation class RestrictedScope( - vararg val kinds: Kind, -) { - public enum class Kind { - PERMISSION_REGISTER, // ILLEGAL_PERMISSION_REGISTER_USE - COMMAND_REGISTER, // ILLEGAL_COMMAND_REGISTER_USE - } -} \ No newline at end of file diff --git a/tools/intellij-plugin/README.md b/tools/intellij-plugin/README.md index db1cc56c6..2f9139cea 100644 --- a/tools/intellij-plugin/README.md +++ b/tools/intellij-plugin/README.md @@ -8,7 +8,7 @@ IntelliJ 平台的 Mirai Console 开发插件 #### ILLEGAL_PLUGIN_DESCRIPTION -- 使用 [ResolveContext](../../backend/mirai-console/src/common/ResolveContext.kt) +- 使用 [ResolveContext](../../backend/mirai-console/src/compiler/common/ResolveContext.kt) - 检测 Plugin Id, Plugin Name, Plugin Version 的合法性. 并在非法时提示正确的语法. - 支持编译期常量