public Object call()

in src/main/java/org/apache/bsf/engines/javascript/JavaScriptEngine.java [56:92]


    public Object call(final Object object, final String method, final Object[] args) throws BSFException {

        Object retval = null;
        Context cx;

        try {
            cx = Context.enter();

            // REMIND: convert arg list Vectors here?

            final Object fun = global.get(method, global);
            // NOTE: Source and line arguments are nonsense in a call().
            // Any way to make these arguments *sensible?
            if (fun == Scriptable.NOT_FOUND) {
                throw new EvaluatorException("function " + method + " not found.", "none", 0);
            }

            cx.setOptimizationLevel(-1);
            cx.setGeneratingDebug(false);
            cx.setGeneratingSource(false);
            cx.setOptimizationLevel(0);
            cx.setDebugger(null, null);

            retval = ((Function) fun).call(cx, global, global, args);

//                ScriptRuntime.call(cx, fun, global, args, global);

            if (retval instanceof Wrapper) {
                retval = ((Wrapper) retval).unwrap();
            }
        } catch (final Throwable t) {
            handleError(t);
        } finally {
            Context.exit();
        }
        return retval;
    }