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

Function fxModuleOwnKeys

xs/sources/xsModule.c:2778–2810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2776}
2777
2778void fxModuleOwnKeys(txMachine* the, txSlot* instance, txFlag flag, txSlot* keys)
2779{
2780 if (flag & XS_EACH_NAME_FLAG) {
2781// if (mxModuleInstanceStatus(instance) < XS_MODULE_STATUS_LINKED) {
2782// mxReferenceError("module not initialized yet");
2783// }
2784// else
2785 {
2786 txSlot* exports = mxModuleInstanceExports(instance);
2787 if (mxIsReference(exports)) {
2788 txSlot* property = exports->value.reference->next;
2789 txSlot* stack = the->stack;
2790 while (property) {
2791 if (property->value.export.closure) {
2792 txSlot* key = fxGetKey(the, property->ID);
2793 mxPushSlot(key);
2794 the->stack->ID = key->ID;
2795 }
2796 property = property->next;
2797 }
2798 c_qsort(the->stack, stack - the->stack, sizeof(txSlot), fxModuleOwnKeysCompare);
2799 while (the->stack < stack) {
2800 keys = fxQueueKey(the, the->stack->ID, 0, keys);
2801 mxPop();
2802 }
2803 }
2804 }
2805 }
2806 if (flag & XS_EACH_SYMBOL_FLAG) {
2807 txSlot* property = mxModulePrototype.value.reference->next;
2808 keys = fxQueueKey(the, property->ID, 0, keys);
2809 }
2810}
2811
2812int fxModuleOwnKeysCompare(const void* p, const void* q)
2813{

Callers

nothing calls this directly

Calls 2

fxGetKeyFunction · 0.85
fxQueueKeyFunction · 0.85

Tested by

no test coverage detected