Пример #1
0
        public void Eval(string chunk, string chunkName = "chunk")
        {
            IntPtr resultInfo = PuertsDLL.EvalChecked(isolate, chunk, chunkName);

            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetLastExceptionInfo(isolate);
                throw new Exception(exceptionInfo);
            }
            PuertsDLL.ResetResult(resultInfo);
        }
Пример #2
0
        public TResult Eval <TResult>(string chunk, string chunkName = "chunk")
        {
            IntPtr resultInfo = PuertsDLL.EvalChecked(isolate, chunk, chunkName);

            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetLastExceptionInfo(isolate);
                throw new Exception(exceptionInfo);
            }
            TResult result = StaticTranslate <TResult> .Get(Idx, isolate, NativeValueApi.GetValueFromResult, resultInfo, false);

            PuertsDLL.ResetResult(resultInfo);
            return(result);
        }
Пример #3
0
        public void Eval(string chunk, string chunkName = "chunk")
        {
#if THREAD_SAFE
            lock (this) {
#endif
            IntPtr resultInfo = PuertsDLL.EvalChecked(isolate, chunk, chunkName);
            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetLastExceptionInfo(isolate);
                throw new Exception(exceptionInfo);
            }
            PuertsDLL.ResetResult(resultInfo);
#if THREAD_SAFE
        }
#endif
        }