Refactor scriptDefinition in the common part
- get rid of selector (because of confusions), move it's data into definition itself and make it more generic with heterogeneous map - make main KotlinScript annotation accept complete definition - make additional annotation for building definition from parts - add ScriptingEnvironment and pass it as a constructor parameter to the script handlers - rename some classes for clarity
This commit is contained in:
+3
-3
@@ -23,9 +23,9 @@ import kotlinx.coroutines.experimental.runBlocking
|
||||
import kotlin.script.experimental.api.*
|
||||
|
||||
abstract class BasicScriptingHost<ScriptBase : Any>(
|
||||
val configurator: ScriptConfigurator,
|
||||
val configurator: ScriptCompilationConfigurator,
|
||||
val compiler: ScriptCompiler,
|
||||
val runner: ScriptRunner<ScriptBase>
|
||||
val evaluator: ScriptEvaluator<ScriptBase>
|
||||
) {
|
||||
open fun <T> runInCoroutineContext(block: suspend CoroutineScope.() -> T): T = runBlocking { block() }
|
||||
|
||||
@@ -36,7 +36,7 @@ abstract class BasicScriptingHost<ScriptBase : Any>(
|
||||
is ResultWithDiagnostics.Failure -> compiled
|
||||
is ResultWithDiagnostics.Success -> {
|
||||
val compiledScript = compiled.value!! as CompiledScript<ScriptBase>
|
||||
runner.run(compiledScript, environment)
|
||||
evaluator.eval(compiledScript, environment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user