History

Lua 5.1.1-rc3

Lua Team committed 20 years ago

Commit 90120a81 parent c9e49984 files · +18 −14Browse files

Showing the changes to src/lparser.c (1 of 4 files). Show all

Unified · Split

src/lparser.c+6−5
@@ -1,5 +1,5 @@
11 /*
2−** $Id: lparser.c,v 2.41 2006/03/09 18:15:48 roberto Exp $
2+** $Id: lparser.c,v 2.42 2006/06/05 15:57:59 roberto Exp $
33 ** Lua Parser
44 ** See Copyright Notice in lua.h
55 */
@@ -299,7 +299,8 @@ static void leaveblock (FuncState *fs) { · 293 unmodified lines
299299 removevars(fs->ls, bl->nactvar);
300300 if (bl->upval)
301301 luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
302− lua_assert(!bl->isbreakable || !bl->upval); /* loops have no body */
302+ /* a block either controls scope or breaks (never both) */
303+ lua_assert(!bl->isbreakable || !bl->upval);
303304 lua_assert(bl->nactvar == fs->nactvar);
304305 fs->freereg = fs->nactvar; /* free registers */
305306 luaK_patchtohere(fs, bl->breaklist);
@@ -444,6 +445,7 @@ static void recfield (LexState *ls, struct ConsControl *cc) { · 138 unmodified lines
444445 FuncState *fs = ls->fs;
445446 int reg = ls->fs->freereg;
446447 expdesc key, val;
448+ int rkkey;
447449 if (ls->t.token == TK_NAME) {
448450 luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
449451 checkname(ls, &key);
@@ -452,10 +454,9 @@ static void recfield (LexState *ls, struct ConsControl *cc) { · 2 unmodified lines
452454 yindex(ls, &key);
453455 cc->nh++;
454456 checknext(ls, '=');
455− luaK_exp2RK(fs, &key);
457+ rkkey = luaK_exp2RK(fs, &key);
456458 expr(ls, &val);
457− luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, luaK_exp2RK(fs, &key),
458− luaK_exp2RK(fs, &val));
459+ luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val));
459460 fs->freereg = reg; /* free registers */
460461 }
461462