MCPcopy Create free account
hub / github.com/F-Stack/f-stack / forlist

Function forlist

app/redis-6.2.6/deps/lua/src/lparser.c:1093–1113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1091
1092
1093static void forlist (LexState *ls, TString *indexname) {
1094 /* forlist -> NAME {,NAME} IN explist1 forbody */
1095 FuncState *fs = ls->fs;
1096 expdesc e;
1097 int nvars = 0;
1098 int line;
1099 int base = fs->freereg;
1100 /* create control variables */
1101 new_localvarliteral(ls, "(for generator)", nvars++);
1102 new_localvarliteral(ls, "(for state)", nvars++);
1103 new_localvarliteral(ls, "(for control)", nvars++);
1104 /* create declared variables */
1105 new_localvar(ls, indexname, nvars++);
1106 while (testnext(ls, ','))
1107 new_localvar(ls, str_checkname(ls), nvars++);
1108 checknext(ls, TK_IN);
1109 line = ls->linenumber;
1110 adjust_assign(ls, 3, explist1(ls, &e), &e);
1111 luaK_checkstack(fs, 3); /* extra space to call generator */
1112 forbody(ls, base, line, nvars - 3, 0);
1113}
1114
1115
1116static void forstat (LexState *ls, int line) {

Callers 1

forstatFunction · 0.70

Calls 8

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

Tested by

no test coverage detected