report error when trying to set construct-only properties
authorJuerg Billeter <j@bitron.ch>
Sat, 19 Apr 2008 21:58:44 +0000 (21:58 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 19 Apr 2008 21:58:44 +0000 (21:58 +0000)
2008-04-19  Juerg Billeter  <j@bitron.ch>

* vala/valasemanticanalyzer.vala: report error when trying to set
  construct-only properties

svn path=/trunk/; revision=1278

ChangeLog
vala/valasemanticanalyzer.vala

index b0d4d63..39f6a25 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-04-19  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valasemanticanalyzer.vala: report error when trying to set
+         construct-only properties
+
+2008-04-19  Jürg Billeter  <j@bitron.ch>
+
        * gobject/valaccodeassignmentbinding.vala: fix D-Bus signal
          handlers, fixes bug 528937
 
index 3cd8517..e0b00ba 100644 (file)
@@ -3013,7 +3013,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        } else if (ma.symbol_reference is Property) {
                                var prop = (Property) ma.symbol_reference;
 
-                               if (prop.set_accessor == null) {
+                               if (prop.set_accessor == null
+                                   || (!prop.set_accessor.writable && !(find_current_method () is CreationMethod))) {
                                        ma.error = true;
                                        Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ()));
                                        return;