| 3265 | } |
| 3266 | |
| 3267 | void fx_ModuleSource(txMachine* the) |
| 3268 | { |
| 3269 | txSlot* instance; |
| 3270 | txUnsigned flags = mxDebugFlag; |
| 3271 | txSlot* slot; |
| 3272 | txStringStream stream; |
| 3273 | txScript* script; |
| 3274 | if (!mxHasTarget) |
| 3275 | mxTypeError("call: ModuleSource"); |
| 3276 | mxPushSlot(mxTarget); |
| 3277 | fxGetPrototypeFromConstructor(the, &mxModuleSourcePrototype); |
| 3278 | instance = fxNewModuleSourceInstance(the); |
| 3279 | mxPullSlot(mxResult); |
| 3280 | if (mxArgc > 0) |
| 3281 | mxPushSlot(mxArgv(0)); |
| 3282 | else |
| 3283 | mxPushUndefined(); |
| 3284 | if (mxArgc > 1) { |
| 3285 | if (fxCheckModuleOptions(the, mxArgv(1))) { |
| 3286 | instance->next->flag |= XS_JSON_MODULE_FLAG; |
| 3287 | flags |= mxJSONModuleFlag; |
| 3288 | } |
| 3289 | } |
| 3290 | slot = the->stack; |
| 3291 | stream.slot = slot; |
| 3292 | stream.offset = 0; |
| 3293 | stream.size = mxStringLength(fxToString(the, slot)); |
| 3294 | script = fxParseScript(the, &stream, fxStringGetter, flags); |
| 3295 | // mxPushClosure(mxResult); |
| 3296 | fxRunScript(the, script, mxResult, C_NULL, C_NULL, C_NULL, instance); |
| 3297 | mxPop(); |
| 3298 | if (mxModuleInstanceExecute(instance)->kind == XS_NULL_KIND) |
| 3299 | mxTypeError("no module"); |
| 3300 | mxPop(); |
| 3301 | mxPop(); |
| 3302 | } |
| 3303 | |
| 3304 | void fx_ModuleSource_prototype_get_bindings(txMachine* the) |
| 3305 | { |
nothing calls this directly
no test coverage detected