| 1439 | } |
| 1440 | |
| 1441 | void fx_WeakMap(txMachine* the) |
| 1442 | { |
| 1443 | txSlot *function, *iterable, *iterator, *next, *value; |
| 1444 | if (!mxHasTarget) |
| 1445 | mxTypeError("call: WeakMap"); |
| 1446 | mxPushSlot(mxTarget); |
| 1447 | fxGetPrototypeFromConstructor(the, &mxWeakMapPrototype); |
| 1448 | fxNewWeakMapInstance(the); |
| 1449 | mxPullSlot(mxResult); |
| 1450 | if (mxArgc < 1) |
| 1451 | return; |
| 1452 | iterable = mxArgv(0); |
| 1453 | if ((iterable->kind == XS_UNDEFINED_KIND) || (iterable->kind == XS_NULL_KIND)) |
| 1454 | return; |
| 1455 | mxPushSlot(mxResult); |
| 1456 | mxGetID(mxID(_set)); |
| 1457 | function = the->stack; |
| 1458 | if (!fxIsCallable(the, function)) |
| 1459 | mxTypeError("result.set: not a function"); |
| 1460 | mxTemporary(iterator); |
| 1461 | mxTemporary(next); |
| 1462 | fxGetIterator(the, iterable, iterator, next, 0); |
| 1463 | mxTemporary(value); |
| 1464 | while (fxIteratorNext(the, iterator, next, value)) { |
| 1465 | mxTry(the) { |
| 1466 | mxPushSlot(mxResult); |
| 1467 | mxPushSlot(function); |
| 1468 | mxCall(); |
| 1469 | if (value->kind != XS_REFERENCE_KIND) |
| 1470 | mxTypeError("item: not an object"); |
| 1471 | mxPushSlot(value); |
| 1472 | mxGetIndex(0); |
| 1473 | mxPushSlot(value); |
| 1474 | mxGetIndex(1); |
| 1475 | mxRunCount(2); |
| 1476 | mxPop(); |
| 1477 | } |
| 1478 | mxCatch(the) { |
| 1479 | fxIteratorReturn(the, iterator, 1); |
| 1480 | fxJump(the); |
| 1481 | } |
| 1482 | } |
| 1483 | } |
| 1484 | |
| 1485 | void fx_WeakMap_prototype_delete(txMachine* the) |
| 1486 | { |
nothing calls this directly
no test coverage detected