vala r1366 - in trunk: . vala



Author: juergbi
Date: Sun May 11 12:32:06 2008
New Revision: 1366
URL: http://svn.gnome.org/viewvc/vala?rev=1366&view=rev

Log:
2008-05-11  Juerg Billeter  <j bitron ch>

	* vala/Makefile.am:
	* vala/valafieldprototype.vala:
	* vala/valasemanticanalyzer.vala:

	Set appropriate static type for field prototypes, fixes bug 532314


Added:
   trunk/vala/valafieldprototype.vala
Modified:
   trunk/ChangeLog
   trunk/vala/Makefile.am
   trunk/vala/valasemanticanalyzer.vala

Modified: trunk/vala/Makefile.am
==============================================================================
--- trunk/vala/Makefile.am	(original)
+++ trunk/vala/Makefile.am	Sun May 11 12:32:06 2008
@@ -65,6 +65,7 @@
 	valaexpression.vala \
 	valaexpressionstatement.vala \
 	valafield.vala \
+	valafieldprototype.vala \
 	valaforeachstatement.vala \
 	valaformalparameter.vala \
 	valaforstatement.vala \

Added: trunk/vala/valafieldprototype.vala
==============================================================================
--- (empty file)
+++ trunk/vala/valafieldprototype.vala	Sun May 11 12:32:06 2008
@@ -0,0 +1,43 @@
+/* valafieldprototype.vala
+ *
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ * 	JÃrg Billeter <j bitron ch>
+ */
+
+using GLib;
+
+/**
+ * A reference to an instance field without a specific instance.
+ */
+public class Vala.FieldPrototype : DataType {
+	public Field field_symbol { get; set; }
+
+	public FieldPrototype (Field field_symbol) {
+		this.field_symbol = field_symbol;
+	}
+
+	public override DataType copy () {
+		var result = new FieldPrototype (field_symbol);
+		return result;
+	}
+
+	public override string to_string () {
+		return field_symbol.get_full_name ();
+	}
+}

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Sun May 11 12:32:06 2008
@@ -1701,9 +1701,14 @@
 		if (instance && !may_access_instance_members) {
 			expr.prototype_access = true;
 
-			// also set static type for prototype access
-			// required when using instance methods as delegates in constants
-			expr.static_type = get_static_type_for_symbol (expr.symbol_reference);
+			if (expr.symbol_reference is Method) {
+				// also set static type for prototype access
+				// required when using instance methods as delegates in constants
+				// TODO replace by MethodPrototype
+				expr.static_type = get_static_type_for_symbol (expr.symbol_reference);
+			} else if (expr.symbol_reference is Field) {
+				expr.static_type = new FieldPrototype ((Field) expr.symbol_reference);
+			}
 		} else {
 			expr.static_type = get_static_type_for_symbol (expr.symbol_reference);
 



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