示例#1
0
 public NSJSVirtualMachine(NSJSConsoleHandler handler)
 {
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     this.AutomaticallyPrintException = true;
     this.IntegerBoolean = false;
     this.Handle         = nsjs_virtualmachine_new();
     if (this.Handle == NULL)
     {
         throw new InvalidOperationException("this");
     }
     machines.TryAdd(this.Handle, this);
     this.ConsoleHandler = handler;
     this.cookie         = GCHandle.Alloc(this);
     this.exception      = NSJSStructural.NSJSExceptionInfo.New();
     this.stacktrace     = NSJSStructural.NSJSStackTrace.New();
 }
示例#2
0
        internal NSJSStackTrace(NSJSStructural.NSJSStackTrace *stacktrace)
        {
            if (stacktrace == null)
            {
                throw new ArgumentNullException("stacktrace");
            }
            int count = stacktrace->Count;

            if (count > MaxFrameCount)
            {
                count = MaxFrameCount;
            }
            this.frames = new NSJSStackFrame[count];
            for (int i = 0; i < count; i++)
            {
                frames[i] = new NSJSStackFrame(&stacktrace->Frame[i]);
            }
            stacktrace->Count = 0;
            this.FrameCount   = count;
        }