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

Function forlist

third-party/lua-5.3.5/src/lparser.c:1339–1361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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