BUG: "(((1 or false) and true) or false)" gives wrong result

This commit is contained in:
Roberto Ierusalimschy 2009-06-15 10:52:08 -03:00
parent 2258ec6bc9
commit 3db5f60547
1 changed files with 15 additions and 9 deletions

24
lcode.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lcode.c,v 2.36 2008/04/07 18:41:47 roberto Exp roberto $
** $Id: lcode.c,v 2.37 2009/06/10 16:52:03 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@ -543,15 +543,18 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
pc = NO_JUMP; /* always true; do nothing */
break;
}
case VFALSE: {
pc = luaK_jump(fs); /* always jump */
break;
}
case VJMP: {
invertjump(fs, e);
pc = e->u.s.info;
break;
}
case VFALSE: {
if (!hasjumps(e)) {
pc = luaK_jump(fs); /* always jump */
break;
}
/* else go through */
}
default: {
pc = jumponcond(fs, e, 0);
break;
@ -571,14 +574,17 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
pc = NO_JUMP; /* always false; do nothing */
break;
}
case VTRUE: {
pc = luaK_jump(fs); /* always jump */
break;
}
case VJMP: {
pc = e->u.s.info;
break;
}
case VTRUE: {
if (!hasjumps(e)) {
pc = luaK_jump(fs); /* always jump */
break;
}
/* else go through */
}
default: {
pc = jumponcond(fs, e, 1);
break;