| 3467 | } |
| 3468 | |
| 3469 | txSlot* fxImportModuleStuff(txMachine* the, txSlot* realm, txSlot* queue, txSlot* reference, txSlot* name, txBoolean now) |
| 3470 | { |
| 3471 | txID moduleID = (name->kind == XS_STRING_X_KIND) ? fxNewNameX(the, name->value.string) : fxNewName(the, name); |
| 3472 | txSlot* list = mxModuleStuffModules(reference)->value.reference; |
| 3473 | txSlot* module = mxBehaviorGetProperty(the, list, moduleID, 0, XS_ANY); |
| 3474 | if (!module) { |
| 3475 | txSlot* handler = mxModuleStuffHandler(reference); |
| 3476 | txSlot* importHook = (now) ? mxModuleStuffImportNowHook(reference) : mxModuleStuffImportHook(reference); |
| 3477 | txSlot* loader; |
| 3478 | |
| 3479 | module = mxBehaviorSetProperty(the, list, moduleID, 0, XS_OWN); |
| 3480 | fxNewModule(the, realm, XS_NO_ID, XS_NO_FLAG, module); |
| 3481 | mxModuleStatus(module) = XS_MODULE_STATUS_LOADING; |
| 3482 | fxQueueModule(the, queue, module); |
| 3483 | |
| 3484 | loader = mxModuleLoader(module); |
| 3485 | loader->kind = reference->kind; |
| 3486 | loader->value = reference->value; |
| 3487 | |
| 3488 | mxPushSlot(handler); |
| 3489 | mxPushSlot(importHook); |
| 3490 | mxCall(); |
| 3491 | mxPushSlot(name); |
| 3492 | fxPushModuleOptions(the, name->flag); |
| 3493 | mxRunCount(2); |
| 3494 | |
| 3495 | if (now) { |
| 3496 | fxLoadModuleStuff(the, queue, module, the->stack); |
| 3497 | } |
| 3498 | else { |
| 3499 | fxLoadModulesPromise(the, queue, module, the->stack, fxLoadModuleStuffFulfilled, fxLoadModuleStuffRejected); |
| 3500 | } |
| 3501 | mxPop(); |
| 3502 | } |
| 3503 | return module; |
| 3504 | } |
| 3505 | |
| 3506 | void fxLoadModuleStuff(txMachine* the, txSlot* queue, txSlot* module, txSlot* stuff) |
| 3507 | { |
no test coverage detected