]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Report error when trying to assign private properties in creation methods,
authorJürg Billeter <j@bitron.ch>
Sun, 15 Jun 2008 19:50:00 +0000 (19:50 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 15 Jun 2008 19:50:00 +0000 (19:50 +0000)
2008-06-15  Jürg Billeter  <j@bitron.ch>

* gobject/valaccodecreationmethodbinding.vala:

Report error when trying to assign private properties in creation
methods, patch by Hans Vercammen, fixes bug 536353

svn path=/trunk/; revision=1584

ChangeLog
gobject/valaccodecreationmethodbinding.vala

index c34376ef4dd6e80f4c4ac2a086cd539584735598..d7ef7af69d41ac45b200282fdc1f5fd1ea798a21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-15  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodecreationmethodbinding.vala:
+
+       Report error when trying to assign private properties in creation
+       methods, patch by Hans Vercammen, fixes bug 536353
+
 2008-06-15  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valaccodegeneratorsignal.vala:
index a76ac532490dab7083c324895e6a814ed7475e68..411dea580fc8a1f3a9a326b0d58e5ac7473978eb 100644 (file)
@@ -46,7 +46,14 @@ public class Vala.CCodeCreationMethodBinding : CCodeMethodBinding {
                                        Report.error (stmt.source_reference, "class creation methods only allow property assignment statements");
                                        return;
                                }
-                               if (((ExpressionStatement) stmt).assigned_property ().set_accessor.construction) {
+
+                               Property prop = ((ExpressionStatement) stmt).assigned_property ();
+                               if (prop.access == SymbolAccessibility.PRIVATE) {
+                                       m.error = true;
+                                       Report.error (stmt.source_reference, "class creation methods only allow assignments to public and protected properties");
+                                       return;
+                               }
+                               if (prop.set_accessor.construction) {
                                        n_params++;
                                }
                        }