mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
update to lua 5.3.3 rc2
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lcode.c,v 2.108 2016/01/05 16:22:37 roberto Exp $
|
** $Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp $
|
||||||
** Code generator for Lua
|
** Code generator for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -1066,7 +1066,7 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
|
|||||||
case OPR_MINUS: case OPR_BNOT:
|
case OPR_MINUS: case OPR_BNOT:
|
||||||
if (constfolding(fs, op + LUA_OPUNM, e, &ef))
|
if (constfolding(fs, op + LUA_OPUNM, e, &ef))
|
||||||
break;
|
break;
|
||||||
/* else go through */
|
/* FALLTHROUGH */
|
||||||
case OPR_LEN:
|
case OPR_LEN:
|
||||||
codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line);
|
codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lparser.c,v 2.152 2016/03/07 19:25:39 roberto Exp $
|
** $Id: lparser.c,v 2.153 2016/05/13 19:10:16 roberto Exp $
|
||||||
** Lua Parser
|
** Lua Parser
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -269,27 +269,26 @@ static void markupval (FuncState *fs, int level) {
|
|||||||
Find variable with given name 'n'. If it is an upvalue, add this
|
Find variable with given name 'n'. If it is an upvalue, add this
|
||||||
upvalue into all intermediate functions.
|
upvalue into all intermediate functions.
|
||||||
*/
|
*/
|
||||||
static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
|
static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
|
||||||
if (fs == NULL) /* no more levels? */
|
if (fs == NULL) /* no more levels? */
|
||||||
return VVOID; /* default is global */
|
init_exp(var, VVOID, 0); /* default is global */
|
||||||
else {
|
else {
|
||||||
int v = searchvar(fs, n); /* look up locals at current level */
|
int v = searchvar(fs, n); /* look up locals at current level */
|
||||||
if (v >= 0) { /* found? */
|
if (v >= 0) { /* found? */
|
||||||
init_exp(var, VLOCAL, v); /* variable is local */
|
init_exp(var, VLOCAL, v); /* variable is local */
|
||||||
if (!base)
|
if (!base)
|
||||||
markupval(fs, v); /* local will be used as an upval */
|
markupval(fs, v); /* local will be used as an upval */
|
||||||
return VLOCAL;
|
|
||||||
}
|
}
|
||||||
else { /* not found as local at current level; try upvalues */
|
else { /* not found as local at current level; try upvalues */
|
||||||
int idx = searchupvalue(fs, n); /* try existing upvalues */
|
int idx = searchupvalue(fs, n); /* try existing upvalues */
|
||||||
if (idx < 0) { /* not found? */
|
if (idx < 0) { /* not found? */
|
||||||
if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */
|
singlevaraux(fs->prev, n, var, 0); /* try upper levels */
|
||||||
return VVOID; /* not found; is a global */
|
if (var->k == VVOID) /* not found? */
|
||||||
|
return; /* it is a global */
|
||||||
/* else was LOCAL or UPVAL */
|
/* else was LOCAL or UPVAL */
|
||||||
idx = newupvalue(fs, n, var); /* will be a new upvalue */
|
idx = newupvalue(fs, n, var); /* will be a new upvalue */
|
||||||
}
|
}
|
||||||
init_exp(var, VUPVAL, idx);
|
init_exp(var, VUPVAL, idx); /* new or old upvalue */
|
||||||
return VUPVAL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,10 +297,11 @@ static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
|
|||||||
static void singlevar (LexState *ls, expdesc *var) {
|
static void singlevar (LexState *ls, expdesc *var) {
|
||||||
TString *varname = str_checkname(ls);
|
TString *varname = str_checkname(ls);
|
||||||
FuncState *fs = ls->fs;
|
FuncState *fs = ls->fs;
|
||||||
if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */
|
singlevaraux(fs, varname, var, 1);
|
||||||
|
if (var->k == VVOID) { /* global name? */
|
||||||
expdesc key;
|
expdesc key;
|
||||||
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
|
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
|
||||||
lua_assert(var->k == VLOCAL || var->k == VUPVAL);
|
lua_assert(var->k != VVOID); /* this one must exist */
|
||||||
codestring(ls, &key, varname); /* key is variable name */
|
codestring(ls, &key, varname); /* key is variable name */
|
||||||
luaK_indexed(fs, var, &key); /* env[varname] */
|
luaK_indexed(fs, var, &key); /* env[varname] */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstrlib.c,v 1.248 2016/05/02 13:58:01 roberto Exp $
|
** $Id: lstrlib.c,v 1.250 2016/05/18 18:19:51 roberto Exp $
|
||||||
** Standard library for string operations and pattern-matching
|
** Standard library for string operations and pattern-matching
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -958,8 +958,8 @@ static void addliteral (lua_State *L, luaL_Buffer *b, int arg) {
|
|||||||
addliteralnum(L, b, lua_tonumber(L, arg));
|
addliteralnum(L, b, lua_tonumber(L, arg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* else integers; write in "native" format *//* FALLTHROUGH */
|
/* else integers; write in "native" format */
|
||||||
}
|
} /* FALLTHROUGH */
|
||||||
case LUA_TNIL: case LUA_TBOOLEAN: {
|
case LUA_TNIL: case LUA_TBOOLEAN: {
|
||||||
luaL_tolstring(L, arg, NULL);
|
luaL_tolstring(L, arg, NULL);
|
||||||
luaL_addvalue(b);
|
luaL_addvalue(b);
|
||||||
@@ -1369,13 +1369,11 @@ static int str_pack (lua_State *L) {
|
|||||||
case Kchar: { /* fixed-size string */
|
case Kchar: { /* fixed-size string */
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *s = luaL_checklstring(L, arg, &len);
|
const char *s = luaL_checklstring(L, arg, &len);
|
||||||
if ((size_t)size <= len) /* string larger than (or equal to) needed? */
|
luaL_argcheck(L, len <= (size_t)size, arg,
|
||||||
luaL_addlstring(&b, s, size); /* truncate string to asked size */
|
"string longer than given size");
|
||||||
else { /* string smaller than needed */
|
luaL_addlstring(&b, s, len); /* add string */
|
||||||
luaL_addlstring(&b, s, len); /* add it all */
|
|
||||||
while (len++ < (size_t)size) /* pad extra space */
|
while (len++ < (size_t)size) /* pad extra space */
|
||||||
luaL_addchar(&b, LUAL_PACKPADBYTE);
|
luaL_addchar(&b, LUAL_PACKPADBYTE);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Kstring: { /* strings with length count */
|
case Kstring: { /* strings with length count */
|
||||||
|
|||||||
Reference in New Issue
Block a user