public Object call(Object object,
String method,
Object[] args) throws BSFException {
Object retval = null;
Context cx;
try {
cx = Context.enter();
// REMIND: convert arg list Vectors here?
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 (Throwable t) {
handleError(t);
}
finally {
Context.exit();
}
return retval;
}
Return an object from an extension. |