From: Jürg Billeter Date: Sun, 30 Nov 2008 13:34:47 +0000 (+0000) Subject: Separate visiting switch sections from visiting switch statements X-Git-Tag: VALA_0_5_2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=778590173491eb9009700d7a0279df4e1382680c;p=thirdparty%2Fvala.git Separate visiting switch sections from visiting switch statements 2008-11-30 Jürg Billeter * vala/valanullchecker.vala: * vala/valaswitchlabel.vala: * vala/valaswitchstatement.vala: * vala/valasymbolresolver.vala: * gobject/valaccodecontrolflowmodule.vala: * gobject/valaccodegenerator.vala: * gobject/valaccodemodule.vala: Separate visiting switch sections from visiting switch statements svn path=/trunk/; revision=2098 --- diff --git a/ChangeLog b/ChangeLog index 4fc34f67a..74e90ba93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-11-30 Jürg Billeter + + * vala/valanullchecker.vala: + * vala/valaswitchlabel.vala: + * vala/valaswitchstatement.vala: + * vala/valasymbolresolver.vala: + * gobject/valaccodecontrolflowmodule.vala: + * gobject/valaccodegenerator.vala: + * gobject/valaccodemodule.vala: + + Separate visiting switch sections from visiting switch statements + 2008-11-30 Jürg Billeter * vala/valamemberaccess.vala: diff --git a/gobject/valaccodecontrolflowmodule.vala b/gobject/valaccodecontrolflowmodule.vala index bad51c28d..82621e9d3 100644 --- a/gobject/valaccodecontrolflowmodule.vala +++ b/gobject/valaccodecontrolflowmodule.vala @@ -177,6 +177,8 @@ public class Vala.CCodeControlFlowModule : CCodeMethodModule { } public override void visit_switch_statement (SwitchStatement stmt) { + stmt.accept_children (codegen); + if (stmt.expression.value_type.compatible (string_type)) { visit_string_switch_statement (stmt); return; @@ -212,6 +214,10 @@ public class Vala.CCodeControlFlowModule : CCodeMethodModule { visit_block (section); } + public override void visit_switch_label (SwitchLabel label) { + label.accept_children (codegen); + } + public override void visit_while_statement (WhileStatement stmt) { stmt.accept_children (codegen); diff --git a/gobject/valaccodegenerator.vala b/gobject/valaccodegenerator.vala index ca9f8a1b1..0f535d2cf 100644 --- a/gobject/valaccodegenerator.vala +++ b/gobject/valaccodegenerator.vala @@ -175,6 +175,10 @@ public class Vala.CCodeGenerator : CodeGenerator { head.visit_switch_section (section); } + public override void visit_switch_label (SwitchLabel label) { + head.visit_switch_label (label); + } + public override void visit_while_statement (WhileStatement stmt) { head.visit_while_statement (stmt); } diff --git a/gobject/valaccodemodule.vala b/gobject/valaccodemodule.vala index bc49962d4..a4adeb956 100644 --- a/gobject/valaccodemodule.vala +++ b/gobject/valaccodemodule.vala @@ -172,6 +172,10 @@ public abstract class Vala.CCodeModule { next.visit_switch_section (section); } + public virtual void visit_switch_label (SwitchLabel label) { + next.visit_switch_label (label); + } + public virtual void visit_while_statement (WhileStatement stmt) { next.visit_while_statement (stmt); } diff --git a/vala/valanullchecker.vala b/vala/valanullchecker.vala index 81c3b9e5c..d2ba8245d 100644 --- a/vala/valanullchecker.vala +++ b/vala/valanullchecker.vala @@ -144,6 +144,10 @@ public class Vala.NullChecker : CodeVisitor { check_non_null (stmt.condition); } + public override void visit_switch_statement (SwitchStatement stmt) { + stmt.accept_children (this); + } + public override void visit_switch_section (SwitchSection section) { section.accept_children (this); } diff --git a/vala/valaswitchlabel.vala b/vala/valaswitchlabel.vala index 34f2ae677..a778ce258 100644 --- a/vala/valaswitchlabel.vala +++ b/vala/valaswitchlabel.vala @@ -54,13 +54,15 @@ public class Vala.SwitchLabel : CodeNode { } public override void accept (CodeVisitor visitor) { + visitor.visit_switch_label (this); + } + + public override void accept_children (CodeVisitor visitor) { if (expression != null) { expression.accept (visitor); visitor.visit_end_full_expression (expression); } - - visitor.visit_switch_label (this); } public override bool check (SemanticAnalyzer analyzer) { diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala index 559c94259..e3c272752 100644 --- a/vala/valaswitchstatement.vala +++ b/vala/valaswitchstatement.vala @@ -73,8 +73,12 @@ public class Vala.SwitchStatement : CodeNode, Statement { public Gee.List get_sections () { return new ReadOnlyList (sections); } - + public override void accept (CodeVisitor visitor) { + visitor.visit_switch_statement (this); + } + + public override void accept_children (CodeVisitor visitor) { expression.accept (visitor); visitor.visit_end_full_expression (expression); @@ -82,8 +86,6 @@ public class Vala.SwitchStatement : CodeNode, Statement { foreach (SwitchSection section in sections) { section.accept (visitor); } - - visitor.visit_switch_statement (this); } public override void replace_expression (Expression old_node, Expression new_node) { diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala index 2197df002..ff0cb9346 100644 --- a/vala/valasymbolresolver.vala +++ b/vala/valasymbolresolver.vala @@ -346,6 +346,10 @@ public class Vala.SymbolResolver : CodeVisitor { stmt.accept_children (this); } + public override void visit_switch_statement (SwitchStatement stmt) { + stmt.accept_children (this); + } + public override void visit_switch_section (SwitchSection section) { section.accept_children (this); }