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

Function fx_Object_getOwnPropertyDescriptors

xs/sources/xsObject.c:799–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797}
798
799void fx_Object_getOwnPropertyDescriptors(txMachine* the)
800{
801 txSlot* instance;
802 txSlot* result;
803 txSlot* at;
804 txSlot* property;
805 if ((mxArgc < 1) || (mxArgv(0)->kind == XS_UNDEFINED_KIND) || (mxArgv(0)->kind == XS_NULL_KIND))
806 mxTypeError("invalid object");
807 instance = fxToInstance(the, mxArgv(0));
808 mxPush(mxObjectPrototype);
809 result = fxNewObjectInstance(the);
810 mxPullSlot(mxResult);
811 at = fxNewInstance(the);
812 mxBehaviorOwnKeys(the, instance, XS_EACH_NAME_FLAG | XS_EACH_SYMBOL_FLAG, at);
813 mxPushUndefined();
814 property = the->stack;
815 while ((at = at->next)) {
816 if (mxBehaviorGetOwnProperty(the, instance, at->value.at.id, at->value.at.index, property)) {
817 fxDescribeProperty(the, property, XS_GET_ONLY);
818 mxBehaviorDefineOwnProperty(the, result, at->value.at.id, at->value.at.index, the->stack, XS_GET_ONLY);
819 mxPop();
820 }
821 }
822 mxPop();
823}
824
825void fx_Object_getOwnPropertyNames(txMachine* the)
826{

Callers

nothing calls this directly

Calls 4

fxToInstanceFunction · 0.85
fxNewObjectInstanceFunction · 0.85
fxNewInstanceFunction · 0.85
fxDescribePropertyFunction · 0.85

Tested by

no test coverage detected