1
0
mirror of https://github.com/lua/lua.git synced 2025-02-04 06:13:04 +08:00

avoid jumping into a variable scope (C++ does not allow that)

This commit is contained in:
Roberto Ierusalimschy 2018-01-09 12:23:40 -02:00
parent 33e3774f44
commit ad960095bf

16
lvm.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 2.330 2017/12/28 15:42:57 roberto Exp roberto $ ** $Id: lvm.c,v 2.331 2017/12/30 20:46:18 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -1401,12 +1401,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
vmcase(OP_EQ) { vmcase(OP_EQ) {
TValue *rb = vRB(i); TValue *rb = vRB(i);
Protect(cond = luaV_equalobj(L, vra, rb)); Protect(cond = luaV_equalobj(L, vra, rb));
condjump: goto condjump;
if (cond != GETARG_k(i))
pc++; /* skip next jump */
else
donextjump(ci);
vmbreak;
} }
vmcase(OP_LT) { vmcase(OP_LT) {
TValue *rb = vRB(i); TValue *rb = vRB(i);
@ -1472,7 +1467,12 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
} }
vmcase(OP_TEST) { vmcase(OP_TEST) {
cond = !l_isfalse(vra); cond = !l_isfalse(vra);
goto condjump; condjump:
if (cond != GETARG_k(i))
pc++; /* skip next jump */
else
donextjump(ci);
vmbreak;
} }
vmcase(OP_TESTSET) { vmcase(OP_TESTSET) {
TValue *rb = vRB(i); TValue *rb = vRB(i);