Executes the program stored in the CompiledScript
object using
the supplied Bindings
of attributes as the ENGINE_SCOPE
of the
associated ScriptEngine
during script execution. If bindings is null,
then the effect of calling this method is same as that of eval(getEngine().getContext()).
.
The GLOBAL_SCOPE
Bindings
, Reader
and Writer
associated with the default ScriptContext
of the associated ScriptEngine
are used.
ScriptContext ctxt = getEngine().getContext();
if (bindings != null) {
SimpleScriptContext tempctxt = new SimpleScriptContext();
tempctxt.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
tempctxt.setBindings(ctxt.getBindings(ScriptContext.GLOBAL_SCOPE),
ScriptContext.GLOBAL_SCOPE);
tempctxt.setWriter(ctxt.getWriter());
tempctxt.setReader(ctxt.getReader());
tempctxt.setErrorWriter(ctxt.getErrorWriter());
ctxt = tempctxt;
}
return eval(ctxt);