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
3766 }3766 }
3767}3767}
3768 3768
3769static 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
3792ST_FUNC void expr_prod(void)3769ST_FUNC void expr_prod(void)
3793{3770{
3794 int t;3771 int t;
3795 3772
3796 uneq();3773 unary();
3797 while (tok == '*' || tok == '/' || tok == '%') {3774 while (tok == '*' || tok == '/' || tok == '%') {
3798 t = tok;3775 t = tok;
3799 next();3776 next();
3800 uneq();3777 unary();
3801 gen_op(t);3778 gen_op(t);
3802 }3779 }
3803}3780}
@@ -3949,7 +3926,7 @@ static void expr_lor(void) · 145 unmodified lines
3949}3926}
3950 3927
3951/* XXX: better constant handling */3928/* XXX: better constant handling */
3952static void expr_eq(void)3929static void expr_cond(void)
3953{3930{
3954 int tt, u, r1, r2, rc, t1, t2, bt1, bt2;3931 int tt, u, r1, r2, rc, t1, t2, bt1, bt2;
3955 SValue sv;3932 SValue sv;
@@ -3973,7 +3950,7 @@ static void expr_eq(void) · 17 unmodified lines
3973 if (!c)3950 if (!c)
3974 vpop();3951 vpop();
3975 skip(':');3952 skip(':');
3976 expr_eq();3953 expr_cond();
3977 if (c)3954 if (c)
3978 vpop();3955 vpop();
3979 }3956 }
@@ -4010,7 +3987,7 @@ static void expr_eq(void) · 30 unmodified lines
4010 skip(':');3987 skip(':');
4011 u = gjmp(0);3988 u = gjmp(0);
4012 gsym(tt);3989 gsym(tt);
4013 expr_eq();3990 expr_cond();
4014 type2 = vtop->type;3991 type2 = vtop->type;
4015 3992
4016 t1 = type1.t;3993 t1 = type1.t;
@@ -4090,6 +4067,29 @@ static void expr_eq(void) · 73 unmodified lines
4090 }4067 }
4091}4068}
4092 4069
4070static 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
4093ST_FUNC void gexpr(void)4093ST_FUNC void gexpr(void)
4094{4094{
4095 while (1) {4095 while (1) {
@@ -4134,7 +4134,7 @@ static void expr_const1(void) · 38 unmodified lines
4134 int a;4134 int a;
4135 a = const_wanted;4135 a = const_wanted;
4136 const_wanted = 1;4136 const_wanted = 1;
4137 expr_eq();4137 expr_cond();
4138 const_wanted = a;4138 const_wanted = a;
4139}4139}
4140 4140

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