Fix binding of assignment expressions.

This commit is contained in:
Ben Bacarisse 2010-10-25 15:40:30 +01:00
parent 9228842fa7
commit 14673d0c49

View File

@ -3766,38 +3766,15 @@ ST_FUNC void unary(void)
}
}
static void uneq(void)
{
int t;
unary();
if (tok == '=' ||
(tok >= TOK_A_MOD && tok <= TOK_A_DIV) ||
tok == TOK_A_XOR || tok == TOK_A_OR ||
tok == TOK_A_SHL || tok == TOK_A_SAR) {
test_lvalue();
t = tok;
next();
if (t == '=') {
expr_eq();
} else {
vdup();
expr_eq();
gen_op(t & 0x7f);
}
vstore();
}
}
ST_FUNC void expr_prod(void)
{
int t;
uneq();
unary();
while (tok == '*' || tok == '/' || tok == '%') {
t = tok;
next();
uneq();
unary();
gen_op(t);
}
}
@ -3949,7 +3926,7 @@ static void expr_lor(void)
}
/* XXX: better constant handling */
static void expr_eq(void)
static void expr_cond(void)
{
int tt, u, r1, r2, rc, t1, t2, bt1, bt2;
SValue sv;
@ -3973,7 +3950,7 @@ static void expr_eq(void)
if (!c)
vpop();
skip(':');
expr_eq();
expr_cond();
if (c)
vpop();
}
@ -4010,7 +3987,7 @@ static void expr_eq(void)
skip(':');
u = gjmp(0);
gsym(tt);
expr_eq();
expr_cond();
type2 = vtop->type;
t1 = type1.t;
@ -4090,6 +4067,29 @@ static void expr_eq(void)
}
}
static void expr_eq(void)
{
int t;
expr_cond();
if (tok == '=' ||
(tok >= TOK_A_MOD && tok <= TOK_A_DIV) ||
tok == TOK_A_XOR || tok == TOK_A_OR ||
tok == TOK_A_SHL || tok == TOK_A_SAR) {
test_lvalue();
t = tok;
next();
if (t == '=') {
expr_eq();
} else {
vdup();
expr_eq();
gen_op(t & 0x7f);
}
vstore();
}
}
ST_FUNC void gexpr(void)
{
while (1) {
@ -4134,7 +4134,7 @@ static void expr_const1(void)
int a;
a = const_wanted;
const_wanted = 1;
expr_eq();
expr_cond();
const_wanted = a;
}