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

Function fxPrepareModule

xs/sources/xsModule.c:2023–2056  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2021}
2022
2023void fxPrepareModule(txMachine* the, txFlag flag)
2024{
2025 txSlot* module = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.module;
2026 txInteger c = the->stack->value.integer, i;
2027 txSlot* argument = the->stack + c;
2028 txSlot* result = the->stack + c;
2029 txSlot* slot;
2030 txSlot* property;
2031 property = mxModuleInstanceInternal(module);
2032 fxCheckModuleFlag(the, property->value.module.id, flag, property->flag);
2033 property->flag |= flag;
2034 slot = argument--;
2035 property = mxModuleInstanceInitialize(module);
2036 property->kind = slot->kind;
2037 property->value = slot->value;
2038 slot = argument--;
2039 property = mxModuleInstanceExecute(module);
2040 property->kind = slot->kind;
2041 property->value = slot->value;
2042 mxFunctionInstanceCode(slot->value.reference)->ID = mxModuleInstanceInternal(module)->value.module.id;
2043 slot = &mxHosts;
2044 property = mxModuleInstanceHosts(module);
2045 property->kind = slot->kind;
2046 property->value = slot->value;
2047 mxPush(mxObjectPrototype);
2048 slot = fxLastProperty(the, fxNewObjectInstance(the));
2049 for (i = 2; i < c; i++)
2050 slot = fxNextSlotProperty(the, slot, argument--, XS_NO_ID, XS_DONT_ENUM_FLAG);
2051 property = mxModuleInstanceTransfers(module);
2052 mxPullSlot(property);
2053 result->kind = XS_REFERENCE_KIND;
2054 result->value.reference = module;
2055 the->stack = result;
2056}
2057
2058void fxPrepareTransfer(txMachine* the, txFlag flag)
2059{

Callers 1

xsRun.cFile · 0.85

Calls 4

fxCheckModuleFlagFunction · 0.85
fxLastPropertyFunction · 0.85
fxNewObjectInstanceFunction · 0.85
fxNextSlotPropertyFunction · 0.85

Tested by

no test coverage detected