Handles passing objects back and forth between the .NET and Jurassic environments. Cannot be reused across script engines.
Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public UnwrappedArray(Marshaler marshaler, ArrayInstance array)
 {
     this.marshaler = marshaler;
     this.array     = array;
 }
Esempio n. 3
0
 public WrappedFunction(Marshaler marshaler, ScriptEngine engine, Delegate impl)
     : base(engine, engine.Object.InstancePrototype)
 {
     this.marshaler = marshaler;
     this.impl      = impl;
 }
Esempio n. 4
0
 public WrappedFunction(Marshaler marshaler, ScriptEngine engine, Delegate impl)
     : base(engine, engine.Object.InstancePrototype)
 {
     this.marshaler = marshaler;
     this.impl = impl;
 }
Esempio n. 5
0
 public UnwrappedArray(Marshaler marshaler, ArrayInstance array)
 {
     this.marshaler = marshaler;
     this.array = array;
 }