Inheritance: IStatementVisitor, IJintVisitor, IDeserializationCallback
Example #1
0
        public JintEngine(Options options) {
            Visitor = new ExecutionVisitor(options);
            //permissionSet = new PermissionSet(PermissionState.None);
            Visitor.AllowClr = allowClr;
            MaxRecursions = 400;

            var global = Visitor.Global as JsObject;

            global["ToBoolean"] = Visitor.Global.FunctionClass.New(new Func<object, Boolean>(Convert.ToBoolean));
            global["ToByte"] = Visitor.Global.FunctionClass.New(new Func<object, Byte>(Convert.ToByte));
            global["ToChar"] = Visitor.Global.FunctionClass.New(new Func<object, Char>(Convert.ToChar));
            global["ToDateTime"] = Visitor.Global.FunctionClass.New(new Func<object, DateTime>(Convert.ToDateTime));
            global["ToDecimal"] = Visitor.Global.FunctionClass.New(new Func<object, Decimal>(Convert.ToDecimal));
            global["ToDouble"] = Visitor.Global.FunctionClass.New(new Func<object, Double>(Convert.ToDouble));
            global["ToInt16"] = Visitor.Global.FunctionClass.New(new Func<object, Int16>(Convert.ToInt16));
            global["ToInt32"] = Visitor.Global.FunctionClass.New(new Func<object, Int32>(Convert.ToInt32));
            global["ToInt64"] = Visitor.Global.FunctionClass.New(new Func<object, Int64>(Convert.ToInt64));
            global["ToSByte"] = Visitor.Global.FunctionClass.New(new Func<object, SByte>(Convert.ToSByte));
            global["ToSingle"] = Visitor.Global.FunctionClass.New(new Func<object, Single>(Convert.ToSingle));
            global["ToString"] = Visitor.Global.FunctionClass.New(new Func<object, String>(Convert.ToString));
            global["ToUInt16"] = Visitor.Global.FunctionClass.New(new Func<object, UInt16>(Convert.ToUInt16));
            global["ToUInt32"] = Visitor.Global.FunctionClass.New(new Func<object, UInt32>(Convert.ToUInt32));
            global["ToUInt64"] = Visitor.Global.FunctionClass.New(new Func<object, UInt64>(Convert.ToUInt64));

            BreakPoints = new List<BreakPoint>();
        }
Example #2
0
        public JintEngine(Options options)
        {
            visitor = new ExecutionVisitor(options, this as IScriptEngineContext);
            CurrentVisitor = visitor;
            AllowClr = true;
            //permissionSet = new PermissionSet(PermissionState.None);

            visitor.GlobalScope.Prototype["ToBoolean"] = visitor.Global.FunctionClass.New(new Func<object, Boolean>(Convert.ToBoolean));
            visitor.GlobalScope.Prototype["ToByte"] = visitor.Global.FunctionClass.New(new Func<object, Byte>(Convert.ToByte));
            visitor.GlobalScope.Prototype["ToChar"] = visitor.Global.FunctionClass.New(new Func<object, Char>(Convert.ToChar));
            visitor.GlobalScope.Prototype["ToDateTime"] = visitor.Global.FunctionClass.New(new Func<object, DateTime>(Convert.ToDateTime));
            visitor.GlobalScope.Prototype["ToDecimal"] = visitor.Global.FunctionClass.New(new Func<object, Decimal>(Convert.ToDecimal));
            visitor.GlobalScope.Prototype["ToDouble"] = visitor.Global.FunctionClass.New(new Func<object, Double>(Convert.ToDouble));
            visitor.GlobalScope.Prototype["ToInt16"] = visitor.Global.FunctionClass.New(new Func<object, Int16>(Convert.ToInt16));
            visitor.GlobalScope.Prototype["ToInt32"] = visitor.Global.FunctionClass.New(new Func<object, Int32>(Convert.ToInt32));
            visitor.GlobalScope.Prototype["ToInt64"] = visitor.Global.FunctionClass.New(new Func<object, Int64>(Convert.ToInt64));
            visitor.GlobalScope.Prototype["ToSByte"] = visitor.Global.FunctionClass.New(new Func<object, SByte>(Convert.ToSByte));
            visitor.GlobalScope.Prototype["ToSingle"] = visitor.Global.FunctionClass.New(new Func<object, Single>(Convert.ToSingle));
            visitor.GlobalScope.Prototype["ToString"] = visitor.Global.FunctionClass.New(new Func<object, String>(Convert.ToString));
            visitor.GlobalScope.Prototype["ToUInt16"] = visitor.Global.FunctionClass.New(new Func<object, UInt16>(Convert.ToUInt16));
            visitor.GlobalScope.Prototype["ToUInt32"] = visitor.Global.FunctionClass.New(new Func<object, UInt32>(Convert.ToUInt32));
            visitor.GlobalScope.Prototype["ToUInt64"] = visitor.Global.FunctionClass.New(new Func<object, UInt64>(Convert.ToUInt64));

            BreakPoints = new List<BreakPoint>();
        }
Example #3
0
 public CachedMethodInvoker(ExecutionVisitor visitor)
 {
     this.visitor = visitor;
 }
Example #4
0
 public IMethodInvoker GetMethodInvoker(ExecutionVisitor visitor)
 {
     return new MethodInvoker(this);
 }