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

Function fxCheckSetRecord

xs/sources/xsMapSet.c:576–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576txSlot* fxCheckSetRecord(txMachine* the, txInteger* otherSize, txSlot** otherHas, txSlot** otherKeys)
577{
578 txSlot* other;
579 txNumber size;
580 if (mxArgc < 1)
581 mxTypeError("other is no object");
582 other = mxArgv(0);
583 if (!mxIsReference(other))
584 mxTypeError("other is no object");
585
586 mxPushSlot(other);
587 mxGetID(mxID(_size));
588 size = fxToNumber(the, the->stack);
589 if (c_isnan(size))
590 mxTypeError("other.size is NaN");
591 size = c_trunc(size);
592 if (size < 0)
593 mxRangeError("other.size < 0");
594 if (otherSize)
595 *otherSize= (txInteger)size;
596 mxPop();
597
598 mxPushSlot(other);
599 mxGetID(mxID(_has));
600 if (!fxIsCallable(the, the->stack))
601 mxTypeError("other.has is no function");
602 if (otherHas)
603 *otherHas = the->stack;
604
605 mxPushSlot(other);
606 mxGetID(mxID(_keys));
607 if (!fxIsCallable(the, the->stack))
608 mxTypeError("other.keys is no function");
609 if (otherKeys)
610 *otherKeys = the->stack;
611
612 return other;
613}
614
615txSlot* fxNewSetInstance(txMachine* the, txInteger tableLength)
616{

Calls 2

fxToNumberFunction · 0.85
fxIsCallableFunction · 0.85

Tested by

no test coverage detected