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

Function fx_Object_entries

xs/sources/xsObject.c:607–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605}
606
607void fx_Object_entries(txMachine* the)
608{
609 txSlot* instance;
610 txSlot* result;
611 txSlot* array;
612 txSlot* property;
613 txSlot** address;
614 txSlot* item;
615 if ((mxArgc < 1) || (mxArgv(0)->kind == XS_UNDEFINED_KIND) || (mxArgv(0)->kind == XS_NULL_KIND))
616 mxTypeError("invalid object");
617 instance = fxToInstance(the, mxArgv(0));
618 mxPush(mxArrayPrototype);
619 result = fxNewArrayInstance(the);
620 mxPullSlot(mxResult);
621 array = result->next;
622 mxBehaviorOwnKeys(the, instance, XS_EACH_NAME_FLAG, array);
623 mxPushUndefined();
624 property = the->stack;
625 address = &array->next;
626 while ((item = *address)) {
627 if (mxBehaviorGetOwnProperty(the, instance, item->value.at.id, item->value.at.index, property) && !(property->flag & XS_DONT_ENUM_FLAG)) {
628 array->value.array.length++;
629 mxPushUndefined();
630 fxKeyAt(the, item->value.at.id, item->value.at.index, the->stack);
631 mxPushReference(instance);
632 mxGetAll(item->value.at.id, item->value.at.index);
633 fxConstructArrayEntry(the, item);
634 address = &(item->next);
635 }
636 else
637 *address = item->next;
638 }
639 mxPop();
640 fxCacheArray(the, result);
641}
642
643void fx_Object_freeze(txMachine* the)
644{

Callers

nothing calls this directly

Calls 5

fxToInstanceFunction · 0.85
fxNewArrayInstanceFunction · 0.85
fxKeyAtFunction · 0.85
fxConstructArrayEntryFunction · 0.85
fxCacheArrayFunction · 0.85

Tested by

no test coverage detected