Removed code for compatibility with version 5.3
This commit is contained in:
4
lstate.h
4
lstate.h
@@ -249,10 +249,6 @@ struct CallInfo {
|
||||
#define CIST_HOOKYIELD (CIST_TAIL << 1)
|
||||
/* function "called" a finalizer */
|
||||
#define CIST_FIN (CIST_HOOKYIELD << 1)
|
||||
#if defined(LUA_COMPAT_LT_LE)
|
||||
/* using __lt for __le */
|
||||
#define CIST_LEQ (CIST_FIN << 1)
|
||||
#endif
|
||||
|
||||
|
||||
#define get_nresults(cs) (cast_int((cs) & CIST_NRESULTS) - 1)
|
||||
|
||||
1
ltests.h
1
ltests.h
@@ -13,7 +13,6 @@
|
||||
|
||||
/* test Lua with compatibility code */
|
||||
#define LUA_COMPAT_MATHLIB
|
||||
#define LUA_COMPAT_LT_LE
|
||||
#undef LUA_COMPAT_GLOBAL
|
||||
|
||||
|
||||
|
||||
16
ltm.c
16
ltm.c
@@ -196,28 +196,12 @@ void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2,
|
||||
|
||||
/*
|
||||
** Calls an order tag method.
|
||||
** For lessequal, LUA_COMPAT_LT_LE keeps compatibility with old
|
||||
** behavior: if there is no '__le', try '__lt', based on l <= r iff
|
||||
** !(r < l) (assuming a total order). If the metamethod yields during
|
||||
** this substitution, the continuation has to know about it (to negate
|
||||
** the result of r<l); bit CIST_LEQ in the call status keeps that
|
||||
** information.
|
||||
*/
|
||||
int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2,
|
||||
TMS event) {
|
||||
int tag = callbinTM(L, p1, p2, L->top.p, event); /* try original event */
|
||||
if (tag >= 0) /* found tag method? */
|
||||
return !tagisfalse(tag);
|
||||
#if defined(LUA_COMPAT_LT_LE)
|
||||
else if (event == TM_LE) {
|
||||
/* try '!(p2 < p1)' for '(p1 <= p2)' */
|
||||
L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */
|
||||
tag = callbinTM(L, p2, p1, L->top.p, TM_LT);
|
||||
L->ci->callstatus ^= CIST_LEQ; /* clear mark */
|
||||
if (tag >= 0) /* found tag method? */
|
||||
return tagisfalse(tag);
|
||||
}
|
||||
#endif
|
||||
luaG_ordererror(L, p1, p2); /* no metamethod found */
|
||||
return 0; /* to avoid warnings */
|
||||
}
|
||||
|
||||
7
lua.h
7
lua.h
@@ -432,13 +432,6 @@ LUA_API void (lua_closeslot) (lua_State *L, int idx);
|
||||
** compatibility macros
|
||||
** ===============================================================
|
||||
*/
|
||||
#if defined(LUA_COMPAT_APIINTCASTS)
|
||||
|
||||
#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n))
|
||||
#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is))
|
||||
#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
|
||||
|
||||
#endif
|
||||
|
||||
#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1)
|
||||
#define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1)
|
||||
|
||||
27
luaconf.h
27
luaconf.h
@@ -361,36 +361,13 @@
|
||||
#define LUA_COMPAT_GLOBAL
|
||||
|
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3.
|
||||
** You can define it to get all options, or change specific options
|
||||
** to fit your specific needs.
|
||||
*/
|
||||
#if defined(LUA_COMPAT_5_3) /* { */
|
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
|
||||
** functions in the mathematical library.
|
||||
** (These functions were already officially removed in 5.3;
|
||||
** nevertheless they are still available here.)
|
||||
*/
|
||||
#define LUA_COMPAT_MATHLIB
|
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
|
||||
** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
|
||||
** luaL_checkint, luaL_checklong, etc.)
|
||||
** (These macros were also officially removed in 5.3, but they are still
|
||||
** available here.)
|
||||
*/
|
||||
#define LUA_COMPAT_APIINTCASTS
|
||||
|
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod
|
||||
** using '__lt'.
|
||||
*/
|
||||
#define LUA_COMPAT_LT_LE
|
||||
/* #define LUA_COMPAT_MATHLIB */
|
||||
|
||||
|
||||
/*
|
||||
@@ -407,8 +384,6 @@
|
||||
#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
|
||||
#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
|
||||
|
||||
#endif /* } */
|
||||
|
||||
/* }================================================================== */
|
||||
|
||||
|
||||
|
||||
6
lvm.c
6
lvm.c
@@ -861,12 +861,6 @@ void luaV_finishOp (lua_State *L) {
|
||||
case OP_EQ: { /* note that 'OP_EQI'/'OP_EQK' cannot yield */
|
||||
int res = !l_isfalse(s2v(L->top.p - 1));
|
||||
L->top.p--;
|
||||
#if defined(LUA_COMPAT_LT_LE)
|
||||
if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */
|
||||
ci->callstatus ^= CIST_LEQ; /* clear mark */
|
||||
res = !res; /* negate result */
|
||||
}
|
||||
#endif
|
||||
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);
|
||||
if (res != GETARG_k(inst)) /* condition failed? */
|
||||
ci->u.l.savedpc++; /* skip jump instruction */
|
||||
|
||||
@@ -246,7 +246,8 @@ assert(not T.testC("compare LT 1 4, return 1"))
|
||||
assert(not T.testC("compare LE 9 1, return 1"))
|
||||
assert(not T.testC("compare EQ 9 9, return 1"))
|
||||
|
||||
local b = {__lt = function (a,b) return a[1] < b[1] end}
|
||||
local b = {__lt = function (a,b) return a[1] < b[1] end,
|
||||
__le = function (a,b) return a[1] <= b[1] end}
|
||||
local a1,a3,a4 = setmetatable({1}, b),
|
||||
setmetatable({3}, b),
|
||||
setmetatable({4}, b)
|
||||
|
||||
Reference in New Issue
Block a user