MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fx_Array_of

Function fx_Array_of

xs/sources/xsArray.c:1531–1564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1529}
1530
1531void fx_Array_of(txMachine* the)
1532{
1533 txIndex count = (txIndex)mxArgc, index = 0;
1534 txSlot* array = fxCreateArray(the, 1, count);
1535 if (array) {
1536 txSlot* slot;
1537 fxSetIndexSize(the, array, count, XS_CHUNK);
1538 slot = array->value.array.address;
1539 while (index < count) {
1540 txSlot* argument = mxArgv(index);
1541 *((txIndex*)slot) = index;
1542 slot->ID = XS_NO_ID;
1543 slot->kind = argument->kind;
1544 slot->value = argument->value;
1545 slot++;
1546 mxMeterSome(4);
1547 index++;
1548 }
1549 mxMeterSome(4);
1550 }
1551 else {
1552 while (index < count) {
1553 mxPushSlot(mxArgv(index));
1554 mxPushSlot(mxResult);
1555 mxDefineIndex(index, 0, XS_GET_ONLY);
1556 mxPop();
1557 index++;
1558 }
1559 mxPushInteger(count);
1560 mxPushSlot(mxResult);
1561 mxSetID(mxID(_length));
1562 mxPop();
1563 }
1564}
1565
1566void fx_Array_prototype_at(txMachine* the)
1567{

Callers

nothing calls this directly

Calls 2

fxCreateArrayFunction · 0.85
fxSetIndexSizeFunction · 0.85

Tested by

no test coverage detected