Add a handler for providing evaluation context for scripts

use it on refinement.
also some refactoring on context class and around
This commit is contained in:
Ilya Chernikov
2019-07-25 11:46:17 +02:00
parent 2a5c4a2409
commit 288fdc0952
5 changed files with 63 additions and 6 deletions
@@ -13,7 +13,7 @@ import kotlin.reflect.KProperty
import kotlin.reflect.KType
import kotlin.script.experimental.api.KotlinType
open class PropertiesCollection(private var properties: Map<Key<*>, Any?> = emptyMap()) : Serializable {
open class PropertiesCollection(protected var properties: Map<Key<*>, Any?> = emptyMap()) : Serializable {
open class Key<T>(
val name: String,
@@ -64,6 +64,8 @@ open class PropertiesCollection(private var properties: Map<Key<*>, Any?> = empt
val notTransientData: Map<Key<*>, Any?> get() = properties.filterKeys { it !is TransientKey<*>}
fun isEmpty(): Boolean = properties.isEmpty()
override fun equals(other: Any?): Boolean =
(other as? PropertiesCollection)?.let { it.properties == properties } == true