Add shared script instances support, fix and refactor evaluation accordingly

also fix arguments order in the evaluator
This commit is contained in:
Ilya Chernikov
2019-01-07 18:10:57 +01:00
parent 7bb4233e17
commit 4571e273a4
7 changed files with 130 additions and 57 deletions
@@ -66,15 +66,14 @@ fun File.toScriptSource(): SourceCode = FileScriptSource(this)
/**
* The implementation of the ScriptSource for a script in a String
*/
open class StringScriptSource(val source: String) : SourceCode {
open class StringScriptSource(val source: String, override val name: String? = null) : SourceCode {
override val text: String get() = source
override val name: String? = null
override val locationId: String? = null
}
/**
* Converts the String into the SourceCode
*/
fun String.toScriptSource(): SourceCode = StringScriptSource(this)
fun String.toScriptSource(name: String? = null): SourceCode = StringScriptSource(this, name)