diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-02 11:47:31 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-02 11:47:31 -0200 |
commit | 50248e440a02c5eff357eaf2239cd1e7ef691614 (patch) | |
tree | a50f223d83b8e2650eb5e07b640fcfcccf23125f /lparser.c | |
parent | 0f0079f394a21a5e8c705054fd807abb0cc22324 (diff) | |
download | lua-50248e440a02c5eff357eaf2239cd1e7ef691614.tar.gz lua-50248e440a02c5eff357eaf2239cd1e7ef691614.tar.bz2 lua-50248e440a02c5eff357eaf2239cd1e7ef691614.zip |
"if" expression leaves only one of its expressions on the stack
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.10 1999/01/29 13:48:58 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.11 1999/02/01 18:52:05 roberto Exp roberto $ |
3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -847,7 +847,10 @@ static void ifpart (LexState *ls, int isexp, int line) { | |||
847 | next(ls); /* skip IF or ELSEIF */ | 847 | next(ls); /* skip IF or ELSEIF */ |
848 | c = cond(ls); | 848 | c = cond(ls); |
849 | check(ls, THEN); | 849 | check(ls, THEN); |
850 | if (isexp) exp1(ls); | 850 | if (isexp) { |
851 | exp1(ls); | ||
852 | deltastack(ls, -1); /* only then xor else part will stay on the stack */ | ||
853 | } | ||
851 | else block(ls); | 854 | else block(ls); |
852 | e = SaveWord(ls); | 855 | e = SaveWord(ls); |
853 | if (ls->token == ELSEIF) | 856 | if (ls->token == ELSEIF) |