diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-02-20 14:19:10 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-02-20 14:19:10 +0100 |
commit | a964a0ce124bf5f77e669376a31e3ecefd67cb97 (patch) | |
tree | c29c50dcd31e29386335a8d97811695617f688c7 /vala/valaswitchsection.vala | |
parent | 0d1b68487cc1707a719903631327e27a1b5d26b4 (diff) | |
download | vala-a964a0ce124bf5f77e669376a31e3ecefd67cb97.tar.gz |
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.
Diffstat (limited to 'vala/valaswitchsection.vala')
-rw-r--r-- | vala/valaswitchsection.vala | 31 |
1 files 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<DataType> 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; } |