vala r2281 - in trunk: . vala



Author: juergbi
Date: Tue Jan  6 23:16:07 2009
New Revision: 2281
URL: http://svn.gnome.org/viewvc/vala?rev=2281&view=rev

Log:
2009-01-07  JÃrg Billeter  <j bitron ch>

	* vala/valaclass.vala:
	* vala/valainterface.vala:
	* vala/valastruct.vala:

	Check base types of classes, interfaces, and structs,
	patch by Andreas Brauchli, fixes bug 566592


Modified:
   trunk/ChangeLog
   trunk/vala/valaclass.vala
   trunk/vala/valainterface.vala
   trunk/vala/valastruct.vala

Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala	(original)
+++ trunk/vala/valaclass.vala	Tue Jan  6 23:16:07 2009
@@ -866,6 +866,12 @@
 				return false;
 			}
 
+			if (!(base_type_reference is ObjectType)) {
+				error = true;
+				Report.error (source_reference, "base type `%s` of class `%s` is not an object type".printf (base_type_reference.to_string (), get_full_name ()));
+				return false;
+			}
+
 			// check whether base type is at least as accessible as the class
 			if (!analyzer.is_type_accessible (this, base_type_reference)) {
 				error = true;

Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala	(original)
+++ trunk/vala/valainterface.vala	Tue Jan  6 23:16:07 2009
@@ -545,6 +545,13 @@
 				error = true;
 				continue;
 			}
+
+			if (!(class_or_interface is ObjectTypeSymbol)) {
+				error = true;
+				Report.error (source_reference, "Prerequisite `%s` of interface `%s` is not a class or interface".printf (get_full_name (), class_or_interface.to_string ()));
+				return false;
+			}
+
 			/* interfaces are not allowed to have multiple instantiable prerequisites */
 			if (class_or_interface is Class) {
 				if (prereq_class != null) {

Modified: trunk/vala/valastruct.vala
==============================================================================
--- trunk/vala/valastruct.vala	(original)
+++ trunk/vala/valastruct.vala	Tue Jan  6 23:16:07 2009
@@ -679,6 +679,12 @@
 
 		foreach (DataType type in base_types) {
 			type.check (analyzer);
+
+			if (!(type is StructValueType)) {
+				error = true;
+				Report.error (source_reference, "The base type `%s` of value type `%s` is not a struct".printf (type.data_type.to_string (), get_full_name ()));
+				return false;
+			}
 		}
 
 		foreach (TypeParameter p in type_parameters) {



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