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

Function fx_Object_keys

xs/sources/xsObject.c:1018–1048  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016}
1017
1018void fx_Object_keys(txMachine* the)
1019{
1020 txSlot* instance;
1021 txSlot* result;
1022 txSlot* array;
1023 txSlot* property;
1024 txSlot** address;
1025 txSlot* item;
1026 if ((mxArgc < 1) || (mxArgv(0)->kind == XS_UNDEFINED_KIND) || (mxArgv(0)->kind == XS_NULL_KIND))
1027 mxTypeError("invalid object");
1028 instance = fxToInstance(the, mxArgv(0));
1029 mxPush(mxArrayPrototype);
1030 result = fxNewArrayInstance(the);
1031 mxPullSlot(mxResult);
1032 array = result->next;
1033 mxBehaviorOwnKeys(the, instance, XS_EACH_NAME_FLAG, array);
1034 mxPushUndefined();
1035 property = the->stack;
1036 address = &array->next;
1037 while ((item = *address)) {
1038 if (mxBehaviorGetOwnProperty(the, instance, item->value.at.id, item->value.at.index, property) && !(property->flag & XS_DONT_ENUM_FLAG)) {
1039 array->value.array.length++;
1040 fxKeyAt(the, item->value.at.id, item->value.at.index, item);
1041 address = &(item->next);
1042 }
1043 else
1044 *address = item->next;
1045 }
1046 mxPop();
1047 fxCacheArray(the, result);
1048}
1049
1050void fx_Object_preventExtensions(txMachine* the)
1051{

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected