| 1432 | } |
| 1433 | |
| 1434 | void fx_Enumerator(txMachine* the) |
| 1435 | { |
| 1436 | txSlot* iterator; |
| 1437 | txSlot* result; |
| 1438 | txSlot* slot; |
| 1439 | txSlot* keys; |
| 1440 | txSlot* visited; |
| 1441 | |
| 1442 | mxPush(mxEnumeratorFunction); |
| 1443 | mxGetID(mxID(_prototype)); |
| 1444 | iterator = fxNewObjectInstance(the); |
| 1445 | mxPullSlot(mxResult); |
| 1446 | mxPush(mxObjectPrototype); |
| 1447 | result = fxNewObjectInstance(the); |
| 1448 | slot = fxNextUndefinedProperty(the, result, mxID(_value), XS_DONT_DELETE_FLAG | XS_DONT_SET_FLAG); |
| 1449 | slot = fxNextBooleanProperty(the, slot, 0, mxID(_done), XS_DONT_DELETE_FLAG | XS_DONT_SET_FLAG); |
| 1450 | slot = fxNextSlotProperty(the, iterator, the->stack, mxID(_result), XS_GET_ONLY); |
| 1451 | mxPop(); |
| 1452 | |
| 1453 | slot = slot->next = fxNewSlot(the); |
| 1454 | slot->flag = XS_GET_ONLY; |
| 1455 | slot->ID = mxID(_iterable); |
| 1456 | slot->kind = mxThis->kind; |
| 1457 | slot->value = mxThis->value; |
| 1458 | if (mxIsUndefined(slot) || mxIsNull(slot)) |
| 1459 | return; |
| 1460 | fxToInstance(the, slot); |
| 1461 | |
| 1462 | keys = fxNewInstance(the); |
| 1463 | mxBehaviorOwnKeys(the, slot->value.reference, XS_EACH_NAME_FLAG, keys); |
| 1464 | slot = slot->next = fxNewSlot(the); |
| 1465 | slot->flag = XS_GET_ONLY; |
| 1466 | slot->kind = XS_REFERENCE_KIND; |
| 1467 | slot->value.reference = keys; |
| 1468 | mxPop(); |
| 1469 | |
| 1470 | visited = fxNewInstance(the); |
| 1471 | slot = slot->next = fxNewSlot(the); |
| 1472 | slot->flag = XS_GET_ONLY; |
| 1473 | slot->kind = XS_REFERENCE_KIND; |
| 1474 | slot->value.reference = visited; |
| 1475 | mxPop(); |
| 1476 | } |
| 1477 | |
| 1478 | void fx_Enumerator_prototype_next(txMachine* the) |
| 1479 | { |
nothing calls this directly
no test coverage detected