MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / forlist

Function forlist

ThirdParty/lua/lua/lparser.c:1336–1358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

forstatFunction · 0.85

Calls 8

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

Tested by

no test coverage detected