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

Function fxDeclareNodeCodeAssign

xs/sources/xsCode.c:2845–2867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2843}
2844
2845void fxDeclareNodeCodeAssign(void* it, void* param, txFlag flag)
2846{
2847 txDeclareNode* self = it;
2848 txDeclareNode* declaration = self->declaration;
2849 if (!declaration)
2850 fxCoderAddSymbol(param, -1, XS_CODE_SET_VARIABLE, self->symbol);
2851 else {
2852 if (self->description->token == XS_TOKEN_CONST)
2853 fxCoderAddIndex(param, 0, (declaration->flags & mxDeclareNodeClosureFlag) ? XS_CODE_CONST_CLOSURE_1: XS_CODE_CONST_LOCAL_1, declaration->index);
2854 else if (self->description->token == XS_TOKEN_LET)
2855 fxCoderAddIndex(param, 0, (declaration->flags & mxDeclareNodeClosureFlag) ? XS_CODE_LET_CLOSURE_1: XS_CODE_LET_LOCAL_1, declaration->index);
2856 else if (self->description->token == XS_TOKEN_USING) {
2857 fxCoderAddIndex(param, 0, (declaration->flags & mxDeclareNodeClosureFlag) ? XS_CODE_CONST_CLOSURE_1: XS_CODE_CONST_LOCAL_1, declaration->index);
2858 if (self->flags & mxAwaitingFlag)
2859 fxCoderAddByte(param, 0, XS_CODE_USING_ASYNC);
2860 else
2861 fxCoderAddByte(param, 0, XS_CODE_USING);
2862 fxCoderAddIndex(param, 0, XS_CODE_SET_LOCAL_1, declaration->nextDeclareNode->index);
2863 }
2864 else
2865 fxCoderAddIndex(param, 0, (declaration->flags & mxDeclareNodeClosureFlag) ? XS_CODE_VAR_CLOSURE_1 : XS_CODE_VAR_LOCAL_1, declaration->index);
2866 }
2867}
2868
2869void fxDeclareNodeCodeReference(void* it, void* param, txFlag flag)
2870{

Callers 1

fxDefineNodeCodeFunction · 0.85

Calls 3

fxCoderAddSymbolFunction · 0.85
fxCoderAddIndexFunction · 0.85
fxCoderAddByteFunction · 0.85

Tested by

no test coverage detected