MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / forlist

Function forlist

src/Chain/libraries/glua/lparser.cpp:1396–1418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1394
1395
1396static void forlist(LexState *ls, TString *indexname) {
1397 /* forlist -> NAME {,NAME} IN explist forbody */
1398 FuncState *fs = ls->fs;
1399 expdesc e;
1400 int nvars = 4; /* gen, state, control, plus at least one declared var */
1401 int line;
1402 int base = fs->freereg;
1403 /* create control variables */
1404 new_localvarliteral(ls, "(for generator)");
1405 new_localvarliteral(ls, "(for state)");
1406 new_localvarliteral(ls, "(for control)");
1407 /* create declared variables */
1408 new_localvar(ls, indexname);
1409 while (testnext(ls, ',')) {
1410 new_localvar(ls, str_checkname(ls));
1411 nvars++;
1412 }
1413 checknext(ls, TK_IN);
1414 line = ls->linenumber;
1415 adjust_assign(ls, 3, explist(ls, &e), &e);
1416 luaK_checkstack(fs, 3); /* extra space to call generator */
1417 forbody(ls, base, line, nvars - 3, 0);
1418}
1419
1420
1421static 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