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

Function fxForNodeCode

xs/sources/xsCode.c:3141–3197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3139}
3140
3141void fxForNodeCode(void* it, void* param)
3142{
3143 txForNode* self = it;
3144 txCoder* coder = param;
3145 txTargetCode* continueTarget;
3146 txTargetCode* nextTarget;
3147 txTargetCode* doneTarget;
3148 txUsingContext context;
3149
3150 continueTarget = coder->firstContinueTarget;
3151 coder->firstContinueTarget = continueTarget->nextTarget;
3152 continueTarget->nextTarget = C_NULL;
3153
3154 fxScopeCodingBlock(self->scope, param);
3155 fxScopeCodeDefineNodes(self->scope, param);
3156 if (self->scope->disposableNodeCount)
3157 fxScopeCodeUsing(self->scope, coder, &context);
3158 nextTarget = fxCoderCreateTarget(param);
3159 doneTarget = fxCoderCreateTarget(param);
3160 if (self->initialization)
3161 fxNodeDispatchCode(self->initialization, param);
3162 if (coder->programFlag) {
3163 fxCoderAddByte(param, 1, XS_CODE_UNDEFINED);
3164 fxCoderAddByte(param, -1, XS_CODE_SET_RESULT);
3165 }
3166 fxScopeCodeRefresh(self->scope, param);
3167 fxCoderAdd(param, 0, nextTarget);
3168 if (self->expression) {
3169 fxNodeDispatchCode(self->expression, param);
3170 fxCoderAddBranch(param, -1, XS_CODE_BRANCH_ELSE_1, doneTarget);
3171 }
3172
3173 continueTarget->environmentLevel = coder->environmentLevel;
3174 continueTarget->scopeLevel = coder->scopeLevel;
3175 continueTarget->stackLevel = coder->stackLevel;
3176 continueTarget->nextTarget = coder->firstContinueTarget;
3177 coder->firstContinueTarget = continueTarget;
3178 fxNodeDispatchCode(self->statement, param);
3179 fxCoderAdd(param, 0, continueTarget);
3180 coder->firstContinueTarget = continueTarget->nextTarget;
3181 continueTarget->nextTarget = C_NULL;
3182
3183 if (self->iteration) {
3184 fxScopeCodeRefresh(self->scope, param);
3185 self->iteration->flags |= mxExpressionNoValue;
3186 fxNodeDispatchCode(self->iteration, param);
3187 fxCoderAddByte(param, -1, XS_CODE_POP);
3188 }
3189 fxCoderAddBranch(param, 0, XS_CODE_BRANCH_1, nextTarget);
3190 fxCoderAdd(param, 0, doneTarget);
3191 if (self->scope->disposableNodeCount)
3192 fxScopeCodeUsed(self->scope, coder, &context);
3193 fxScopeCoded(self->scope, param);
3194
3195 continueTarget->nextTarget = coder->firstContinueTarget;
3196 coder->firstContinueTarget = continueTarget;
3197}
3198

Callers

nothing calls this directly

Calls 11

fxScopeCodingBlockFunction · 0.85
fxScopeCodeDefineNodesFunction · 0.85
fxScopeCodeUsingFunction · 0.85
fxCoderCreateTargetFunction · 0.85
fxNodeDispatchCodeFunction · 0.85
fxCoderAddByteFunction · 0.85
fxScopeCodeRefreshFunction · 0.85
fxCoderAddFunction · 0.85
fxCoderAddBranchFunction · 0.85
fxScopeCodeUsedFunction · 0.85
fxScopeCodedFunction · 0.85

Tested by

no test coverage detected