MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / forlist

Function forlist

extlibs/lua/src/lparser.c:1573–1598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1571
1572
1573static void forlist (LexState *ls, TString *indexname) {
1574 /* forlist -> NAME {,NAME} IN explist forbody */
1575 FuncState *fs = ls->fs;
1576 expdesc e;
1577 int nvars = 5; /* gen, state, control, toclose, 'indexname' */
1578 int line;
1579 int base = fs->freereg;
1580 /* create control variables */
1581 new_localvarliteral(ls, "(for state)");
1582 new_localvarliteral(ls, "(for state)");
1583 new_localvarliteral(ls, "(for state)");
1584 new_localvarliteral(ls, "(for state)");
1585 /* create declared variables */
1586 new_localvar(ls, indexname);
1587 while (testnext(ls, ',')) {
1588 new_localvar(ls, str_checkname(ls));
1589 nvars++;
1590 }
1591 checknext(ls, TK_IN);
1592 line = ls->linenumber;
1593 adjust_assign(ls, 4, explist(ls, &e), &e);
1594 adjustlocalvars(ls, 4); /* control variables */
1595 markupval(fs, luaY_nvarstack(fs)); /* state may create an upvalue */
1596 luaK_checkstack(fs, 3); /* extra space to call generator */
1597 forbody(ls, base, line, nvars - 4, 1);
1598}
1599
1600
1601static void forstat (LexState *ls, int line) {

Callers 1

forstatFunction · 0.85

Calls 11

new_localvarFunction · 0.85
testnextFunction · 0.85
str_checknameFunction · 0.85
checknextFunction · 0.85
adjust_assignFunction · 0.85
explistFunction · 0.85
adjustlocalvarsFunction · 0.85
markupvalFunction · 0.85
luaY_nvarstackFunction · 0.85
luaK_checkstackFunction · 0.85
forbodyFunction · 0.85

Tested by

no test coverage detected