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

Function fxNewMapInstance

xs/sources/xsMapSet.c:240–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240txSlot* fxNewMapInstance(txMachine* the)
241{
242 txSlot* map;
243 txSlot* table;
244 txSlot* list;
245 txSlot* size;
246 txSlot** address;
247 map = fxNewSlot(the);
248 map->kind = XS_INSTANCE_KIND;
249 map->value.instance.garbage = C_NULL;
250 map->value.instance.prototype = the->stack->value.reference;
251 the->stack->kind = XS_REFERENCE_KIND;
252 the->stack->value.reference = map;
253 table = map->next = fxNewSlot(the);
254 list = table->next = fxNewSlot(the);
255 size = list->next = fxNewSlot(the);
256 address = (txSlot**)fxNewChunk(the, mxTableMinLength * sizeof(txSlot*));
257 c_memset(address, 0, mxTableMinLength * sizeof(txSlot*));
258 /* TABLE */
259 table->flag = XS_INTERNAL_FLAG;
260 table->kind = XS_MAP_KIND;
261 table->value.table.address = address;
262 table->value.table.length = mxTableMinLength;
263 /* LIST */
264 list->flag = XS_INTERNAL_FLAG;
265 list->kind = XS_LIST_KIND;
266 list->value.list.first = C_NULL;
267 list->value.list.last = C_NULL;
268 /* SIZE */
269 size->flag = XS_INTERNAL_FLAG;
270 size->kind = XS_INTEGER_KIND;
271 size->value.integer = 0;
272 return map;
273}
274
275void fx_Map(txMachine* the)
276{

Callers 2

fx_MapFunction · 0.85
fx_Map_groupByFunction · 0.85

Calls 2

fxNewSlotFunction · 0.85
fxNewChunkFunction · 0.85

Tested by

no test coverage detected