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

Function fornum

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

Source from the content-addressed store, hash-verified

1311
1312
1313static void fornum (LexState *ls, TString *varname, int line) {
1314 /* fornum -> NAME = exp1,exp1[,exp1] forbody */
1315 FuncState *fs = ls->fs;
1316 int base = fs->freereg;
1317 new_localvarliteral(ls, "(for index)");
1318 new_localvarliteral(ls, "(for limit)");
1319 new_localvarliteral(ls, "(for step)");
1320 new_localvar(ls, varname);
1321 checknext(ls, '=');
1322 exp1(ls); /* initial value */
1323 checknext(ls, ',');
1324 exp1(ls); /* limit */
1325 if (testnext(ls, ','))
1326 exp1(ls); /* optional step */
1327 else { /* default step = 1 */
1328 luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1));
1329 luaK_reserveregs(fs, 1);
1330 }
1331 forbody(ls, base, line, 1, 1);
1332}
1333
1334
1335static void forlist (LexState *ls, TString *indexname) {

Callers 1

forstatFunction · 0.70

Calls 8

luaK_codekFunction · 0.85
new_localvarFunction · 0.70
checknextFunction · 0.70
exp1Function · 0.70
testnextFunction · 0.70
luaK_numberKFunction · 0.70
luaK_reserveregsFunction · 0.70
forbodyFunction · 0.70

Tested by

no test coverage detected