MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / forbody

Function forbody

src/Chain/libraries/glua/lparser.cpp:1348–1371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1346
1347
1348static void forbody(LexState *ls, int base, int line, int nvars, int isnum) {
1349 /* forbody -> DO block */
1350 BlockCnt bl;
1351 FuncState *fs = ls->fs;
1352 int prep, endfor;
1353 adjustlocalvars(ls, 3); /* control variables */
1354 checknext(ls, TK_DO);
1355 prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
1356 enterblock(fs, &bl, 0); /* scope for declared variables */
1357 adjustlocalvars(ls, nvars);
1358 luaK_reserveregs(fs, nvars);
1359 block(ls);
1360 leaveblock(fs); /* end of scope for declared variables */
1361 luaK_patchtohere(fs, prep);
1362 if (isnum) /* numeric for? */
1363 endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
1364 else { /* generic for */
1365 luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars);
1366 luaK_fixline(fs, line);
1367 endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);
1368 }
1369 luaK_patchlist(fs, endfor, prep + 1);
1370 luaK_fixline(fs, line);
1371}
1372
1373
1374static void fornum(LexState *ls, TString *varname, int line) {

Callers 2

fornumFunction · 0.85
forlistFunction · 0.85

Calls 11

adjustlocalvarsFunction · 0.85
checknextFunction · 0.85
luaK_jumpFunction · 0.85
enterblockFunction · 0.85
luaK_reserveregsFunction · 0.85
leaveblockFunction · 0.85
luaK_patchtohereFunction · 0.85
luaK_codeABCFunction · 0.85
luaK_fixlineFunction · 0.85
luaK_patchlistFunction · 0.85
blockFunction · 0.70

Tested by

no test coverage detected