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

Function fx_mutabilities

xs/sources/xsLockdown.c:486–560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484static void fxVerifyQueue(txMachine* the, txSlot* list, txSlot* path, txSlot* instance, txID id, txIndex index, txString name);
485
486void fx_mutabilities(txMachine* the)
487{
488 txSlot* instance;
489 txSlot* module;
490 txSlot* realm;
491 txSlot* slot;
492 txSlot* list;
493 txSlot* item;
494
495 fxVars(the, 2);
496
497 mxPush(mxArrayPrototype);
498 instance = fxNewArrayInstance(the);
499 mxPullSlot(mxResult);
500
501 fxNewHostObject(the, NULL);
502 fxSetHostChunk(the, the->stack, NULL, the->keyIndex);
503 mxPullSlot(mxVarv(0));
504
505 module = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.module;
506 if (!module) module = mxProgram.value.reference;
507 realm = mxModuleInstanceInternal(module)->value.module.realm;
508 mxPushSlot(mxRealmGlobal(realm));
509 mxPullSlot(mxVarv(1));
510
511 if (mxArgc == 0)
512 return;
513 slot = mxArgv(0);
514 if (slot->kind != XS_REFERENCE_KIND)
515 return;
516
517 mxTemporary(list);
518 list->value.list.first = C_NULL;
519 list->value.list.last = C_NULL;
520 list->kind = XS_LIST_KIND;
521
522 item = fxNewSlot(the);
523 item->value.list.first = C_NULL;
524 item->value.list.last = slot->value.reference;
525 item->kind = XS_LIST_KIND;
526 list->value.list.first = item;
527 list->value.list.last = item;
528
529 {
530 mxTry(the) {
531 while (item) {
532 fxVerifyInstance(the, list, item->value.list.first, item->value.list.last);
533 item = item->next;
534 }
535 item = list->value.list.first;
536 while (item) {
537 item->value.list.last->flag &= ~XS_LEVEL_FLAG;
538 item = item->next;
539 }
540 }
541 mxCatch(the) {
542 item = list->value.list.first;
543 while (item) {

Callers

nothing calls this directly

Calls 8

fxVarsFunction · 0.85
fxNewArrayInstanceFunction · 0.85
fxNewHostObjectFunction · 0.85
fxSetHostChunkFunction · 0.85
fxNewSlotFunction · 0.85
fxVerifyInstanceFunction · 0.85
fxJumpFunction · 0.85
fxCacheArrayFunction · 0.85

Tested by

no test coverage detected