| 1605 | } |
| 1606 | |
| 1607 | void fx_WeakSet(txMachine* the) |
| 1608 | { |
| 1609 | txSlot *function, *iterable, *iterator, *next, *value; |
| 1610 | if (!mxHasTarget) |
| 1611 | mxTypeError("call: WeakSet"); |
| 1612 | mxPushSlot(mxTarget); |
| 1613 | fxGetPrototypeFromConstructor(the, &mxWeakSetPrototype); |
| 1614 | fxNewWeakSetInstance(the); |
| 1615 | mxPullSlot(mxResult); |
| 1616 | if (mxArgc < 1) |
| 1617 | return; |
| 1618 | iterable = mxArgv(0); |
| 1619 | if ((iterable->kind == XS_UNDEFINED_KIND) || (iterable->kind == XS_NULL_KIND)) |
| 1620 | return; |
| 1621 | mxPushSlot(mxResult); |
| 1622 | mxGetID(mxID(_add)); |
| 1623 | function = the->stack; |
| 1624 | if (!fxIsCallable(the, function)) |
| 1625 | mxTypeError("result.add: not a function"); |
| 1626 | mxTemporary(iterator); |
| 1627 | mxTemporary(next); |
| 1628 | fxGetIterator(the, iterable, iterator, next, 0); |
| 1629 | mxTemporary(value); |
| 1630 | while (fxIteratorNext(the, iterator, next, value)) { |
| 1631 | mxTry(the) { |
| 1632 | mxPushSlot(mxResult); |
| 1633 | mxPushSlot(function); |
| 1634 | mxCall(); |
| 1635 | mxPushSlot(value); |
| 1636 | mxRunCount(1); |
| 1637 | mxPop(); |
| 1638 | } |
| 1639 | mxCatch(the) { |
| 1640 | fxIteratorReturn(the, iterator, 1); |
| 1641 | fxJump(the); |
| 1642 | } |
| 1643 | } |
| 1644 | } |
| 1645 | |
| 1646 | void fx_WeakSet_prototype_add(txMachine* the) |
| 1647 | { |
nothing calls this directly
no test coverage detected