void fx_xs_newInstanceOf(txMachine* the) { if ((mxArgc < 1) || (mxArgv(0)->kind != XS_REFERENCE_KIND)) mxTypeError("prototype is no object"); mxPushSlot(mxArgv(0)); fxNewInstanceOf(the); mxPullSlot(mxResult); }
txSlot* fxCreateInstance(txMachine* the, txSlot* slot) { txSlot* prototype; mxPushUndefined(); prototype = the->stack; fxBeginHost(the); mxPushReference(slot); fxGetID(the, mxID(_prototype)); *prototype = *the->stack; fxEndHost(the); /* txSlot* prototype = mxFunctionInstancePrototype(slot); if (prototype->kind == XS_NULL_KIND) { if (prototype->flag & XS_DONT_SET_FLAG) mxTypeError("new.target: no constructor"); if (slot->flag & XS_SHARED_FLAG) mxTypeError("new.target: shared"); fxDefaultFunctionPrototype(the, slot, prototype); } mxPushSlot(prototype); */ fxNewInstanceOf(the); return the->stack->value.reference; }