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

Function fxBuildCompartmentGlobals

xs/tools/xst262.c:1408–1435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1406}
1407
1408void fxBuildCompartmentGlobals(txMachine* the)
1409{
1410 txSlot* realm = mxProgram.value.reference->next->value.module.realm;
1411 txSlot* global = mxRealmGlobal(realm)->value.reference;
1412 txSlot* environment = mxRealmClosures(realm)->value.reference;
1413 txSlot* slot;
1414 txSlot* property;
1415
1416 mxPush(mxObjectPrototype);
1417 property = fxLastProperty(the, fxNewHostObject(the, NULL));
1418 slot = global->next->next;
1419 while (slot) {
1420 if (slot->ID > mxID(_globalThis)) {
1421// fprintf(stderr, "%s\n", fxGetKeyName(the, slot->ID));
1422 property = fxNextSlotProperty(the, property, slot, slot->ID, XS_NO_FLAG);
1423 }
1424 slot = slot->next;
1425 }
1426 slot = environment->next->next;
1427 while (slot) {
1428 if (slot->kind == XS_CLOSURE_KIND) {
1429// fprintf(stderr, "%s\n", fxGetKeyName(the, slot->ID));
1430 property = fxNextSlotProperty(the, property, slot->value.closure, slot->ID, XS_NO_FLAG);
1431 }
1432 slot = slot->next;
1433 }
1434 mxPullSlot(mxResult);
1435}
1436
1437void fxLoadHook(txMachine* the)
1438{

Callers 2

Calls 3

fxLastPropertyFunction · 0.85
fxNewHostObjectFunction · 0.85
fxNextSlotPropertyFunction · 0.85

Tested by

no test coverage detected