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