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

Function fxStripDefaults

xs/tools/xslStrip.c:674–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

672}
673
674void fxStripDefaults(txLinker* linker, FILE* file)
675{
676 if (!fxIsCodeUsed(XS_CODE_START_ASYNC)) {
677 fprintf(file, "static txSlot* fxNewAsyncInstanceDeadStrip(txMachine* the) { mxUnknownError(\"dead strip\"); return NULL; }\n");
678 fprintf(file, "static void fxRunAsyncDeadStrip(txMachine* the, txSlot* slot) { mxUnknownError(\"dead strip\"); }\n");
679 }
680 if (!fxIsCodeUsed(XS_CODE_START_GENERATOR))
681 fprintf(file, "static txSlot* fxNewGeneratorInstanceDeadStrip(txMachine* the) { mxUnknownError(\"dead strip\"); return NULL; }\n");
682 if (!fxIsCodeUsed(XS_CODE_GENERATOR_FUNCTION))
683 fprintf(file, "static txSlot* fxNewGeneratorFunctionInstanceDeadStrip(txMachine* the, txID name) { mxUnknownError(\"dead strip\"); return NULL; }\n");
684 if (!fxIsCodeUsed(XS_CODE_START_ASYNC_GENERATOR))
685 fprintf(file, "static txSlot* fxNewAsyncGeneratorInstanceDeadStrip(txMachine* the) { mxUnknownError(\"dead strip\"); return NULL; }\n");
686 if (!fxIsCodeUsed(XS_CODE_ASYNC_GENERATOR_FUNCTION))
687 fprintf(file, "static txSlot* fxNewAsyncGeneratorFunctionInstanceDeadStrip(txMachine* the, txID name) { mxUnknownError(\"dead strip\"); return NULL; }\n");
688 if (!fxIsCodeUsed(XS_CODE_IMPORT) && fxIsCallbackStripped(linker, fx_Compartment_prototype_import))
689 fprintf(file, "static void fxRunImportDeadStrip(txMachine* the, txSlot* realm, txSlot* referrer) { mxUnknownError(\"dead strip\"); }\n");
690 if (!fxIsCodeUsed(XS_CODE_NEW_PRIVATE_1) && !fxIsCodeUsed(XS_CODE_NEW_PRIVATE_2))
691 fprintf(file, "static txBoolean fxDefinePrivatePropertyDeadStrip(txMachine* the, txSlot* instance, txSlot* check, txID id, txSlot* slot, txFlag mask) { mxUnknownError(\"dead strip\"); return 0; }\n");
692 if (!fxIsCodeUsed(XS_CODE_GET_PRIVATE_1) && !fxIsCodeUsed(XS_CODE_GET_PRIVATE_2))
693 fprintf(file, "static txSlot* fxGetPrivatePropertyDeadStrip(txMachine* the, txSlot* instance, txSlot* check, txID id) { mxUnknownError(\"dead strip\"); return NULL; }\n");
694 if (!fxIsCodeUsed(XS_CODE_SET_PRIVATE_1) && !fxIsCodeUsed(XS_CODE_SET_PRIVATE_2))
695 fprintf(file, "static txSlot* fxSetPrivatePropertyDeadStrip(txMachine* the, txSlot* instance, txSlot* check, txID id) { mxUnknownError(\"dead strip\"); return NULL; }\n");
696
697 if (fxIsCallbackStripped(linker, fx_BigInt)) {
698 fprintf(file, "static void fxBigIntDecodeDeadStrip(txMachine* the, txSize size) { mxUnknownError(\"dead strip\"); }\n");
699 fprintf(file, "static txS8 fxToBigInt64DeadStrip(txMachine* the, txSlot* slot) { mxUnknownError(\"dead strip\"); }\n");
700 fprintf(file, "static txU8 fxToBigUint64DeadStrip(txMachine* the, txSlot* slot) { mxUnknownError(\"dead strip\"); }\n");
701 }
702
703 fprintf(file, "\nconst txDefaults ICACHE_FLASH_ATTR gxDefaults = {\n");
704 if (fxIsCodeUsed(XS_CODE_START_ASYNC)) {
705 fprintf(file, "\tfxNewAsyncInstance,\n");
706 fprintf(file, "\tfxRunAsync,\n");
707 }
708 else {
709 fprintf(file, "\tfxNewAsyncInstanceDeadStrip,\n");
710 fprintf(file, "\tfxRunAsyncDeadStrip,\n");
711 }
712 if (fxIsCodeUsed(XS_CODE_START_GENERATOR))
713 fprintf(file, "\tfxNewGeneratorInstance,\n");
714 else
715 fprintf(file, "\tfxNewGeneratorInstanceDeadStrip,\n");
716 if (fxIsCodeUsed(XS_CODE_GENERATOR_FUNCTION))
717 fprintf(file, "\tfxNewGeneratorFunctionInstance,\n");
718 else
719 fprintf(file, "\tfxNewGeneratorFunctionInstanceDeadStrip,\n");
720 if (fxIsCodeUsed(XS_CODE_START_ASYNC_GENERATOR))
721 fprintf(file, "\tfxNewAsyncGeneratorInstance,\n");
722 else
723 fprintf(file, "\tfxNewAsyncGeneratorInstanceDeadStrip,\n");
724 if (fxIsCodeUsed(XS_CODE_ASYNC_GENERATOR_FUNCTION))
725 fprintf(file, "\tfxNewAsyncGeneratorFunctionInstance,\n");
726 else
727 fprintf(file, "\tfxNewAsyncGeneratorFunctionInstanceDeadStrip,\n");
728 if (fxIsCodeUsed(XS_CODE_FOR_AWAIT_OF))
729 fprintf(file, "\tfxRunForAwaitOf,\n");
730 else
731 fprintf(file, "\tfxDeadStrip,\n");

Callers 1

mainFunction · 0.85

Calls 3

fxIsCodeUsedFunction · 0.85
fxIsCallbackStrippedFunction · 0.85
fxIsLinkerSymbolUsedFunction · 0.85

Tested by

no test coverage detected