Fix params handling in JSR 223 for Idea, add simple test
This commit is contained in:
@@ -33,7 +33,9 @@ class KotlinJvmJsr223ScriptEngine4Idea(
|
||||
disposable: Disposable,
|
||||
private val factory: ScriptEngineFactory,
|
||||
templateClasspath: List<File>,
|
||||
templateClassName: String
|
||||
templateClassName: String,
|
||||
scriptArgs: Array<Any?>?,
|
||||
scriptArgsTypes: Array<Class<*>>?
|
||||
) : AbstractScriptEngine(), ScriptEngine {
|
||||
|
||||
private val daemon by lazy {
|
||||
@@ -61,7 +63,7 @@ class KotlinJvmJsr223ScriptEngine4Idea(
|
||||
}
|
||||
}
|
||||
|
||||
val localEvaluator by lazy { GenericReplCompiledEvaluator(emptyList(), Thread.currentThread().contextClassLoader) }
|
||||
val localEvaluator by lazy { GenericReplCompiledEvaluator(emptyList(), Thread.currentThread().contextClassLoader, scriptArgs, scriptArgsTypes) }
|
||||
|
||||
private var lineCount = 0
|
||||
|
||||
|
||||
+3
-1
@@ -38,7 +38,9 @@ class KotlinJvmJsr223StandardScriptEngineFactory4Idea : ScriptEngineFactory {
|
||||
Disposer.newDisposable(),
|
||||
this,
|
||||
listOf(PathUtil.getKotlinPathsForIdeaPlugin().runtimePath),
|
||||
"kotlin.script.StandardScriptTemplate")
|
||||
"kotlin.script.StandardScriptTemplate",
|
||||
arrayOf(emptyArray<String>()),
|
||||
null)
|
||||
|
||||
override fun getOutputStatement(toDisplay: String?): String = "print(\"$toDisplay\")"
|
||||
override fun getMethodCallSyntax(obj: String, m: String, vararg args: String): String = "$obj.$m(${args.joinToString()})"
|
||||
|
||||
Reference in New Issue
Block a user