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

Function fxModuleFindProperty

xs/sources/xsModule.c:2651–2681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2649}
2650
2651txSlot* fxModuleFindProperty(txMachine* the, txSlot* instance, txID id, txIndex index)
2652{
2653 if (id == XS_NO_ID)
2654 return C_NULL;
2655 if (fxIsKeySymbol(the, id)) {
2656 if (id == mxID(_Symbol_toStringTag))
2657 return mxModulePrototype.value.reference->next;
2658 }
2659// if (mxModuleInstanceStatus(instance) < XS_MODULE_STATUS_LINKED) {
2660// mxReferenceError("module not initialized yet");
2661// }
2662// else
2663 {
2664 txSlot* exports = mxModuleInstanceExports(instance);
2665 if (mxIsReference(exports)) {
2666 txSlot* property = exports->value.reference->next;
2667 while (property) {
2668 if (property->ID == id) {
2669 property = property->value.export.closure;
2670 if (property && (property->kind == XS_UNINITIALIZED_KIND)) {
2671 fxIDToString(the, id, the->nameBuffer, sizeof(the->nameBuffer));
2672 mxReferenceError("get %s: not initialized yet", the->nameBuffer);
2673 }
2674 return property;
2675 }
2676 property = property->next;
2677 }
2678 }
2679 }
2680 return C_NULL;
2681}
2682
2683txBoolean fxModuleGetOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* slot)
2684{

Callers 3

fxModuleGetOwnPropertyFunction · 0.85
fxModuleGetPropertyValueFunction · 0.85

Calls 2

fxIsKeySymbolFunction · 0.85
fxIDToStringFunction · 0.85

Tested by

no test coverage detected