[vala] Fix error handling checks in switch statements



commit e5a2f991e7e5799cf70e8edc12fd2c25c7f6625b
Author: Jürg Billeter <j bitron ch>
Date:   Wed Feb 10 15:38:02 2010 +0100

    Fix error handling checks in switch statements

 vala/valaswitchsection.vala   |    7 ++++++-
 vala/valaswitchstatement.vala |    4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaswitchsection.vala b/vala/valaswitchsection.vala
index 7b7cc95..334f6a7 100644
--- a/vala/valaswitchsection.vala
+++ b/vala/valaswitchsection.vala
@@ -1,6 +1,6 @@
 /* valaswitchsection.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -107,6 +107,11 @@ public class Vala.SwitchSection : Block {
 			local.active = false;
 		}
 
+		// use get_statements () instead of statement_list to not miss errors within StatementList objects
+		foreach (Statement stmt in get_statements ()) {
+			add_error_types (stmt.get_error_types ());
+		}
+
 		analyzer.current_symbol = old_symbol;
 		analyzer.insert_block = old_insert_block;
 
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index 1b8937e..b8341cd 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -1,6 +1,6 @@
 /* valaswitchstatement.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -118,6 +118,8 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 
 		foreach (SwitchSection section in sections) {
 			section.check (analyzer);
+
+			add_error_types (section.get_error_types ());
 		}
 
 		return !error;



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