MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / forlist

Function forlist

Source/Misc/lua/src/lua.c:8665–8685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8663
8664
8665static void forlist (LexState *ls, TString *indexname) {
8666/* forlist -> NAME {,NAME} IN explist1 forbody */
8667FuncState *fs = ls->fs;
8668expdesc e;
8669int nvars = 0;
8670int line;
8671int base = fs->freereg;
8672/* create control variables */
8673new_localvarliteral(ls, "(for generator)", nvars++);
8674new_localvarliteral(ls, "(for state)", nvars++);
8675new_localvarliteral(ls, "(for control)", nvars++);
8676/* create declared variables */
8677new_localvar(ls, indexname, nvars++);
8678while (testnext(ls, ','))
8679new_localvar(ls, str_checkname(ls), nvars++);
8680checknext(ls, TK_IN);
8681line = ls->linenumber;
8682adjust_assign(ls, 3, explist1(ls, &e), &e);
8683luaK_checkstack(fs, 3); /* extra space to call generator */
8684forbody(ls, base, line, nvars - 3, 0);
8685}
8686
8687
8688static void forstat (LexState *ls, int line) {

Callers 1

lua.cFile · 0.85

Calls 8

new_localvarFunction · 0.85
testnextFunction · 0.85
str_checknameFunction · 0.85
checknextFunction · 0.85
adjust_assignFunction · 0.85
explist1Function · 0.85
luaK_checkstackFunction · 0.85
forbodyFunction · 0.85

Tested by

no test coverage detected