From a6e2e478c19c510bb27f532f975e9b042f72ed9d Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 2 Jul 2020 19:23:27 +0900 Subject: [PATCH] fix: instanceof for parameters from ScriptEngine always false --- .../anatawa12/fixRtm/scripting/rhino/FIXRhinoScriptEngine.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/anatawa12/fixRtm/scripting/rhino/FIXRhinoScriptEngine.kt b/src/main/java/com/anatawa12/fixRtm/scripting/rhino/FIXRhinoScriptEngine.kt index 4a70a498..b86b98f6 100644 --- a/src/main/java/com/anatawa12/fixRtm/scripting/rhino/FIXRhinoScriptEngine.kt +++ b/src/main/java/com/anatawa12/fixRtm/scripting/rhino/FIXRhinoScriptEngine.kt @@ -72,7 +72,9 @@ class FIXRhinoScriptEngine : ScriptEngine, Invocable { val func = (scope[name] as? Function) ?: throw ScriptException("$name is not function") usingContext { ctx -> ctx.wrapFactory.isJavaPrimitiveWrap = false - return func.call(ctx, func.parentScope, null, args) + return func.call(ctx, func.parentScope, null, args + .map { ctx.wrapFactory.wrap(ctx, scope, it, null) } + .toTypedArray()) } }