Commit 70201af1 authored by Him188's avatar Him188

Add contract

parent ff2f0b5a
package net.mamoe.mirai.qqandroid.utils
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
/**
* Inline the block
*/
@UseExperimental(ExperimentalContracts::class)
@PublishedApi
internal inline fun <R> inline(block: () -> R): R = block()
\ No newline at end of file
internal inline fun <R> inline(block: () -> R): R {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
return block()
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment