|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
** $Id: lparser.c,v 2.148 2015/10/28 17:28:40 roberto Exp roberto $ |
|
|
|
** $Id: lparser.c,v 2.149 2015/11/02 16:09:30 roberto Exp roberto $ |
|
|
|
** Lua Parser |
|
|
|
** See Copyright Notice in lua.h |
|
|
|
*/ |
|
|
@ -164,7 +164,8 @@ static int registerlocalvar (LexState *ls, TString *varname) { |
|
|
|
int oldsize = f->sizelocvars; |
|
|
|
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, |
|
|
|
LocVar, SHRT_MAX, "local variables"); |
|
|
|
while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; |
|
|
|
while (oldsize < f->sizelocvars) |
|
|
|
f->locvars[oldsize++].varname = NULL; |
|
|
|
f->locvars[fs->nlocvars].varname = varname; |
|
|
|
luaC_objbarrier(ls->L, f, varname); |
|
|
|
return fs->nlocvars++; |
|
|
@ -230,7 +231,8 @@ static int newupvalue (FuncState *fs, TString *name, expdesc *v) { |
|
|
|
checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); |
|
|
|
luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, |
|
|
|
Upvaldesc, MAXUPVAL, "upvalues"); |
|
|
|
while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL; |
|
|
|
while (oldsize < f->sizeupvalues) |
|
|
|
f->upvalues[oldsize++].name = NULL; |
|
|
|
f->upvalues[fs->nups].instack = (v->k == VLOCAL); |
|
|
|
f->upvalues[fs->nups].idx = cast_byte(v->u.info); |
|
|
|
f->upvalues[fs->nups].name = name; |
|
|
@ -255,7 +257,8 @@ static int searchvar (FuncState *fs, TString *n) { |
|
|
|
*/ |
|
|
|
static void markupval (FuncState *fs, int level) { |
|
|
|
BlockCnt *bl = fs->bl; |
|
|
|
while (bl->nactvar > level) bl = bl->previous; |
|
|
|
while (bl->nactvar > level) |
|
|
|
bl = bl->previous; |
|
|
|
bl->upval = 1; |
|
|
|
} |
|
|
|
|
|
|
@ -499,7 +502,8 @@ static Proto *addprototype (LexState *ls) { |
|
|
|
if (fs->np >= f->sizep) { |
|
|
|
int oldsize = f->sizep; |
|
|
|
luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); |
|
|
|
while (oldsize < f->sizep) f->p[oldsize++] = NULL; |
|
|
|
while (oldsize < f->sizep) |
|
|
|
f->p[oldsize++] = NULL; |
|
|
|
} |
|
|
|
f->p[fs->np++] = clp = luaF_newproto(L); |
|
|
|
luaC_objbarrier(L, f, clp); |
|
|
|