MCPcopy Create free account
hub / github.com/axmolengine/axmol / forlist

Function forlist

3rdparty/lua/plainlua/lparser.c:1591–1616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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