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

Function fxArrayLengthSetter

xs/sources/xsArray.c:994–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992}
993
994void fxArrayLengthSetter(txMachine* the)
995{
996 txSlot* instance = fxToInstance(the, mxThis);
997 txSlot* array;
998 txIndex length;
999 while (instance) {
1000 if (instance->flag & XS_EXOTIC_FLAG) {
1001 array = instance->next;
1002 if (array->ID == XS_ARRAY_BEHAVIOR)
1003 break;
1004 }
1005 instance = fxGetPrototype(the, instance);
1006 }
1007 if (!instance)
1008 return;
1009#if mxAliasInstance
1010 if (instance->ID) {
1011 txSlot* alias = the->aliasArray[instance->ID];
1012 if (!alias)
1013 alias = fxAliasInstance(the, instance);
1014 array = alias->next;
1015 }
1016#endif
1017 length = fxCheckArrayLength(the, mxArgv(0));
1018 if (array->flag & XS_DONT_SET_FLAG) {
1019 if (the->frame->next->flag & XS_STRICT_FLAG)
1020 mxTypeError("set length: not writable");
1021 else
1022 return;
1023 }
1024 fxSetArrayLength(the, array, length);
1025}
1026
1027txBoolean fxArrayDefineOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* descriptor, txFlag mask)
1028{

Callers

nothing calls this directly

Calls 5

fxToInstanceFunction · 0.85
fxGetPrototypeFunction · 0.85
fxAliasInstanceFunction · 0.85
fxCheckArrayLengthFunction · 0.85
fxSetArrayLengthFunction · 0.85

Tested by

no test coverage detected