vala r1178 - in trunk: . tests vala



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

Log:
2008-04-07  Juerg Billeter  <j bitron ch>

	* vala/valasymbolresolver.vala: reset takes_ownership and
	  transfers_ownership for base types of pointer types

	* tests/pointers.vala: test element access for methods returning
	  pointers


Modified:
   trunk/ChangeLog
   trunk/tests/pointers.vala
   trunk/vala/valasymbolresolver.vala

Modified: trunk/tests/pointers.vala
==============================================================================
--- trunk/tests/pointers.vala	(original)
+++ trunk/tests/pointers.vala	Mon Apr  7 19:19:21 2008
@@ -14,6 +14,7 @@
 		delete st;
 
 		test_pointers_element_access ();
+		test_pointers_return_value ();
 	}
 
 	static void test_pointers_element_access () {
@@ -22,5 +23,16 @@
 		assert (array[0] == 23);
 		delete array;
 	}
+
+	const int[] array = { 42 };
+
+	static int* return_pointer () {
+		return array;
+	}
+
+	static void test_pointers_return_value () {
+		int i = return_pointer ()[0];
+		assert (i == 42);
+	}
 }
 

Modified: trunk/vala/valasymbolresolver.vala
==============================================================================
--- trunk/vala/valasymbolresolver.vala	(original)
+++ trunk/vala/valasymbolresolver.vala	Mon Apr  7 19:19:21 2008
@@ -276,7 +276,13 @@
 		}
 
 		for (int pointer_level = unresolved_type.pointer_level; pointer_level > 0; pointer_level--) {
-			type = new PointerType (type);
+			var base_type = type;
+			base_type.takes_ownership = false;
+			base_type.transfers_ownership = false;
+			base_type.is_ref = false;
+			base_type.is_out = false;
+
+			type = new PointerType (base_type);
 		}
 
 		if (!type.is_reference_type_or_type_parameter ()) {



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