vala r2158 - in trunk: . vala



Author: juergbi
Date: Mon Dec 15 19:59:02 2008
New Revision: 2158
URL: http://svn.gnome.org/viewvc/vala?rev=2158&view=rev

Log:
2008-12-15  JÃrg Billeter  <j bitron ch>

	* vala/valaswitchstatement.vala:

	Check switch expression


Modified:
   trunk/ChangeLog
   trunk/vala/valaswitchstatement.vala

Modified: trunk/vala/valaswitchstatement.vala
==============================================================================
--- trunk/vala/valaswitchstatement.vala	(original)
+++ trunk/vala/valaswitchstatement.vala	Mon Dec 15 19:59:02 2008
@@ -101,7 +101,17 @@
 
 		checked = true;
 
-		expression.check (analyzer);
+		if (!expression.check (analyzer)) {
+			error = true;
+			return false;
+		}
+
+		if (!expression.value_type.compatible (analyzer.uint64_type)
+		    && !expression.value_type.compatible (analyzer.string_type)) {
+			Report.error (expression.source_reference, "Integer or string expression expected");
+			error = true;
+			return false;
+		}
 
 		foreach (SwitchSection section in sections) {
 			section.check (analyzer);



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