MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxProxySetPrototype

Function fxProxySetPrototype

xs/sources/xsProxy.c:735–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735txBoolean fxProxySetPrototype(txMachine* the, txSlot* instance, txSlot* prototype)
736{
737 txBoolean result;
738 mxProxyDeclarations(_setPrototypeOf);
739 if (function) {
740 /* THIS */
741 mxPushSlot(handler);
742 /* FUNCTION */
743 mxPushSlot(function);
744 mxCall();
745 /* ARGUMENTS */
746 mxPushSlot(target);
747 mxPushSlot(prototype);
748 mxRunCount(2);
749 result = fxToBoolean(the, the->stack);
750 mxPop();
751 if (result) {
752 if (!mxBehaviorIsExtensible(the, target->value.reference)) {
753 mxPushUndefined();
754 mxBehaviorGetPrototype(the, target->value.reference, the->stack);
755 if (!fxIsSameValue(the, prototype, the->stack, 0))
756 mxTypeError("(proxy).setPrototypeOf: true for non-extensible object with different prototype");
757 mxPop();
758 }
759 }
760 }
761 else
762 result = mxBehaviorSetPrototype(the, target->value.reference, prototype);
763 mxProxyPop();
764 return result;
765}
766
767void fx_Proxy(txMachine* the)
768{

Callers

nothing calls this directly

Calls 2

fxToBooleanFunction · 0.85
fxIsSameValueFunction · 0.85

Tested by

no test coverage detected