MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / forlist

Function forlist

third-party/lua-5.2.4/src/lparser.c:1331–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

forstatFunction · 0.70

Calls 8

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

Tested by

no test coverage detected