| 1048 | |
| 1049 | |
| 1050 | static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { |
| 1051 | /* forbody -> DO block */ |
| 1052 | BlockCnt bl; |
| 1053 | FuncState *fs = ls->fs; |
| 1054 | int prep, endfor; |
| 1055 | adjustlocalvars(ls, 3); /* control variables */ |
| 1056 | checknext(ls, TK_DO); |
| 1057 | prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); |
| 1058 | enterblock(fs, &bl, 0); /* scope for declared variables */ |
| 1059 | adjustlocalvars(ls, nvars); |
| 1060 | luaK_reserveregs(fs, nvars); |
| 1061 | block(ls); |
| 1062 | leaveblock(fs); /* end of scope for declared variables */ |
| 1063 | luaK_patchtohere(fs, prep); |
| 1064 | endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : |
| 1065 | luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); |
| 1066 | luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ |
| 1067 | luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); |
| 1068 | } |
| 1069 | |
| 1070 | |
| 1071 | static void fornum (LexState *ls, TString *varname, int line) { |
no test coverage detected