mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
update lua 5.5.1
This commit is contained in:
@@ -821,8 +821,7 @@ static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {
|
||||
luaC_objbarrier(L, f, f->source);
|
||||
f->maxstacksize = 2; /* registers 0/1 are always valid */
|
||||
fs->kcache = luaH_new(L); /* create table for function */
|
||||
sethvalue2s(L, L->top.p, fs->kcache); /* anchor it */
|
||||
luaD_inctop(L);
|
||||
luaD_anchorobj(L, ls->h, obj2gco(fs->kcache)); /* anchor it */
|
||||
enterblock(fs, bl, 0);
|
||||
}
|
||||
|
||||
@@ -831,6 +830,7 @@ static void close_func (LexState *ls) {
|
||||
lua_State *L = ls->L;
|
||||
FuncState *fs = ls->fs;
|
||||
Proto *f = fs->f;
|
||||
TValue temp;
|
||||
luaK_ret(fs, luaY_nvarstack(fs), 0); /* final return */
|
||||
leaveblock(fs);
|
||||
lua_assert(fs->bl == NULL);
|
||||
@@ -843,8 +843,10 @@ static void close_func (LexState *ls) {
|
||||
luaM_shrinkvector(L, f->p, f->sizep, fs->np, Proto *);
|
||||
luaM_shrinkvector(L, f->locvars, f->sizelocvars, fs->ndebugvars, LocVar);
|
||||
luaM_shrinkvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc);
|
||||
/* remove kcache table from scanner table ("weigh" its anchor) */
|
||||
sethvalue(L, &temp, fs->kcache); /* key to be set to nil */
|
||||
luaH_set(L, ls->h, &temp, &G(L)->nilvalue);
|
||||
ls->fs = fs->prev;
|
||||
L->top.p--; /* pop kcache table */
|
||||
luaC_checkGC(L);
|
||||
}
|
||||
|
||||
@@ -1164,6 +1166,7 @@ static void funcargs (LexState *ls, expdesc *f) {
|
||||
}
|
||||
default: {
|
||||
luaX_syntaxerror(ls, "function arguments expected");
|
||||
return; /* to avoid warnings */
|
||||
}
|
||||
}
|
||||
lua_assert(f->k == VNONRELOC);
|
||||
@@ -2111,7 +2114,7 @@ static void statement (LexState *ls) {
|
||||
gotostat(ls, line);
|
||||
break;
|
||||
}
|
||||
#if defined(LUA_COMPAT_GLOBAL)
|
||||
#if LUA_COMPAT_GLOBAL
|
||||
case TK_NAME: {
|
||||
/* compatibility code to parse global keyword when "global"
|
||||
is not reserved */
|
||||
@@ -2165,16 +2168,14 @@ static void mainfunc (LexState *ls, FuncState *fs) {
|
||||
}
|
||||
|
||||
|
||||
LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
|
||||
LClosure *luaY_parser (lua_State *L, ZIO *z, Table *anchor, Mbuffer *buff,
|
||||
Dyndata *dyd, const char *name, int firstchar) {
|
||||
LexState lexstate;
|
||||
FuncState funcstate;
|
||||
LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */
|
||||
setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */
|
||||
luaD_inctop(L);
|
||||
lexstate.h = luaH_new(L); /* create table for scanner */
|
||||
sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */
|
||||
luaD_inctop(L);
|
||||
LClosure *cl;
|
||||
lexstate.h = anchor; /* table for scanner */
|
||||
cl = luaF_newLclosure(L, 1); /* create main closure */
|
||||
luaD_anchorobj(L, anchor, obj2gco(cl)); /* anchor it in scanner table */
|
||||
funcstate.f = cl->p = luaF_newproto(L);
|
||||
luaC_objbarrier(L, cl, cl->p);
|
||||
funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
|
||||
@@ -2187,7 +2188,6 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
|
||||
lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
|
||||
/* all scopes should be correctly finished */
|
||||
lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
|
||||
L->top.p--; /* remove scanner's table */
|
||||
return cl; /* closure is on the stack, too */
|
||||
return cl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user