MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / forlist

Function forlist

lua/lparser.c:1149–1169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1147
1148
1149static void forlist (LexState *ls, TString *indexname) {
1150 /* forlist -> NAME {,NAME} IN explist1 forbody */
1151 FuncState *fs = ls->fs;
1152 expdesc e;
1153 int nvars = 0;
1154 int line;
1155 int base = fs->freereg;
1156 /* create control variables */
1157 new_localvarliteral(ls, "(for generator)", nvars++);
1158 new_localvarliteral(ls, "(for state)", nvars++);
1159 new_localvarliteral(ls, "(for control)", nvars++);
1160 /* create declared variables */
1161 new_localvar(ls, indexname, nvars++);
1162 while (testnext(ls, ','))
1163 new_localvar(ls, str_checkname(ls), nvars++);
1164 checknext(ls, TK_IN);
1165 line = ls->linenumber;
1166 adjust_assign(ls, 3, explist1(ls, &e), &e);
1167 luaK_checkstack(fs, 3); /* extra space to call generator */
1168 forbody(ls, base, line, nvars - 3, 0);
1169}
1170
1171
1172static void forstat (LexState *ls, int line) {

Callers 1

forstatFunction · 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