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

Function fxArrayDefineOwnProperty

xs/sources/xsArray.c:1027–1058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025}
1026
1027txBoolean fxArrayDefineOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* descriptor, txFlag mask)
1028{
1029 if (id == mxID(_length)) {
1030 txSlot* array = instance->next;
1031 txSlot slot;
1032 txBoolean result = 1;
1033 txIndex length = ((descriptor->kind != XS_UNINITIALIZED_KIND) && (descriptor->kind != XS_ACCESSOR_KIND)) ? fxCheckArrayLength(the, descriptor) : 0;
1034 slot.flag = array->flag;
1035 slot.ID = id;
1036 slot.kind = XS_NUMBER_KIND;
1037 slot.value.number = array->value.array.length;
1038 if (!fxIsPropertyCompatible(the, &slot, descriptor, mask))
1039 return 0;
1040#if mxAliasInstance
1041 if (instance->ID) {
1042 txSlot* alias = the->aliasArray[instance->ID];
1043 if (!alias) {
1044 alias = fxAliasInstance(the, instance);
1045 array = alias->next;
1046 }
1047 }
1048#endif
1049 if (descriptor->kind != XS_UNINITIALIZED_KIND) {
1050 if (array->value.array.length != length)
1051 result = fxSetArrayLength(the, array, length);
1052 }
1053 if ((mask & XS_DONT_SET_FLAG) && (descriptor->flag & XS_DONT_SET_FLAG) && !(array->flag & XS_DONT_SET_FLAG))
1054 array->flag |= XS_DONT_SET_FLAG;
1055 return result;
1056 }
1057 return fxOrdinaryDefineOwnProperty(the, instance, id, index, descriptor, mask);
1058}
1059
1060txBoolean fxArrayDeleteProperty(txMachine* the, txSlot* instance, txID id, txIndex index)
1061{

Callers

nothing calls this directly

Calls 5

fxCheckArrayLengthFunction · 0.85
fxIsPropertyCompatibleFunction · 0.85
fxAliasInstanceFunction · 0.85
fxSetArrayLengthFunction · 0.85

Tested by

no test coverage detected