Jint.Native.JsGlobal.Eval C# (CSharp) Method

Eval() public method

15.1.2.1
public Eval ( JsInstance arguments ) : JsInstance
arguments JsInstance
return JsInstance
        public JsInstance Eval(JsInstance[] arguments)
        {
            if (JsInstance.CLASS_STRING != arguments[0].Class) {
                return arguments[0];
            }

            Program p;

            try {
                p = JintEngine.Compile(arguments[0].ToString(), Visitor.DebugMode);
            }
            catch (Exception e) {
                throw new JsException(this.SyntaxErrorClass.New(e.Message));
            }

            try {
                p.Accept((IStatementVisitor)Visitor);
            }
            catch (Exception e) {
                throw new JsException(this.EvalErrorClass.New(e.Message));
            }

            return Visitor.Result;
        }