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

Function fxScopeCodeSpecifierNodes

xs/sources/xsCode.c:1686–1741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1684}
1685
1686txInteger fxScopeCodeSpecifierNodes(txScope* self, txCoder* coder)
1687{
1688 txDeclareNode* node = self->firstDeclareNode;
1689 txInteger count = 0;
1690 while (node) {
1691 if (node->flags & mxDeclareNodeUseClosureFlag) {
1692 txSpecifierNode* specifier = node->importSpecifier;
1693 txInteger index = 3;
1694 txBoolean flag = 0;
1695 if (node->symbol)
1696 fxCoderAddSymbol(coder, 1, XS_CODE_SYMBOL, node->symbol);
1697 else
1698 fxCoderAddByte(coder, 1, XS_CODE_NULL);
1699 if (specifier) {
1700 if (coder->parser->flags & mxDebugFlag) {
1701 fxCoderAddLine(coder, 0, XS_CODE_LINE, (txNode*)specifier);
1702 }
1703 fxStringNodeCode(specifier->from, coder);
1704 if (specifier->with)
1705 flag = 1;
1706 if (specifier->symbol)
1707 fxCoderAddSymbol(coder, 1, XS_CODE_SYMBOL, specifier->symbol);
1708 else
1709 fxCoderAddByte(coder, 1, XS_CODE_NULL);
1710 }
1711 else {
1712 fxCoderAddByte(coder, 1, XS_CODE_NULL);
1713 fxCoderAddByte(coder, 1, XS_CODE_NULL);
1714 }
1715 specifier = node->firstExportSpecifier;
1716 while (specifier) {
1717 if (specifier->asSymbol) {
1718 fxCoderAddSymbol(coder, 1, XS_CODE_SYMBOL, specifier->asSymbol);
1719 index++;
1720 }
1721 else if (specifier->symbol) {
1722 fxCoderAddSymbol(coder, 1, XS_CODE_SYMBOL, specifier->symbol);
1723 index++;
1724 }
1725 else {
1726 fxCoderAddByte(coder, 1, XS_CODE_NULL);
1727 index++;
1728 }
1729 specifier = specifier->nextSpecifier;
1730 }
1731 fxCoderAddInteger(coder, 1, XS_CODE_INTEGER_1, index);
1732 if (flag)
1733 fxCoderAddByte(coder, 0 - index, XS_CODE_TRANSFER_JSON);
1734 else
1735 fxCoderAddByte(coder, 0 - index, XS_CODE_TRANSFER);
1736 count++;
1737 }
1738 node = node->nextDeclareNode;
1739 }
1740 return count;
1741}
1742
1743void fxScopeCodeRefresh(txScope* self, txCoder* coder)

Callers 1

fxModuleNodeCodeFunction · 0.85

Calls 5

fxCoderAddSymbolFunction · 0.85
fxCoderAddByteFunction · 0.85
fxCoderAddLineFunction · 0.85
fxStringNodeCodeFunction · 0.85
fxCoderAddIntegerFunction · 0.85

Tested by

no test coverage detected