2008-12-15 Jürg Billeter <j@bitron.ch>
* vala/valaswitchstatement.vala:
Check switch expression
svn path=/trunk/; revision=2158
+2008-12-15 Jürg Billeter <j@bitron.ch>
+
+ * vala/valaswitchstatement.vala:
+
+ Check switch expression
+
2008-12-15 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vapi:
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);