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

Function fxScopeCodeUsedReverse

xs/sources/xsCode.c:1871–1909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1869}
1870
1871void fxScopeCodeUsedReverse(txScope* self, txCoder* coder, txDeclareNode* node, txInteger exception, txInteger selector)
1872{
1873 if (node) {
1874 fxCheckParserStack(coder->parser, node->line);
1875 fxScopeCodeUsedReverse(self, coder, node->nextDeclareNode, exception, selector);
1876 if (node->description->token == XS_TOKEN_USING) {
1877 txTargetCode* catchTarget = fxCoderCreateTarget(coder);
1878 txTargetCode* chainTarget = fxCoderCreateTarget(coder);
1879 txTargetCode* normalTarget = fxCoderCreateTarget(coder);
1880
1881 fxCoderAddIndex(coder, 1, XS_CODE_GET_LOCAL_1, node->nextDeclareNode->index);
1882 fxCoderAddByte(coder, 1, XS_CODE_UNDEFINED);
1883 fxCoderAddByte(coder, -1, XS_CODE_STRICT_EQUAL);
1884 fxCoderAddBranch(coder, -1, XS_CODE_BRANCH_IF_1, normalTarget);
1885
1886 fxCoderAddBranch(coder, 0, XS_CODE_CATCH_1, catchTarget);
1887
1888 fxCoderAddIndex(coder, 1, (node->flags & mxDeclareNodeClosureFlag) ? XS_CODE_GET_CLOSURE_1: XS_CODE_GET_LOCAL_1, node->index);
1889 fxCoderAddBranch(coder, 0, XS_CODE_BRANCH_CHAIN_1, chainTarget);
1890 fxCoderAddIndex(coder, 1, XS_CODE_GET_LOCAL_1, node->nextDeclareNode->index);
1891 fxCoderAddByte(coder, 1, XS_CODE_CALL);
1892 fxCoderAddInteger(coder, -2, XS_CODE_RUN_1, 0);
1893
1894 fxCoderAdd(coder, 0, chainTarget);
1895 if (node->flags & mxAwaitingFlag) {
1896 fxCoderAddByte(coder, 0, XS_CODE_AWAIT);
1897 fxCoderAddByte(coder, 0, XS_CODE_THROW_STATUS);
1898 }
1899 fxCoderAddByte(coder, -1, XS_CODE_POP);
1900
1901 fxCoderAddByte(coder, 0, XS_CODE_UNCATCH);
1902 fxCoderAddBranch(coder, 0, XS_CODE_BRANCH_1, normalTarget);
1903 fxCoderAdd(coder, 0, catchTarget);
1904 fxCoderAddIndex(coder, 1, XS_CODE_USED_1, selector);
1905
1906 fxCoderAdd(coder, 0, normalTarget);
1907 }
1908 }
1909}
1910
1911void fxScopeCodeUsing(txScope* self, txCoder* coder, txUsingContext* context)
1912{

Callers 2

fxScopeCodeUsedFunction · 0.85
fxForInForOfNodeCodeFunction · 0.85

Calls 7

fxCheckParserStackFunction · 0.85
fxCoderCreateTargetFunction · 0.85
fxCoderAddIndexFunction · 0.85
fxCoderAddByteFunction · 0.85
fxCoderAddBranchFunction · 0.85
fxCoderAddIntegerFunction · 0.85
fxCoderAddFunction · 0.85

Tested by

no test coverage detected