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-ed64346b9d5a3306ef649761de5ef7176275a618.tar.gz lua-ed64346b9d5a3306ef649761de5ef7176275a618.tar.bz2 lua-ed64346b9d5a3306ef649761de5ef7176275a618.zip | |
details
| -rw-r--r-- | lparser.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.40 2005/12/22 16:19:56 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.41 2006/03/09 18:15:48 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 | */ |
| @@ -299,7 +299,8 @@ static void leaveblock (FuncState *fs) { | |||
| 299 | removevars(fs->ls, bl->nactvar); | 299 | removevars(fs->ls, bl->nactvar); |
| 300 | if (bl->upval) | 300 | if (bl->upval) |
| 301 | luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); | 301 | 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); | ||
| 303 | lua_assert(bl->nactvar == fs->nactvar); | 304 | lua_assert(bl->nactvar == fs->nactvar); |
| 304 | fs->freereg = fs->nactvar; /* free registers */ | 305 | fs->freereg = fs->nactvar; /* free registers */ |
| 305 | luaK_patchtohere(fs, bl->breaklist); | 306 | luaK_patchtohere(fs, bl->breaklist); |
| @@ -444,6 +445,7 @@ static void recfield (LexState *ls, struct ConsControl *cc) { | |||
| 444 | FuncState *fs = ls->fs; | 445 | FuncState *fs = ls->fs; |
| 445 | int reg = ls->fs->freereg; | 446 | int reg = ls->fs->freereg; |
| 446 | expdesc key, val; | 447 | expdesc key, val; |
| 448 | int rkkey; | ||
| 447 | if (ls->t.token == TK_NAME) { | 449 | if (ls->t.token == TK_NAME) { |
| 448 | luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); | 450 | luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); |
| 449 | checkname(ls, &key); | 451 | checkname(ls, &key); |
| @@ -452,10 +454,9 @@ static void recfield (LexState *ls, struct ConsControl *cc) { | |||
| 452 | yindex(ls, &key); | 454 | yindex(ls, &key); |
| 453 | cc->nh++; | 455 | cc->nh++; |
| 454 | checknext(ls, '='); | 456 | checknext(ls, '='); |
| 455 | luaK_exp2RK(fs, &key); | 457 | rkkey = luaK_exp2RK(fs, &key); |
| 456 | expr(ls, &val); | 458 | expr(ls, &val); |
| 457 | luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, luaK_exp2RK(fs, &key), | 459 | luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); |
| 458 | luaK_exp2RK(fs, &val)); | ||
| 459 | fs->freereg = reg; /* free registers */ | 460 | fs->freereg = reg; /* free registers */ |
| 460 | } | 461 | } |
| 461 | 462 | ||
