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

Function fxNewSetInstance

xs/sources/xsMapSet.c:615–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

613}
614
615txSlot* fxNewSetInstance(txMachine* the, txInteger tableLength)
616{
617 txSlot* set;
618 txSlot* table;
619 txSlot* list;
620 txSlot* size;
621 txSlot** address;
622 set = fxNewSlot(the);
623 set->kind = XS_INSTANCE_KIND;
624 set->value.instance.garbage = C_NULL;
625 set->value.instance.prototype = the->stack->value.reference;
626 the->stack->kind = XS_REFERENCE_KIND;
627 the->stack->value.reference = set;
628 table = set->next = fxNewSlot(the);
629 list = table->next = fxNewSlot(the);
630 size = list->next = fxNewSlot(the);
631 address = (txSlot**)fxNewChunk(the, tableLength * sizeof(txSlot*));
632 c_memset(address, 0, tableLength * sizeof(txSlot*));
633 /* TABLE */
634 table->flag = XS_INTERNAL_FLAG;
635 table->kind = XS_SET_KIND;
636 table->value.table.address = address;
637 table->value.table.length = tableLength;
638 /* LIST */
639 list->flag = XS_INTERNAL_FLAG;
640 list->kind = XS_LIST_KIND;
641 list->value.list.first = C_NULL;
642 list->value.list.last = C_NULL;
643 /* SIZE */
644 size->flag = XS_INTERNAL_FLAG;
645 size->kind = XS_INTEGER_KIND;
646 size->value.integer = 0;
647 return set;
648}
649
650void fxNewSetResult(txMachine* the, txSlot* table, txSlot* list, txSlot** tableAddress, txSlot** listAddress)
651{

Callers 2

fxNewSetResultFunction · 0.85
fx_SetFunction · 0.85

Calls 2

fxNewSlotFunction · 0.85
fxNewChunkFunction · 0.85

Tested by

no test coverage detected