]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix error handling checks in switch statements
authorJürg Billeter <j@bitron.ch>
Wed, 10 Feb 2010 14:38:02 +0000 (15:38 +0100)
committerJürg Billeter <j@bitron.ch>
Wed, 10 Feb 2010 14:38:02 +0000 (15:38 +0100)
vala/valaswitchsection.vala
vala/valaswitchstatement.vala

index 7b7cc95446b9f9dd1f996d56350da7149dc11502..334f6a7e8748d3ecd6e48e58ffb631c0aea0591c 100644 (file)
@@ -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;
 
index 1b8937ed261f1f35d45f911cdc78a47ee145d89a..b8341cd5f2bf3612d1ff3c16f8643e338ed60550 100644 (file)
@@ -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;