vala r917 - in trunk: . gobject tests



Author: juergbi
Date: Sun Jan 27 22:49:18 2008
New Revision: 917
URL: http://svn.gnome.org/viewvc/vala?rev=917&view=rev

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

	* gobject/valaccodegeneratorinvocationexpression.vala,
	  gobject/valaccodegeneratormemberaccess.vala: fix struct pointer
	  member access

	* tests/Makefile.am, tests/pointers.vala, tests/pointers.exp: test
	  struct pointers


Added:
   trunk/tests/pointers.exp
   trunk/tests/pointers.vala
Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegeneratorinvocationexpression.vala
   trunk/gobject/valaccodegeneratormemberaccess.vala
   trunk/tests/Makefile.am

Modified: trunk/gobject/valaccodegeneratorinvocationexpression.vala
==============================================================================
--- trunk/gobject/valaccodegeneratorinvocationexpression.vala	(original)
+++ trunk/gobject/valaccodegeneratorinvocationexpression.vala	Sun Jan 27 22:49:18 2008
@@ -80,7 +80,7 @@
 				instance_expression_type = ma.inner.static_type;
 			}
 
-			if (m.parent_symbol is Struct && !((Struct) m.parent_symbol).is_simple_type () && (ma.inner != null || m.parent_symbol != current_type_symbol)) {
+			if (instance_expression_type.data_type is Struct && !((Struct) instance_expression_type.data_type).is_simple_type () && instance_expression_type.data_type != current_type_symbol) {
 				instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance);
 			}
 

Modified: trunk/gobject/valaccodegeneratormemberaccess.vala
==============================================================================
--- trunk/gobject/valaccodegeneratormemberaccess.vala	(original)
+++ trunk/gobject/valaccodegeneratormemberaccess.vala	Sun Jan 27 22:49:18 2008
@@ -88,7 +88,7 @@
 				} else {
 					inst = typed_inst;
 				}
-				if (instance_target_type.data_type.is_reference_type ()) {
+				if (instance_target_type.data_type.is_reference_type () || (expr.inner != null && expr.inner.static_type is PointerType)) {
 					expr.ccodenode = new CCodeMemberAccess.pointer (inst, f.get_cname ());
 				} else {
 					expr.ccodenode = new CCodeMemberAccess (inst, f.get_cname ());

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Sun Jan 27 22:49:18 2008
@@ -33,6 +33,7 @@
 	interfaces-properties.vala \
 	enums.vala \
 	arrays.vala \
+	pointers.vala \
 	delegates.vala \
 	exceptions.vala \
 	\
@@ -71,6 +72,7 @@
 	interfaces-properties.exp \
 	enums.exp \
 	arrays.exp \
+	pointers.vala \
 	delegates.exp \
 	exceptions.exp \
 	\

Added: trunk/tests/pointers.exp
==============================================================================

Added: trunk/tests/pointers.vala
==============================================================================
--- (empty file)
+++ trunk/tests/pointers.vala	Sun Jan 27 22:49:18 2008
@@ -0,0 +1,16 @@
+using GLib;
+
+struct SimpleStruct {
+	public int field;
+
+	public int test () {
+		return field;
+	}
+
+	static void main () {
+		SimpleStruct* st = new SimpleStruct[1];
+		st->field = 1;
+		assert (st->field == st->test ());
+	}
+}
+



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