vala r947 - in trunk: . vala



Author: juergbi
Date: Fri Feb  1 18:51:12 2008
New Revision: 947
URL: http://svn.gnome.org/viewvc/vala?rev=947&view=rev

Log:
2008-02-01  Juerg Billeter  <j bitron ch>

	* vala/parser.y, vala/valaproperty.vala, vala/valasemanticanalyzer.vala:
	  report error when declaring static properties


Modified:
   trunk/ChangeLog
   trunk/vala/parser.y
   trunk/vala/valaproperty.vala
   trunk/vala/valasemanticanalyzer.vala

Modified: trunk/vala/parser.y
==============================================================================
--- trunk/vala/parser.y	(original)
+++ trunk/vala/parser.y	Fri Feb  1 18:51:12 2008
@@ -3363,6 +3363,9 @@
 		if (($4 & VALA_MODIFIER_OVERRIDE) == VALA_MODIFIER_OVERRIDE) {
 			vala_property_set_overrides ($$, TRUE);
 		}
+		if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) {
+			vala_property_set_instance ($$, FALSE);
+		}
 	  }
 	| comment opt_attributes opt_access_modifier opt_modifiers type identifier OPEN_BRACE set_accessor_declaration opt_get_accessor_declaration CLOSE_BRACE
 	  {
@@ -3396,6 +3399,9 @@
 		if (($4 & VALA_MODIFIER_OVERRIDE) == VALA_MODIFIER_OVERRIDE) {
 			vala_property_set_overrides ($$, TRUE);
 		}
+		if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) {
+			vala_property_set_instance ($$, FALSE);
+		}
 	  }
 	;
 

Modified: trunk/vala/valaproperty.vala
==============================================================================
--- trunk/vala/valaproperty.vala	(original)
+++ trunk/vala/valaproperty.vala	Fri Feb  1 18:51:12 2008
@@ -1,6 +1,6 @@
 /* valaproperty.vala
  *
- * Copyright (C) 2006-2007  JÃrg Billeter
+ * Copyright (C) 2006-2008  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -88,7 +88,16 @@
 	 * property of a base type.
 	 */
 	public bool overrides { get; set; }
-	
+
+	/**
+	 * Specifies whether this field may only be accessed with an instance of
+	 * the contained type.
+	 */
+	public bool instance {
+		get { return _instance; }
+		set { _instance = value; }
+	}
+
 	/**
 	 * Specifies the virtual or abstract property this property overrides.
 	 * Reference must be weak as virtual properties set base_property to
@@ -104,6 +113,7 @@
 	private bool lock_used = false;
 
 	private DataType _data_type;
+	private bool _instance = true;
 
 	/**
 	 * Creates a new property.

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Fri Feb  1 18:51:12 2008
@@ -583,6 +583,12 @@
 	public override void visit_property (Property! prop) {
 		current_symbol = prop;
 
+		if (!prop.instance) {
+			Report.error (prop.source_reference, "static properties are not yet supported");
+			prop.error = true;
+			return;
+		}
+
 		prop.accept_children (this);
 
 		/* abstract/virtual properties using reference types without



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