History

Fix binding of assignment expressions.

Ben Bacarisse committed 16 years ago

Commit 14673d01 parent 92288421 file · +29 −29Browse files

Unified · Split

tccgen.c+29−29
@@ -3766,38 +3766,15 @@ ST_FUNC void unary(void) · 3765 unmodified lines
37663766 }
37673767 }
37683768
3769−static void uneq(void)
3770−{
3771− int t;
3772−
3773− unary();
3774− if (tok == '=' ||
3775− (tok >= TOK_A_MOD && tok <= TOK_A_DIV) ||
3776− tok == TOK_A_XOR || tok == TOK_A_OR ||
3777− tok == TOK_A_SHL || tok == TOK_A_SAR) {
3778− test_lvalue();
3779− t = tok;
3780− next();
3781− if (t == '=') {
3782− expr_eq();
3783− } else {
3784− vdup();
3785− expr_eq();
3786− gen_op(t & 0x7f);
3787− }
3788− vstore();
3789− }
3790−}
3791−
37923769 ST_FUNC void expr_prod(void)
37933770 {
37943771 int t;
37953772
3796− uneq();
3773+ unary();
37973774 while (tok == '*' || tok == '/' || tok == '%') {
37983775 t = tok;
37993776 next();
3800− uneq();
3777+ unary();
38013778 gen_op(t);
38023779 }
38033780 }
@@ -3949,7 +3926,7 @@ static void expr_lor(void) · 145 unmodified lines
39493926 }
39503927
39513928 /* XXX: better constant handling */
3952−static void expr_eq(void)
3929+static void expr_cond(void)
39533930 {
39543931 int tt, u, r1, r2, rc, t1, t2, bt1, bt2;
39553932 SValue sv;
@@ -3973,7 +3950,7 @@ static void expr_eq(void) · 17 unmodified lines
39733950 if (!c)
39743951 vpop();
39753952 skip(':');
3976− expr_eq();
3953+ expr_cond();
39773954 if (c)
39783955 vpop();
39793956 }
@@ -4010,7 +3987,7 @@ static void expr_eq(void) · 30 unmodified lines
40103987 skip(':');
40113988 u = gjmp(0);
40123989 gsym(tt);
4013− expr_eq();
3990+ expr_cond();
40143991 type2 = vtop->type;
40153992
40163993 t1 = type1.t;
@@ -4090,6 +4067,29 @@ static void expr_eq(void) · 73 unmodified lines
40904067 }
40914068 }
40924069
4070+static void expr_eq(void)
4071+{
4072+ int t;
4073+
4074+ expr_cond();
4075+ if (tok == '=' ||
4076+ (tok >= TOK_A_MOD && tok <= TOK_A_DIV) ||
4077+ tok == TOK_A_XOR || tok == TOK_A_OR ||
4078+ tok == TOK_A_SHL || tok == TOK_A_SAR) {
4079+ test_lvalue();
4080+ t = tok;
4081+ next();
4082+ if (t == '=') {
4083+ expr_eq();
4084+ } else {
4085+ vdup();
4086+ expr_eq();
4087+ gen_op(t & 0x7f);
4088+ }
4089+ vstore();
4090+ }
4091+}
4092+
40934093 ST_FUNC void gexpr(void)
40944094 {
40954095 while (1) {
@@ -4134,7 +4134,7 @@ static void expr_const1(void) · 38 unmodified lines
41344134 int a;
41354135 a = const_wanted;
41364136 const_wanted = 1;
4137− expr_eq();
4137+ expr_cond();
41384138 const_wanted = a;
41394139 }
41404140

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t