git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8211 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West
2008-04-28 17:33:58 +00:00
parent 53f2c134a3
commit a4f4228b2d
57 changed files with 5210 additions and 301 deletions
+10 -7
View File
@@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 2.40 2005/12/22 16:19:56 roberto Exp $
** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $
** Lua Parser
** See Copyright Notice in lua.h
*/
@@ -23,7 +23,7 @@
#include "lparser.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.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 */
}
@@ -488,7 +489,7 @@ static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
static void listfield (LexState *ls, struct ConsControl *cc) {
expr(ls, &cc->v);
luaY_checklimit(ls->fs, cc->na, MAXARG_Bx, "items in a constructor");
luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor");
cc->na++;
cc->tostore++;
}
@@ -937,6 +938,8 @@ static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
primaryexp(ls, &nv.v);
if (nv.v.k == VLOCAL)
check_conflict(ls, lh, &nv.v);
luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls,
"variables in assignment");
assignment(ls, &nv, nvars+1);
}
else { /* assignment -> `=' explist1 */