| 1292 | } |
| 1293 | |
| 1294 | void fxLoadVirtualModuleSource(txMachine* the, txSlot* record, txSlot* instance) |
| 1295 | { |
| 1296 | txSlot* slot; |
| 1297 | txSlot* function; |
| 1298 | txSlot* property; |
| 1299 | txSlot* transfers; |
| 1300 | txSlot* transfer; |
| 1301 | |
| 1302 | mxPushSlot(record); |
| 1303 | mxGetID(fxID(the, "execute")); |
| 1304 | slot = the->stack; |
| 1305 | if (!mxIsUndefined(slot)) { |
| 1306 | if (!fxIsCallable(the, slot)) |
| 1307 | mxTypeError("execute: not a function"); |
| 1308 | } |
| 1309 | function = fxNewHostFunction(the, fxExecuteVirtualModuleSource, 0, XS_NO_ID, mxExecuteVirtualModuleSourceProfileID); |
| 1310 | property = mxFunctionInstanceHome(function); |
| 1311 | property->value.home.object = fxToInstance(the, record); |
| 1312 | property->value.home.module = instance; |
| 1313 | property = fxLastProperty(the, function); |
| 1314 | property = fxNextSlotProperty(the, property, slot, XS_NO_ID, XS_INTERNAL_FLAG); |
| 1315 | mxPullSlot(mxModuleInstanceExecute(instance)); |
| 1316 | mxPop(); // initialize |
| 1317 | |
| 1318 | mxPush(mxObjectPrototype); |
| 1319 | transfers = fxNewObjectInstance(the); |
| 1320 | transfer = fxLastProperty(the, transfers); |
| 1321 | |
| 1322 | mxPushSlot(record); |
| 1323 | mxGetID(mxID(_bindings)); |
| 1324 | if (!mxIsUndefined(the->stack)) { |
| 1325 | txSlot* array; |
| 1326 | txInteger length, index; |
| 1327 | |
| 1328 | array = the->stack; |
| 1329 | mxPushSlot(array); |
| 1330 | mxGetID(mxID(_length)); |
| 1331 | length = fxToInteger(the, the->stack); |
| 1332 | mxPop(); |
| 1333 | |
| 1334 | for (index = 0; index < length; index++) { |
| 1335 | txSlot* item; |
| 1336 | txSlot* temporary; |
| 1337 | txInteger from = 0; |
| 1338 | txInteger export = 0; |
| 1339 | txInteger import = 0; |
| 1340 | txID nameID = 0, asID; |
| 1341 | txSlot* specifier = C_NULL; |
| 1342 | txSlot* former; |
| 1343 | |
| 1344 | mxPushSlot(array); |
| 1345 | mxGetIndex(index); |
| 1346 | item = the->stack; |
| 1347 | |
| 1348 | mxTemporary(temporary); |
| 1349 | |
| 1350 | mxPushSlot(item); |
| 1351 | mxGetID(mxID(_from)); |
no test coverage detected