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

Function fxArrayLengthGetter

xs/sources/xsArray.c:963–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961}
962
963void fxArrayLengthGetter(txMachine* the)
964{
965 txSlot* instance = fxToInstance(the, mxThis);
966 txSlot* array;
967 while (instance) {
968 if (instance->flag & XS_EXOTIC_FLAG) {
969 array = instance->next;
970 if ((array->kind == XS_ARRAY_KIND) && (array->ID == XS_ARRAY_BEHAVIOR))
971 break;
972 }
973 instance = fxGetPrototype(the, instance);
974 }
975 if (!instance)
976 return;
977#if mxAliasInstance
978 if (instance->ID) {
979 txSlot* alias = the->aliasArray[instance->ID];
980 if (alias)
981 array = alias->next;
982 }
983#endif
984 if (((txInteger)array->value.array.length) < 0) {
985 mxResult->value.number = array->value.array.length;
986 mxResult->kind = XS_NUMBER_KIND;
987 }
988 else {
989 mxResult->value.integer = (txInteger)array->value.array.length;
990 mxResult->kind = XS_INTEGER_KIND;
991 }
992}
993
994void fxArrayLengthSetter(txMachine* the)
995{

Callers

nothing calls this directly

Calls 2

fxToInstanceFunction · 0.85
fxGetPrototypeFunction · 0.85

Tested by

no test coverage detected