summaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lparser.c b/lparser.c
index e5dc330d..562e2f96 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 2.58 2008/05/08 15:44:51 roberto Exp roberto $ 2** $Id: lparser.c,v 2.59 2008/10/28 12:55:00 roberto Exp roberto $
3** Lua Parser 3** Lua Parser
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1055,7 +1055,7 @@ static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
1055 /* forbody -> DO block */ 1055 /* forbody -> DO block */
1056 BlockCnt bl; 1056 BlockCnt bl;
1057 FuncState *fs = ls->fs; 1057 FuncState *fs = ls->fs;
1058 int prep; 1058 int prep, endfor;
1059 adjustlocalvars(ls, 3); /* control variables */ 1059 adjustlocalvars(ls, 3); /* control variables */
1060 checknext(ls, TK_DO); 1060 checknext(ls, TK_DO);
1061 prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); 1061 prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
@@ -1065,15 +1065,14 @@ static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
1065 block(ls); 1065 block(ls);
1066 leaveblock(fs); /* end of scope for declared variables */ 1066 leaveblock(fs); /* end of scope for declared variables */
1067 luaK_patchtohere(fs, prep); 1067 luaK_patchtohere(fs, prep);
1068 if (isnum) { /* numeric for? */ 1068 if (isnum) /* numeric for? */
1069 int endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); 1069 endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
1070 luaK_patchlist(fs, endfor, prep + 1);
1071 }
1072 else { /* generic for */ 1070 else { /* generic for */
1073 luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); 1071 luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars);
1074 luaK_fixline(fs, line); 1072 luaK_fixline(fs, line);
1075 luaK_jumpto(fs, prep + 1); 1073 endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);
1076 } 1074 }
1075 luaK_patchlist(fs, endfor, prep + 1);
1077 luaK_fixline(fs, line); 1076 luaK_fixline(fs, line);
1078} 1077}
1079 1078