1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00

"if" expression leaves only one of its expressions on the stack

This commit is contained in:
Roberto Ierusalimschy 1999-02-02 11:47:31 -02:00
parent 0f0079f394
commit 50248e440a

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lparser.c,v 1.10 1999/01/29 13:48:58 roberto Exp roberto $ ** $Id: lparser.c,v 1.11 1999/02/01 18:52:05 roberto Exp roberto $
** LL(1) Parser and code generator for Lua ** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -847,7 +847,10 @@ static void ifpart (LexState *ls, int isexp, int line) {
next(ls); /* skip IF or ELSEIF */ next(ls); /* skip IF or ELSEIF */
c = cond(ls); c = cond(ls);
check(ls, THEN); check(ls, THEN);
if (isexp) exp1(ls); if (isexp) {
exp1(ls);
deltastack(ls, -1); /* only then xor else part will stay on the stack */
}
else block(ls); else block(ls);
e = SaveWord(ls); e = SaveWord(ls);
if (ls->token == ELSEIF) if (ls->token == ELSEIF)