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

Function forlist

third-party/lua-5.5.0/src/lparser.c:1707–1731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1705
1706
1707static void forlist (LexState *ls, TString *indexname) {
1708 /* forlist -> NAME {,NAME} IN explist forbody */
1709 FuncState *fs = ls->fs;
1710 expdesc e;
1711 int nvars = 4; /* function, state, closing, control */
1712 int line;
1713 int base = fs->freereg;
1714 /* create internal variables */
1715 new_localvarliteral(ls, "(for state)"); /* iterator function */
1716 new_localvarliteral(ls, "(for state)"); /* state */
1717 new_localvarliteral(ls, "(for state)"); /* closing var. (after swap) */
1718 new_varkind(ls, indexname, RDKCONST); /* control variable */
1719 /* other declared variables */
1720 while (testnext(ls, ',')) {
1721 new_localvar(ls, str_checkname(ls));
1722 nvars++;
1723 }
1724 checknext(ls, TK_IN);
1725 line = ls->linenumber;
1726 adjust_assign(ls, 4, explist(ls, &e), &e);
1727 adjustlocalvars(ls, 3); /* start scope for internal variables */
1728 marktobeclosed(fs); /* last internal var. must be closed */
1729 luaK_checkstack(fs, 2); /* extra space to call iterator */
1730 forbody(ls, base, line, nvars - 3, 1);
1731}
1732
1733
1734static void forstat (LexState *ls, int line) {

Callers 1

forstatFunction · 0.70

Calls 11

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

Tested by

no test coverage detected