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

Function fxVerifyErrorString

xs/sources/xsLockdown.c:712–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void fxVerifyErrorString(txMachine* the, txSlot* slot, txID id, txIndex index, txString string)
713{
714 if (string) {
715 fxConcatStringC(the, slot, "[[");
716 fxConcatStringC(the, slot, string);
717 fxConcatStringC(the, slot, "]]");
718 }
719 else if (id != XS_NO_ID) {
720 txBoolean adorn;
721 txString string = fxGetKeyString(the, id, &adorn);
722 txString buffer = the->nameBuffer;
723 size_t count = c_snprintf(buffer, sizeof(the->nameBuffer), "%s", string);
724 if (count >= sizeof(the->nameBuffer)) {
725 buffer = c_malloc(count + 1);
726 if (!buffer)
727 fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
728 c_memcpy(buffer, string, count + 1);
729 }
730 if (adorn) {
731 fxConcatStringC(the, slot, "[Symbol(");
732 fxConcatStringC(the, slot, buffer);
733 fxConcatStringC(the, slot, ")]");
734 }
735 else {
736 fxConcatStringC(the, slot, ".");
737 fxConcatStringC(the, slot, buffer);
738 }
739 if (buffer != the->nameBuffer)
740 c_free(buffer);
741 }
742 else {
743 fxNumberToString(the, index, the->nameBuffer, sizeof(the->nameBuffer), 0, 0);
744 fxConcatStringC(the, slot, "[");
745 fxConcatStringC(the, slot, the->nameBuffer);
746 fxConcatStringC(the, slot, "]");
747 }
748}
749
750void fxVerifyInstance(txMachine* the, txSlot* list, txSlot* path, txSlot* instance)
751{

Callers 1

fxVerifyErrorFunction · 0.85

Calls 4

fxConcatStringCFunction · 0.85
fxGetKeyStringFunction · 0.85
fxNumberToStringFunction · 0.85
fxAbortFunction · 0.70

Tested by

no test coverage detected