com.lightningkite.khrysalis.context.Contexts.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-plugin-common Show documentation
Show all versions of kotlin-compiler-plugin-common Show documentation
Common translational tools between Typescript and Swift.
The newest version!
package com.lightningkite.khrysalis.context
import kotlin.reflect.KProperty
class ContextProperty() {
var value: T? = null
operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
return value!!
}
inline fun context(value: T, action: ()->Unit){
if(this.value != null) throw IllegalStateException()
this.value = value
action()
this.value = null
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy