Commit 77859017 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Separate visiting switch sections from visiting switch statements

2008-11-30  Jürg Billeter  <j@bitron.ch>

	* 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
parent 91d30943
2008-11-30 Jürg Billeter <j@bitron.ch>
* 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 <j@bitron.ch>
* vala/valamemberaccess.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);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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) {
......
......@@ -73,8 +73,12 @@ public class Vala.SwitchStatement : CodeNode, Statement {
public Gee.List<SwitchSection> get_sections () {
return new ReadOnlyList<SwitchSection> (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) {
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment