From a964a0ce124bf5f77e669376a31e3ecefd67cb97 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Thu, 20 Feb 2020 14:19:10 +0100 Subject: [PATCH] vala: Rely on more implementations of Block in SwitchSection It was possible that statements in switch-sections were not processed by the semantic-analyzer. Therefore they were not checked for errors and marked as such. --- vala/valaswitchsection.vala | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/vala/valaswitchsection.vala b/vala/valaswitchsection.vala index aa57825a0..075feaa38 100644 --- a/vala/valaswitchsection.vala +++ b/vala/valaswitchsection.vala @@ -80,16 +80,7 @@ public class Vala.SwitchSection : Block { label.accept (visitor); } - foreach (Statement st in get_statements ()) { - st.accept (visitor); - } - } - - public override void get_error_types (Collection collection, SourceReference? source_reference = null) { - // use get_statements () instead of statement_list to not miss errors within StatementList objects - foreach (var stmt in get_statements ()) { - stmt.get_error_types (collection, source_reference); - } + base.accept_children (visitor); } public override bool check (CodeContext context) { @@ -97,29 +88,15 @@ public class Vala.SwitchSection : Block { return !error; } - checked = true; - foreach (SwitchLabel label in get_labels ()) { label.check (context); } - owner = context.analyzer.current_symbol.scope; - - var old_symbol = context.analyzer.current_symbol; - var old_insert_block = context.analyzer.insert_block; - context.analyzer.current_symbol = this; - context.analyzer.insert_block = this; - - foreach (Statement st in get_statements ()) { - st.check (context); + if (!base.check (context)) { + error = true; } - foreach (LocalVariable local in get_local_variables ()) { - local.active = false; - } - - context.analyzer.current_symbol = old_symbol; - context.analyzer.insert_block = old_insert_block; + checked = true; return !error; } -- 2.47.2