diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-06-05 12:57:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-06-05 12:57:59 -0300 |
commit | ed64346b9d5a3306ef649761de5ef7176275a618 (patch) | |
tree | 6878b146f36643678b4437b642b025f52d649554 | |
parent | 475b0ecbf18be08ee824c4958ac33b7682891bbf (diff) | |
download | lua-github-ed64346b9d5a3306ef649761de5ef7176275a618.tar.gz |
details
-rw-r--r-- | lparser.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.40 2005/12/22 16:19:56 roberto Exp roberto $ +** $Id: lparser.c,v 2.41 2006/03/09 18:15:48 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -299,7 +299,8 @@ static void leaveblock (FuncState *fs) { removevars(fs->ls, bl->nactvar); if (bl->upval) luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); - lua_assert(!bl->isbreakable || !bl->upval); /* loops have no body */ + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); lua_assert(bl->nactvar == fs->nactvar); fs->freereg = fs->nactvar; /* free registers */ luaK_patchtohere(fs, bl->breaklist); @@ -444,6 +445,7 @@ static void recfield (LexState *ls, struct ConsControl *cc) { FuncState *fs = ls->fs; int reg = ls->fs->freereg; expdesc key, val; + int rkkey; if (ls->t.token == TK_NAME) { luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); checkname(ls, &key); @@ -452,10 +454,9 @@ static void recfield (LexState *ls, struct ConsControl *cc) { yindex(ls, &key); cc->nh++; checknext(ls, '='); - luaK_exp2RK(fs, &key); + rkkey = luaK_exp2RK(fs, &key); expr(ls, &val); - luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, luaK_exp2RK(fs, &key), - luaK_exp2RK(fs, &val)); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); fs->freereg = reg; /* free registers */ } |