MCPcopy Create free account
hub / github.com/F-Stack/f-stack / forbody

Function forbody

freebsd/contrib/openzfs/module/lua/lparser.c:1287–1310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1285
1286
1287static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
1288 /* forbody -> DO block */
1289 BlockCnt bl;
1290 FuncState *fs = ls->fs;
1291 int prep, endfor;
1292 adjustlocalvars(ls, 3); /* control variables */
1293 checknext(ls, TK_DO);
1294 prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
1295 enterblock(fs, &bl, 0); /* scope for declared variables */
1296 adjustlocalvars(ls, nvars);
1297 luaK_reserveregs(fs, nvars);
1298 block(ls);
1299 leaveblock(fs); /* end of scope for declared variables */
1300 luaK_patchtohere(fs, prep);
1301 if (isnum) /* numeric for? */
1302 endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
1303 else { /* generic for */
1304 luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars);
1305 luaK_fixline(fs, line);
1306 endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);
1307 }
1308 luaK_patchlist(fs, endfor, prep + 1);
1309 luaK_fixline(fs, line);
1310}
1311
1312
1313static void fornum (LexState *ls, TString *varname, int line) {

Callers 2

fornumFunction · 0.70
forlistFunction · 0.70

Calls 11

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

Tested by

no test coverage detected