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

Function fxLoadVirtualModuleNamespace

xs/sources/xsModule.c:1264–1292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262}
1263
1264void fxLoadVirtualModuleNamespace(txMachine* the, txSlot* object, txSlot* module)
1265{
1266 txSlot* exports = fxNewInstance(the);
1267 txSlot* export = exports;
1268 txSlot* at;
1269 txSlot* property;
1270 at = fxNewInstance(the);
1271 mxBehaviorOwnKeys(the, object, XS_EACH_NAME_FLAG, at);
1272 mxTemporary(property);
1273 while ((at = at->next)) {
1274 if (at->value.at.id != XS_NO_ID) {
1275 if (mxBehaviorGetOwnProperty(the, object, at->value.at.id, at->value.at.index, property) && !(property->flag & XS_DONT_ENUM_FLAG)) {
1276 mxPushReference(object);
1277 mxGetAll(at->value.at.id, at->value.at.index);
1278 export = export->next = fxNewSlot(the);
1279 export->ID = at->value.at.id;
1280 export->value.export.closure = fxNewSlot(the);
1281 export->value.export.closure->kind = the->stack->kind;
1282 export->value.export.closure->value = the->stack->value;
1283 export->value.export.module = module;
1284 export->kind = XS_EXPORT_KIND;
1285 mxPop();
1286 }
1287 }
1288 }
1289 mxPop();
1290 mxPop();
1291 mxPullSlot(mxModuleInstanceExports(module));
1292}
1293
1294void fxLoadVirtualModuleSource(txMachine* the, txSlot* record, txSlot* instance)
1295{

Callers 1

fxMapModuleDescriptorFunction · 0.85

Calls 2

fxNewInstanceFunction · 0.85
fxNewSlotFunction · 0.85

Tested by

no test coverage detected