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

Function fxArrayBindingNodeCodeAssign

xs/sources/xsCode.c:2256–2444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2254}
2255
2256void fxArrayBindingNodeCodeAssign(void* it, void* param, txFlag flag)
2257{
2258 txArrayBindingNode* self = it;
2259 txCoder* coder = param;
2260 txNode* item = self->items->first;
2261 txInteger iterator;
2262 txInteger next;
2263 txInteger done;
2264 txInteger rest;
2265 txInteger result;
2266 txInteger selector;
2267 txInteger selection;
2268 txTargetCode* catchTarget;
2269 txTargetCode* normalTarget;
2270 txTargetCode* finallyTarget;
2271
2272 txTargetCode* returnTarget;
2273 txTargetCode* stepTarget;
2274 txTargetCode* doneTarget;
2275 txTargetCode* nextTarget;
2276
2277 iterator = fxCoderUseTemporaryVariable(param);
2278 next = fxCoderUseTemporaryVariable(param);
2279 done = fxCoderUseTemporaryVariable(param);
2280 selector = fxCoderUseTemporaryVariable(param);
2281 rest = fxCoderUseTemporaryVariable(param);
2282 result = fxCoderUseTemporaryVariable(param);
2283
2284 coder->returnTarget = fxCoderAliasTargets(param, coder->returnTarget);
2285 catchTarget = fxCoderCreateTarget(param);
2286 normalTarget = fxCoderCreateTarget(param);
2287 finallyTarget = fxCoderCreateTarget(param);
2288
2289 fxCoderAddByte(param, 1, XS_CODE_DUB);
2290 fxCoderAddByte(param, 0, XS_CODE_FOR_OF);
2291 fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, iterator);
2292 fxCoderAddByte(param, 1, XS_CODE_FALSE);
2293 fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, done);
2294 fxCoderAddInteger(param, 1, XS_CODE_INTEGER_1, 0);
2295 fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, selector);
2296 fxCoderAddBranch(param, 0, XS_CODE_CATCH_1, catchTarget);
2297
2298 if (item) {
2299 fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, iterator);
2300 fxCoderAddSymbol(param, 0, XS_CODE_GET_PROPERTY, coder->parser->nextSymbol);
2301 fxCoderAddIndex(param, 0, XS_CODE_PULL_LOCAL_1, next);
2302
2303 while (item && (item->description->token != XS_TOKEN_REST_BINDING)) {
2304 stepTarget = fxCoderCreateTarget(param);
2305
2306 if (item->description->token == XS_TOKEN_SKIP_BINDING) {
2307 fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, done);
2308 fxCoderAddBranch(param, -1, XS_CODE_BRANCH_IF_1, stepTarget);
2309 fxCoderAddByte(param, 1, XS_CODE_TRUE);
2310 fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, done);
2311 fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, iterator);
2312 fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, next);
2313 fxCoderAddByte(param, 1, XS_CODE_CALL);

Callers 1

fxArrayBindingNodeCodeFunction · 0.85

Calls 14

fxCoderAliasTargetsFunction · 0.85
fxCoderCreateTargetFunction · 0.85
fxCoderAddByteFunction · 0.85
fxCoderAddIndexFunction · 0.85
fxCoderAddIntegerFunction · 0.85
fxCoderAddBranchFunction · 0.85
fxCoderAddSymbolFunction · 0.85
fxCoderAddFunction · 0.85
fxNodeDispatchCodeAssignFunction · 0.85
fxCoderFinalizeTargetsFunction · 0.85

Tested by

no test coverage detected