aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-02-09 15:03:18 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-02-09 15:03:18 -0200
commit3f5b56c48b51b0e4e2c439f1d0bf717b018c1aee (patch)
treeb78fe124c1f6bd92e1a1288e26bc0d82a587113b
parente7192dfdbbef6c5ffc8a72d844d7d772ded91c46 (diff)
downloadlua-3f5b56c48b51b0e4e2c439f1d0bf717b018c1aee.tar.gz
lua-3f5b56c48b51b0e4e2c439f1d0bf717b018c1aee.tar.bz2
lua-3f5b56c48b51b0e4e2c439f1d0bf717b018c1aee.zip
simpler code for repeat-until
-rw-r--r--lparser.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/lparser.c b/lparser.c
index 423e4e20..cf0882f8 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 2.101 2011/02/09 14:45:19 roberto Exp roberto $ 2** $Id: lparser.c,v 2.102 2011/02/09 16:51:28 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*/
@@ -1253,16 +1253,10 @@ static void repeatstat (LexState *ls, int line) {
1253 statlist(ls); 1253 statlist(ls);
1254 check_match(ls, TK_UNTIL, TK_REPEAT, line); 1254 check_match(ls, TK_UNTIL, TK_REPEAT, line);
1255 condexit = cond(ls); /* read condition (inside scope block) */ 1255 condexit = cond(ls); /* read condition (inside scope block) */
1256 if (!bl2.upval) { /* no upvalues? */ 1256 if (bl2.upval) /* upvalues? */
1257 leaveblock(fs); /* finish scope */ 1257 luaK_patchclose(fs, condexit, bl2.nactvar);
1258 luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ 1258 leaveblock(fs); /* finish scope */
1259 } 1259 luaK_patchlist(fs, condexit, repeat_init); /* close the loop */
1260 else { /* complete semantics when there are upvalues */
1261 breakstat(ls); /* if condition then break */
1262 luaK_patchtohere(ls->fs, condexit); /* else... */
1263 leaveblock(fs); /* finish scope... */
1264 luaK_jumpto(fs, repeat_init); /* and repeat */
1265 }
1266 leaveblock(fs); /* finish loop */ 1260 leaveblock(fs); /* finish loop */
1267} 1261}
1268 1262