vala r1183 - in trunk: . tests vala



Author: juergbi
Date: Mon Apr  7 21:54:20 2008
New Revision: 1183
URL: http://svn.gnome.org/viewvc/vala?rev=1183&view=rev

Log:
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


Modified:
   trunk/ChangeLog
   trunk/tests/classes-properties.vala
   trunk/vala/parser.y

Modified: trunk/tests/classes-properties.vala
==============================================================================
--- trunk/tests/classes-properties.vala	(original)
+++ trunk/tests/classes-properties.vala	Mon Apr  7 21:54:20 2008
@@ -67,16 +67,8 @@
 }
 
 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;

Modified: trunk/vala/parser.y
==============================================================================
--- trunk/vala/parser.y	(original)
+++ trunk/vala/parser.y	Mon Apr  7 21:54:20 2008
@@ -3630,6 +3630,10 @@
 	  {
 		$$ = $3;
 	  }
+	| DEFAULT ASSIGN expression SEMICOLON
+	  {
+		$$ = $3;
+	  }
 	;
 
 signal_declaration



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]