示例#1
0
 private void NewObject(JSFunction constructor, JSValue[] args)
 {
     if (constructor.IsNative)
     {
         CurrentFrame.Push(constructor.Construct(this, CurrentFrame.LocalScope, args));
     }
     else
     {
         var managedConstructor = (JSManagedFunction)constructor;
         var newObject          = new JSObject(VM, managedConstructor.GetPrototype());
         CurrentFrame = new CallStackFrame(
             CurrentFrame,
             VM,
             managedConstructor,
             newObject,
             new LocalVariableScope(managedConstructor.OuterScope),
             args,
             true);
         CurrentFrame.Push(newObject);
     }
 }