| 1395 | } |
| 1396 | |
| 1397 | void fx_GeneratorFunction(txMachine* the) |
| 1398 | { |
| 1399 | txInteger c, i; |
| 1400 | txStringStream stream; |
| 1401 | txSlot* module = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.module; |
| 1402 | if (!module) module = mxProgram.value.reference; |
| 1403 | |
| 1404 | c = mxArgc; |
| 1405 | i = 0; |
| 1406 | mxPushStringX("(function* anonymous("); |
| 1407 | while (c > 1) { |
| 1408 | fxToString(the, mxArgv(i)); |
| 1409 | fxConcatString(the, the->stack, mxArgv(i)); |
| 1410 | if (c > 2) |
| 1411 | fxConcatStringC(the, the->stack, ", "); |
| 1412 | c--; |
| 1413 | i++; |
| 1414 | } |
| 1415 | fxConcatStringC(the, the->stack, "\n){"); |
| 1416 | if (c > 0) { |
| 1417 | fxToString(the, mxArgv(i)); |
| 1418 | fxConcatString(the, the->stack, mxArgv(i)); |
| 1419 | } |
| 1420 | fxConcatStringC(the, the->stack, "\n})"); |
| 1421 | stream.slot = the->stack; |
| 1422 | stream.offset = 0; |
| 1423 | stream.size = mxStringLength(the->stack->value.string); |
| 1424 | fxRunScript(the, fxParseScript(the, &stream, fxStringGetter, mxProgramFlag | mxGeneratorFlag), C_NULL, C_NULL, C_NULL, C_NULL, module); |
| 1425 | mxPullSlot(mxResult); |
| 1426 | if (mxHasTarget && !fxIsSameSlot(the, mxTarget, mxFunction)) { |
| 1427 | mxPushSlot(mxTarget); |
| 1428 | fxGetPrototypeFromConstructor(the, &mxGeneratorFunctionPrototype); |
| 1429 | mxResult->value.reference->value.instance.prototype = the->stack->value.reference; |
| 1430 | mxPop(); |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | void fx_Enumerator(txMachine* the) |
| 1435 | { |
nothing calls this directly
no test coverage detected