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

Function fxExecuteVirtualModuleSource

xs/sources/xsModule.c:523–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523void fxExecuteVirtualModuleSource(txMachine* the)
524{
525 txSlot* instance = mxFunction->value.reference;
526 txSlot* function = fxLastProperty(the, instance);
527 txSlot* home = mxFunctionInstanceHome(instance);
528 txSlot* module = home->value.home.module;
529 txSlot* internal = mxModuleInstanceInternal(module);
530 txSlot* meta = mxModuleInstanceMeta(module);
531 txSlot* closures = mxFunctionInstanceCode(instance)->value.callback.closures;
532 txSlot* property;
533 if (mxIsUndefined(function))
534 return;
535 closures->flag |= XS_DONT_PATCH_FLAG;
536 closures->value.instance.prototype = C_NULL;
537 property = closures->next->next;
538 while (property) {
539 property->flag |= XS_DONT_DELETE_FLAG;
540 property = property->next;
541 }
542 /* THIS */
543 mxPushReference(home->value.home.object);
544 /* FUNCTION */
545 mxPushSlot(function);
546 mxCall();
547 /* ARGUMENTS */
548 mxPushReference(closures);
549 if (internal->flag & XS_IMPORT_FLAG) {
550 function = fxNewHostFunction(the, fxExecuteVirtualModuleSourceImport, 1, XS_NO_ID, mxExecuteVirtualModuleSourceImportProfileID);
551 mxFunctionInstanceHome(function)->value.home.module = module;
552 }
553 else
554 mxPushUndefined();
555 if (internal->flag & XS_IMPORT_META_FLAG)
556 mxPushSlot(meta);
557 else
558 mxPushUndefined();
559 mxRunCount(3);
560 mxPullSlot(mxResult);
561}
562
563txSlot* fxGetModule(txMachine* the, txSlot* realm, txID moduleID, txFlag moduleFlag)
564{

Callers

nothing calls this directly

Calls 2

fxLastPropertyFunction · 0.85
fxNewHostFunctionFunction · 0.85

Tested by

no test coverage detected