diff options
author | Lua Team <team@lua.org> | 2006-06-05 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2006-06-05 12:00:00 +0000 |
commit | fc48fbdd7b265a381002c76dcf79584b919104a0 (patch) | |
tree | 0fa484162d99677514d6cf8d80f8f32d9bd23770 /src | |
parent | 2ccf5a6aa54605d1b4f6a4a6e3b83625780e2cb3 (diff) | |
download | lua-github-5.1.1-rc3.tar.gz |
Lua 5.1.1-rc35.1.1-rc3
Diffstat (limited to 'src')
-rw-r--r-- | src/ldo.c | 7 | ||||
-rw-r--r-- | src/lparser.c | 11 | ||||
-rw-r--r-- | src/lvm.c | 3 |
3 files changed, 12 insertions, 9 deletions
@@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 2.37 2005/12/22 16:19:56 roberto Exp $ +** $Id: ldo.c,v 2.38 2006/06/05 19:36:14 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -383,12 +383,14 @@ void luaD_call (lua_State *L, StkId func, int nResults) { static void resume (lua_State *L, void *ud) { StkId firstArg = cast(StkId, ud); CallInfo *ci = L->ci; - if (L->status != LUA_YIELD) { /* start coroutine */ + if (L->status == 0) { /* start coroutine? */ lua_assert(ci == L->base_ci && firstArg > L->base); if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) return; } else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; if (!f_isLua(ci)) { /* `common' yield? */ /* finish interrupted execution of `OP_CALL' */ lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || @@ -399,7 +401,6 @@ static void resume (lua_State *L, void *ud) { else /* yielded inside a hook: just continue its execution */ L->base = L->ci->base; } - L->status = 0; luaV_execute(L, cast_int(L->ci - L->base_ci)); } diff --git a/src/lparser.c b/src/lparser.c index 6d30ebad..a9be740e 100644 --- a/src/lparser.c +++ b/src/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.41 2006/03/09 18:15:48 roberto Exp $ +** $Id: lparser.c,v 2.42 2006/06/05 15:57:59 roberto Exp $ ** 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 */ } @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.62 2006/01/23 19:51:43 roberto Exp $ +** $Id: lvm.c,v 2.63 2006/06/05 15:58:59 roberto Exp $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -376,6 +376,7 @@ void luaV_execute (lua_State *L, int nexeccalls) { TValue *k; const Instruction *pc; reentry: /* entry point */ + lua_assert(isLua(L->ci)); pc = L->savedpc; cl = &clvalue(L->ci->func)->l; base = L->base; |