change syntax for defining default values of properties, fixes bug 526550
authorJuerg Billeter <j@bitron.ch>
Mon, 7 Apr 2008 20:54:20 +0000 (20:54 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 7 Apr 2008 20:54:20 +0000 (20:54 +0000)
2008-04-07  Juerg Billeter  <j@bitron.ch>

* vala/parser.y: change syntax for defining default values of
  properties, fixes bug 526550

* tests/classes-properties.vala: test default values for properties

svn path=/trunk/; revision=1183

ChangeLog
tests/classes-properties.vala
vala/parser.y

index 494fb4f..f4b439c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-04-07  Jürg Billeter  <j@bitron.ch>
 
+       * vala/parser.y: change syntax for defining default values of
+         properties, fixes bug 526550
+
+       * tests/classes-properties.vala: test default values for properties
+
+2008-04-07  Jürg Billeter  <j@bitron.ch>
+
        * vala/valacodenode.vala, gobject/valaccodegenerator.vala: improve
          error reporting for non reference-counted object instances,
          fixes bug 471053
index b35440e..edbbadc 100644 (file)
@@ -67,16 +67,8 @@ class Maman.Foo : Object {
 }
 
 class Maman.Bar : Foo {
-       private int _public_property = 3;
-       public int public_property {
-               get {
-                       return _public_property;
-               }
-               set {
-                       _public_property = value;
-               }
-       }
-       
+       public int public_property { get; set; default = 3; }
+
        void do_action () {
                stdout.printf (" %d %d", public_base_property, public_property);
                public_base_property = 4;
index cb932a3..fc7b3ac 100644 (file)
@@ -3630,6 +3630,10 @@ default_value
          {
                $$ = $3;
          }
+       | DEFAULT ASSIGN expression SEMICOLON
+         {
+               $$ = $3;
+         }
        ;
 
 signal_declaration