From a6109bb3010baeb7e9917c6a392932f41b582036 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 9 Sep 2020 22:08:50 +0800 Subject: [PATCH] Rename Permission.parent to Permission.parentId --- .../net/mamoe/mirai/console/permission/Permission.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt index 3385f4cc9..afdd1bc81 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt @@ -22,7 +22,7 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI public interface Permission { public val id: PermissionId public val description: String - public val parent: PermissionId + public val parentId: PermissionId } /** @@ -33,15 +33,14 @@ public object AncestorPermission : Permission { override val id: PermissionId = PermissionId("*", "*") override val description: String get() = "The parent of any permission" - override val parent: PermissionId get() = id + override val parentId: PermissionId get() = id } @ConsoleExperimentalAPI @ExperimentalPermission public fun Permission.parentsWithSelfSequence(): Sequence = generateSequence(this) { p -> - p.parent.let { PermissionService.INSTANCE[it] } - ?.takeIf { parent -> parent != p } + p.parentId.findCorrespondingPermission()?.takeIf { parent -> parent != p } } /** @@ -52,5 +51,5 @@ public fun Permission.parentsWithSelfSequence(): Sequence = public class PermissionImpl( override val id: PermissionId, override val description: String, - override val parent: PermissionId = AncestorPermission.id + override val parentId: PermissionId = AncestorPermission.id ) : Permission \ No newline at end of file