]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Check types in property assignments, fixes bug 550088
authorJürg Billeter <j@bitron.ch>
Thu, 20 Nov 2008 21:37:35 +0000 (21:37 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Thu, 20 Nov 2008 21:37:35 +0000 (21:37 +0000)
2008-11-20  Jürg Billeter  <j@bitron.ch>

* vala/valaassignment.vala:

Check types in property assignments, fixes bug 550088

svn path=/trunk/; revision=2042

ChangeLog
vala/valaassignment.vala

index 5ae96a51e41e21ca2623057d4a5f79ea5392aab1..34020b1b8b48c8d10aac6ff080e7c5e7b727a139 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-20  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaassignment.vala:
+
+       Check types in property assignments, fixes bug 550088
+
 2008-11-20  Jürg Billeter  <j@bitron.ch>
 
        * vala/valacatchclause.vala:
index f45a95e28abc4b785c28575dc7325b3c6edda1ac..d3ad077f70412b4c7ab6037f633349ef94a12373 100644 (file)
@@ -301,7 +301,9 @@ public class Vala.Assignment : Expression {
                                        Report.error (source_reference, "Assignment: Invalid callback assignment attempt");
                                        return false;
                                }
-                       } else if (left.value_type != null && right.value_type != null) {
+                       }
+
+                       if (left.value_type != null && right.value_type != null) {
                                /* if there was an error on either side,
                                 * i.e. {left|right}.value_type == null, skip type check */
 
@@ -311,18 +313,20 @@ public class Vala.Assignment : Expression {
                                        return false;
                                }
 
-                               if (right.value_type.is_disposable ()) {
-                                       /* rhs transfers ownership of the expression */
-                                       if (!(left.value_type is PointerType) && !left.value_type.value_owned) {
-                                               /* lhs doesn't own the value */
-                                               error = true;
-                                               Report.error (source_reference, "Invalid assignment from owned expression to unowned variable");
+                               if (!(ma.symbol_reference is Property)) {
+                                       if (right.value_type.is_disposable ()) {
+                                               /* rhs transfers ownership of the expression */
+                                               if (!(left.value_type is PointerType) && !left.value_type.value_owned) {
+                                                       /* lhs doesn't own the value */
+                                                       error = true;
+                                                       Report.error (source_reference, "Invalid assignment from owned expression to unowned variable");
+                                               }
+                                       } else if (left.value_type.value_owned) {
+                                               /* lhs wants to own the value
+                                                * rhs doesn't transfer the ownership
+                                                * code generator needs to add reference
+                                                * increment calls */
                                        }
-                               } else if (left.value_type.value_owned) {
-                                       /* lhs wants to own the value
-                                        * rhs doesn't transfer the ownership
-                                        * code generator needs to add reference
-                                        * increment calls */
                                }
                        }
                } else if (left is ElementAccess) {