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

Function fxProxySetPropertyValue

xs/sources/xsProxy.c:692–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692txBoolean fxProxySetPropertyValue(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* slot, txSlot* receiver)
693{
694 txBoolean result;
695 mxProxyDeclarations(_set);
696 if (function) {
697 /* THIS */
698 mxPushSlot(handler);
699 /* FUNCTION */
700 mxPushSlot(function);
701 mxCall();
702 /* ARGUMENTS */
703 mxPushSlot(target);
704 mxPushUndefined();
705 fxKeyAt(the, id, index, the->stack);
706 mxPushSlot(slot);
707 mxPushSlot(receiver);
708 mxRunCount(4);
709 result = fxToBoolean(the, the->stack);
710 mxPop();
711 if (result) {
712 mxPushUndefined();
713 if (mxBehaviorGetOwnProperty(the, target->value.reference, id, index, the->stack)) {
714 txSlot* property = the->stack;
715 if (property->flag & XS_DONT_DELETE_FLAG) {
716 if (property->kind == XS_ACCESSOR_KIND) {
717 if (property->value.accessor.setter == C_NULL)
718 mxTypeError("(proxy).set: true for non-configurable property with different setter");
719 }
720 else {
721 if ((property->flag & XS_DONT_SET_FLAG) && (!fxIsSameValue(the, property, slot, 0)))
722 mxTypeError("(proxy).set: true for non-configurable, non-writable property with different value");
723 }
724 }
725 }
726 mxPop();
727 }
728 }
729 else
730 result = mxBehaviorSetPropertyValue(the, target->value.reference, id, index, slot, receiver);
731 mxProxyPop();
732 return result;
733}
734
735txBoolean fxProxySetPrototype(txMachine* the, txSlot* instance, txSlot* prototype)
736{

Callers 1

fxProxySetterFunction · 0.85

Calls 3

fxKeyAtFunction · 0.85
fxToBooleanFunction · 0.85
fxIsSameValueFunction · 0.85

Tested by

no test coverage detected