]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
enhance assignment test correct bracketing in compound assignments
authorJürg Billeter <j@bitron.ch>
Sun, 25 Feb 2007 19:15:33 +0000 (19:15 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 25 Feb 2007 19:15:33 +0000 (19:15 +0000)
2007-02-25  Jürg Billeter  <j@bitron.ch>

* tests/test-010.vala, tests/test-010.out: enhance assignment test
* vala/valasemanticanalyzer.vala: correct bracketing in compound
  assignments

svn path=/trunk/; revision=196

vala/ChangeLog
vala/tests/test-010.out
vala/tests/test-010.vala
vala/vala/valasemanticanalyzer.vala

index 245de6e946ad53c97b5a8ab72f5e25d01bd548c6..d03a5fe5787a56660eaf054fdbe6aea22be88de6 100644 (file)
@@ -1,3 +1,9 @@
+2007-02-25  Jürg Billeter  <j@bitron.ch>
+
+       * tests/test-010.vala, tests/test-010.out: enhance assignment test
+       * vala/valasemanticanalyzer.vala: correct bracketing in compound
+         assignments
+
 2007-02-25  Jürg Billeter  <j@bitron.ch>
 
        * vala/valacodenode.vala: add to_string method
index b0fa17f1f0897fc3d8ce5dcccb55811d1699238f..7626fd771b7398d507f53e3f47897ca7f08de382 100644 (file)
@@ -1 +1 @@
-Assignment Test: 1 2 3 4 5 6 7 8 9 10 11 12 13
+Assignment Test: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
index 6e883be32407ee174deccba8a7f513478f90526e..c1daa8d7d7bd063345ddc31658f583658d909d42 100644 (file)
@@ -45,8 +45,12 @@ class Maman.Bar {
                i >>= 1;
                stdout.printf (" %d", i);
                
-               stdout.printf (" 13\n");
-               
+               i = 12;
+               i -= 1 - 2;
+               stdout.printf (" %d", i);
+
+               stdout.printf (" 14\n");
+
                return 0;
        }
 }
index ea78ea9ddc273ecd3d4bb34eace6a036e156dc2b..e16cc76940af41f7f35758a333d739dcc2db5bcd 100644 (file)
@@ -1578,7 +1578,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        if (!(ma.symbol_reference.node is Signal)) {
                                var old_value = new MemberAccess (ma.inner, ma.member_name);
                        
-                               var bin = new BinaryExpression (BinaryOperator.PLUS, old_value, a.right);
+                               var bin = new BinaryExpression (BinaryOperator.PLUS, old_value, new ParenthesizedExpression (a.right, a.right.source_reference));
                                
                                if (a.operator == AssignmentOperator.BITWISE_OR) {
                                        bin.operator = BinaryOperator.BITWISE_OR;