Convert evaluator interface to function
This commit is contained in:
@@ -26,9 +26,7 @@ data class EvaluationResult(val returnValue: Any?, val environment: ScriptEvalua
|
||||
|
||||
interface ScriptEvaluator {
|
||||
|
||||
// constructor(properties: ScriptDefinitionPropertiesBag) // the constructor is expected from implementations
|
||||
|
||||
suspend fun eval(
|
||||
suspend operator fun invoke(
|
||||
compiledScript: CompiledScript<*>,
|
||||
scriptEvaluationEnvironment: ScriptEvaluationEnvironment
|
||||
): ResultWithDiagnostics<EvaluationResult>
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ abstract class BasicScriptingHost(
|
||||
when (compiled) {
|
||||
is ResultWithDiagnostics.Failure -> compiled
|
||||
is ResultWithDiagnostics.Success -> {
|
||||
evaluator.eval(compiled.value, environment)
|
||||
evaluator(compiled.value, environment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import kotlin.script.experimental.api.*
|
||||
|
||||
open class BasicJvmScriptEvaluator() : ScriptEvaluator {
|
||||
|
||||
override suspend fun eval(
|
||||
override suspend operator fun invoke(
|
||||
compiledScript: CompiledScript<*>,
|
||||
scriptEvaluationEnvironment: ScriptEvaluationEnvironment
|
||||
): ResultWithDiagnostics<EvaluationResult> =
|
||||
|
||||
Reference in New Issue
Block a user