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

Function fxSetAll

xs/sources/xsAPI.c:1063–1098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1061}
1062
1063void fxSetAll(txMachine* the, txSlot* stack, txID id, txIndex index)
1064{
1065 txSlot* value = stack + 1;
1066 txSlot* instance = fxToInstance(the, stack);
1067 txSlot* property = mxBehaviorSetProperty(the, instance, id, index, XS_ANY);
1068 if (!property)
1069 mxDebugID(XS_TYPE_ERROR, "C: xsSet %s: not extensible", id);
1070 if (property->kind == XS_ACCESSOR_KIND) {
1071 txSlot* slot;
1072 txSlot* function = property->value.accessor.setter;
1073 if (!mxIsFunction(function))
1074 mxDebugID(XS_TYPE_ERROR, "C: xsSet %s: no setter", id);
1075 the->stack = stack;
1076 mxOverflow(-3);
1077 the->stack -= 3;
1078 slot = the->stack;
1079 slot->value = value->value;
1080 mxInitSlotKind(slot++, value->kind);
1081 mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
1082 slot->value = value->value;
1083 mxInitSlotKind(slot++, value->kind);
1084 slot->value.reference = function;
1085 mxInitSlotKind(slot++, XS_REFERENCE_KIND);
1086 slot->value.reference = instance;
1087 mxInitSlotKind(slot, XS_REFERENCE_KIND);
1088 mxRunCount(1);
1089 }
1090 else {
1091 if (property->flag & XS_DONT_SET_FLAG)
1092 mxDebugID(XS_TYPE_ERROR, "C: xsSet %s: not writable", id);
1093 property->kind = value->kind;
1094 property->value = value->value;
1095 the->stack = stack;
1096 mxPop();
1097 }
1098}
1099
1100void fxSetAt(txMachine* the)
1101{

Callers 3

fxSetAtFunction · 0.85
fxSetIDFunction · 0.85
fxSetIndexFunction · 0.85

Calls 1

fxToInstanceFunction · 0.85

Tested by

no test coverage detected