| 694 | } |
| 695 | |
| 696 | void fx_Set(txMachine* the) |
| 697 | { |
| 698 | txSlot *function, *iterable, *iterator, *next, *value; |
| 699 | if (!mxHasTarget) |
| 700 | mxTypeError("call: Set"); |
| 701 | mxPushSlot(mxTarget); |
| 702 | fxGetPrototypeFromConstructor(the, &mxSetPrototype); |
| 703 | fxNewSetInstance(the, mxTableMinLength); |
| 704 | mxPullSlot(mxResult); |
| 705 | if (mxArgc < 1) |
| 706 | return; |
| 707 | iterable = mxArgv(0); |
| 708 | if ((iterable->kind == XS_UNDEFINED_KIND) || (iterable->kind == XS_NULL_KIND)) |
| 709 | return; |
| 710 | mxPushSlot(mxResult); |
| 711 | mxGetID(mxID(_add)); |
| 712 | function = the->stack; |
| 713 | if (!fxIsCallable(the, function)) |
| 714 | mxTypeError("result.add: not a function"); |
| 715 | mxTemporary(iterator); |
| 716 | mxTemporary(next); |
| 717 | fxGetIterator(the, iterable, iterator, next, 0); |
| 718 | mxTemporary(value); |
| 719 | while (fxIteratorNext(the, iterator, next, value)) { |
| 720 | mxTry(the) { |
| 721 | mxPushSlot(mxResult); |
| 722 | mxPushSlot(function); |
| 723 | mxCall(); |
| 724 | mxPushSlot(value); |
| 725 | mxRunCount(1); |
| 726 | mxPop(); |
| 727 | } |
| 728 | mxCatch(the) { |
| 729 | fxIteratorReturn(the, iterator, 1); |
| 730 | fxJump(the); |
| 731 | } |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | void fx_Set_prototype_add(txMachine* the) |
| 736 | { |
nothing calls this directly
no test coverage detected