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

Function fxPrepareTransfer

xs/sources/xsModule.c:2058–2098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2056}
2057
2058void fxPrepareTransfer(txMachine* the, txFlag flag)
2059{
2060 txInteger c = the->stack->value.integer, i;
2061 txSlot* argument = the->stack + c;
2062 txSlot* result = the->stack + c;
2063 txSlot* property;
2064 txSlot* slot;
2065 mxPush(mxTransferPrototype);
2066 property = fxNewObjectInstance(the);
2067 property = fxNextSlotProperty(the, property, argument--, mxID(_local), XS_DONT_ENUM_FLAG);
2068 property = fxNextSlotProperty(the, property, argument--, mxID(_from), XS_DONT_ENUM_FLAG | flag);
2069 property = fxNextSlotProperty(the, property, argument--, mxID(_import), XS_DONT_ENUM_FLAG);
2070 if (c > 3) {
2071 mxPush(mxObjectPrototype);
2072 slot = fxLastProperty(the, fxNewObjectInstance(the));
2073 if (argument->kind != XS_NULL_KIND) {
2074 for (i = 3; i < c; i++)
2075 slot = fxNextSlotProperty(the, slot, argument--, XS_NO_ID, XS_DONT_ENUM_FLAG);
2076 }
2077 property = fxNextSlotProperty(the, property, the->stack, mxID(_aliases), XS_DONT_ENUM_FLAG);
2078 mxPop();
2079 }
2080 else {
2081 property = fxNextNullProperty(the, property, mxID(_aliases), XS_DONT_ENUM_FLAG);
2082 }
2083 property = fxNextNullProperty(the, property, mxID(_closure), XS_DONT_ENUM_FLAG);
2084 result->kind = the->stack->kind;
2085 result->value = the->stack->value;
2086 the->stack = result;
2087
2088// #ifdef mxDebug
2089// slot = the->frame->next;
2090// if (slot) {
2091// slot = slot - 1;
2092// if (slot->next) {
2093// property = fxNextSlotProperty(the, property, slot->next, XS_NO_ID, XS_DONT_ENUM_FLAG);
2094// property = fxNextIntegerProperty(the, property, slot->ID, XS_NO_ID, XS_DONT_ENUM_FLAG);
2095// }
2096// }
2097// #endif
2098}
2099
2100txBoolean fxQueueModule(txMachine* the, txSlot* queue, txSlot* module)
2101{

Callers 2

xsRun.cFile · 0.85

Calls 4

fxNewObjectInstanceFunction · 0.85
fxNextSlotPropertyFunction · 0.85
fxLastPropertyFunction · 0.85
fxNextNullPropertyFunction · 0.85

Tested by

no test coverage detected