mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Merge remote-tracking branch 'origin/master' into dependencies
This commit is contained in:
commit
2ef4809d01
@ -32,7 +32,7 @@ kotlin {
|
||||
target.compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=enable"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
//useIR = true
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import kotlin.internal.LowPriorityInOverloadResolution
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@ConsoleExperimentalAPI
|
||||
public open class AbstractExtensionPoint<T : Any>(
|
||||
public open class AbstractExtensionPoint<T : Extension>(
|
||||
@ConsoleExperimentalAPI
|
||||
public val type: KClass<T>
|
||||
) {
|
||||
@ -63,12 +63,12 @@ public open class ExtensionException : RuntimeException {
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.withExtensions(block: T.() -> Unit) {
|
||||
internal inline fun <T : Extension> AbstractExtensionPoint<out T>.withExtensions(block: T.() -> Unit) {
|
||||
return withExtensions { _ -> block() }
|
||||
}
|
||||
|
||||
@LowPriorityInOverloadResolution
|
||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.withExtensions(block: T.(plugin: Plugin) -> Unit) {
|
||||
internal inline fun <T : Extension> AbstractExtensionPoint<out T>.withExtensions(block: T.(plugin: Plugin) -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block)
|
||||
}
|
||||
@ -81,7 +81,7 @@ internal inline fun <T : Any> AbstractExtensionPoint<T>.withExtensions(block: T.
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun <T : Any, E> AbstractExtensionPoint<T>.foldExtensions(
|
||||
internal inline fun <T : Extension, E> AbstractExtensionPoint<out T>.foldExtensions(
|
||||
initial: E,
|
||||
block: (acc: E, extension: T) -> E
|
||||
): E {
|
||||
@ -99,7 +99,7 @@ internal inline fun <T : Any, E> AbstractExtensionPoint<T>.foldExtensions(
|
||||
return e
|
||||
}
|
||||
|
||||
internal fun <T : Any> AbstractExtensionPoint<T>.throwExtensionException(
|
||||
internal fun <T : Extension> AbstractExtensionPoint<out T>.throwExtensionException(
|
||||
extension: T,
|
||||
plugin: Plugin,
|
||||
throwable: Throwable
|
||||
@ -110,9 +110,9 @@ internal fun <T : Any> AbstractExtensionPoint<T>.throwExtensionException(
|
||||
)
|
||||
}
|
||||
|
||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.useExtensions(block: (extension: T) -> Unit): Unit =
|
||||
internal inline fun <T : Extension> AbstractExtensionPoint<T>.useExtensions(block: (extension: T) -> Unit): Unit =
|
||||
withExtensions(block)
|
||||
|
||||
@LowPriorityInOverloadResolution
|
||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.useExtensions(block: (extension: T, plugin: Plugin) -> Unit): Unit =
|
||||
internal inline fun <T : Extension> AbstractExtensionPoint<T>.useExtensions(block: (extension: T, plugin: Plugin) -> Unit): Unit =
|
||||
withExtensions(block)
|
@ -9,6 +9,7 @@
|
||||
|
||||
package net.mamoe.mirai.console.permission
|
||||
|
||||
import net.mamoe.mirai.console.extension.useExtensions
|
||||
import net.mamoe.mirai.console.extensions.PermissionServiceProvider
|
||||
import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
|
||||
|
||||
@ -16,4 +17,18 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
|
||||
* [PermissionServiceProvider]
|
||||
*/
|
||||
@ConsoleExperimentalAPI
|
||||
public interface PermissionService
|
||||
public interface PermissionService {
|
||||
|
||||
|
||||
public companion object : PermissionService {
|
||||
private val instance by lazy {
|
||||
PermissionServiceProvider.useExtensions { }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public interface proprietary
|
||||
|
||||
@ConsoleExperimentalAPI
|
||||
public interface Permission
|
||||
|
@ -11,7 +11,7 @@ kotlin {
|
||||
target.compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=enable"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user