public object Evaluate(IEnumerable <object> arguments, Marshaler marshaler)
{
ScriptEngine engine = engineFactory.GetScriptEngine();
EnsureCompiled(engine);
// call the function
object[] wrappedArgs = arguments.Select(marshaler.Wrap).ToArray();
object result;
try
{
result = engine.CallGlobalFunction(functionName, wrappedArgs);
}
catch (Jurassic.JavaScriptException err)
{
throw new ScriptFunctionEvaluationException(expression, err);
}
return(marshaler.Unwrap(result));
}