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

Function forlist

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

Source from the content-addressed store, hash-verified

1333
1334
1335static void forlist (LexState *ls, TString *indexname) {
1336 /* forlist -> NAME {,NAME} IN explist forbody */
1337 FuncState *fs = ls->fs;
1338 expdesc e;
1339 int nvars = 4; /* gen, state, control, plus at least one declared var */
1340 int line;
1341 int base = fs->freereg;
1342 /* create control variables */
1343 new_localvarliteral(ls, "(for generator)");
1344 new_localvarliteral(ls, "(for state)");
1345 new_localvarliteral(ls, "(for control)");
1346 /* create declared variables */
1347 new_localvar(ls, indexname);
1348 while (testnext(ls, ',')) {
1349 new_localvar(ls, str_checkname(ls));
1350 nvars++;
1351 }
1352 checknext(ls, TK_IN);
1353 line = ls->linenumber;
1354 adjust_assign(ls, 3, explist(ls, &e), &e);
1355 luaK_checkstack(fs, 3); /* extra space to call generator */
1356 forbody(ls, base, line, nvars - 3, 0);
1357}
1358
1359
1360static void forstat (LexState *ls, int line) {

Callers 1

forstatFunction · 0.70

Calls 8

explistFunction · 0.85
new_localvarFunction · 0.70
testnextFunction · 0.70
str_checknameFunction · 0.70
checknextFunction · 0.70
adjust_assignFunction · 0.70
luaK_checkstackFunction · 0.70
forbodyFunction · 0.70

Tested by

no test coverage detected