MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / forlist

Function forlist

lib/lua/src/lparser.c:1592–1617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1590
1591
1592static void forlist (LexState *ls, TString *indexname) {
1593 /* forlist -> NAME {,NAME} IN explist forbody */
1594 FuncState *fs = ls->fs;
1595 expdesc e;
1596 int nvars = 5; /* gen, state, control, toclose, 'indexname' */
1597 int line;
1598 int base = fs->freereg;
1599 /* create control variables */
1600 new_localvarliteral(ls, "(for state)");
1601 new_localvarliteral(ls, "(for state)");
1602 new_localvarliteral(ls, "(for state)");
1603 new_localvarliteral(ls, "(for state)");
1604 /* create declared variables */
1605 new_localvar(ls, indexname);
1606 while (testnext(ls, ',')) {
1607 new_localvar(ls, str_checkname(ls));
1608 nvars++;
1609 }
1610 checknext(ls, TK_IN);
1611 line = ls->linenumber;
1612 adjust_assign(ls, 4, explist(ls, &e), &e);
1613 adjustlocalvars(ls, 4); /* control variables */
1614 marktobeclosed(fs); /* last control var. must be closed */
1615 luaK_checkstack(fs, 3); /* extra space to call generator */
1616 forbody(ls, base, line, nvars - 4, 1);
1617}
1618
1619
1620static void forstat (LexState *ls, int line) {

Callers 1

forstatFunction · 0.85

Calls 10

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

Tested by

no test coverage detected