diff --git a/src/java/me/topchetoeu/jscript/core/engine/values/FunctionValue.java b/src/java/me/topchetoeu/jscript/core/engine/values/FunctionValue.java index dbc3e53..61178dc 100644 --- a/src/java/me/topchetoeu/jscript/core/engine/values/FunctionValue.java +++ b/src/java/me/topchetoeu/jscript/core/engine/values/FunctionValue.java @@ -6,7 +6,6 @@ import me.topchetoeu.jscript.core.engine.Context; public abstract class FunctionValue extends ObjectValue { public String name = ""; - public boolean special = false; public int length; @Override diff --git a/src/java/me/topchetoeu/jscript/core/engine/values/Values.java b/src/java/me/topchetoeu/jscript/core/engine/values/Values.java index 39cd674..e2c1be7 100644 --- a/src/java/me/topchetoeu/jscript/core/engine/values/Values.java +++ b/src/java/me/topchetoeu/jscript/core/engine/values/Values.java @@ -411,7 +411,7 @@ public class Values { var ret = call(ctx, func, res, args); - if (ret != null && func instanceof FunctionValue && ((FunctionValue)func).special) return ret; + if (!isPrimitive(ret)) return ret; return res; } catch (IllegalArgumentException e) { diff --git a/src/java/me/topchetoeu/jscript/utils/interop/NativeWrapperProvider.java b/src/java/me/topchetoeu/jscript/utils/interop/NativeWrapperProvider.java index 9cf7dd1..bf2ef51 100644 --- a/src/java/me/topchetoeu/jscript/utils/interop/NativeWrapperProvider.java +++ b/src/java/me/topchetoeu/jscript/utils/interop/NativeWrapperProvider.java @@ -247,8 +247,6 @@ public class NativeWrapperProvider implements WrapperProvider { new NativeFunction(getName(clazz), args -> { throw EngineException.ofError("This constructor is not invokable."); }) : create(getName(clazz), constr); - res.special = true; - apply(res, ctx, ExposeTarget.CONSTRUCTOR, clazz); return res;