[vala] Use emit instead of accept and accept_children in code generator



commit 8b57dfaf55208cad985cb6ff023aed0c3841d876
Author: Jürg Billeter <j bitron ch>
Date:   Sat Aug 7 16:50:40 2010 +0200

    Use emit instead of accept and accept_children in code generator

 codegen/valaccodearraymodule.vala         |   12 +-----
 codegen/valaccodeassignmentmodule.vala    |    4 +-
 codegen/valaccodebasemodule.vala          |   71 ++++++++++-------------------
 codegen/valaccodecontrolflowmodule.vala   |   27 ++++++-----
 codegen/valaccodememberaccessmodule.vala  |   16 ++++++-
 codegen/valaccodemethodcallmodule.vala    |    2 -
 codegen/valaccodemethodmodule.vala        |   24 +++++++++-
 codegen/valadbusclientmodule.vala         |   20 ++++----
 codegen/valadbusservermodule.vala         |    2 -
 codegen/valadovaarraymodule.vala          |    4 --
 codegen/valadovaassignmentmodule.vala     |    2 -
 codegen/valadovabasemodule.vala           |   43 +++++++-----------
 codegen/valadovacontrolflowmodule.vala    |   21 +++++---
 codegen/valadovaerrormodule.vala          |   14 ++----
 codegen/valadovamemberaccessmodule.vala   |    2 -
 codegen/valadovamethodcallmodule.vala     |    2 -
 codegen/valadovaobjectmodule.vala         |   30 +++++++++++-
 codegen/valadovavaluemodule.vala          |    8 ---
 codegen/valagasyncmodule.vala             |    2 -
 codegen/valagdbusclientmodule.vala        |    8 ++--
 codegen/valagdbusservermodule.vala        |    2 -
 codegen/valagerrormodule.vala             |   18 +++-----
 codegen/valagobjectmodule.vala            |    2 +-
 codegen/valagsignalmodule.vala            |   10 +----
 vala/valaaddressofexpression.vala         |   10 ++++-
 vala/valaarraycreationexpression.vala     |   14 ++++++
 vala/valaassignment.vala                  |   31 +++++++++++++
 vala/valabaseaccess.vala                  |    6 +++
 vala/valabinaryexpression.vala            |   11 +++++
 vala/valablock.vala                       |    4 ++
 vala/valabooleanliteral.vala              |    8 +++-
 vala/valabreakstatement.vala              |    6 ++-
 vala/valacastexpression.vala              |    8 +++
 vala/valacatchclause.vala                 |   10 ++++-
 vala/valacharacterliteral.vala            |    6 +++
 vala/valacodegenerator.vala               |    4 +-
 vala/valacodenode.vala                    |    3 +
 vala/valacontinuestatement.vala           |    6 ++-
 vala/valadeclarationstatement.vala        |    6 ++-
 vala/valadeletestatement.vala             |   10 +++-
 vala/valaelementaccess.vala               |   11 +++++
 vala/valaemptystatement.vala              |    6 ++-
 vala/valaexpressionstatement.vala         |    6 +++
 vala/valaforeachstatement.vala            |   18 +++++++
 vala/valaifstatement.vala                 |    8 +++
 vala/valainitializerlist.vala             |   10 ++++-
 vala/valaintegerliteral.vala              |    6 +++
 vala/valalambdaexpression.vala            |    6 +++
 vala/valalistliteral.vala                 |   10 ++++
 vala/valalockstatement.vala               |    8 +++-
 vala/valaloop.vala                        |    6 ++-
 vala/valamapliteral.vala                  |   11 +++++
 vala/valamemberaccess.vala                |   10 ++++
 vala/valamemberinitializer.vala           |    6 ++-
 vala/valamethodcall.vala                  |   19 ++++++++
 vala/valanamedargument.vala               |    8 +++
 vala/valanullliteral.vala                 |    8 +++-
 vala/valaobjectcreationexpression.vala    |   14 ++++++
 vala/valapointerindirection.vala          |   10 ++++-
 vala/valapostfixexpression.vala           |   10 ++++-
 vala/valarealliteral.vala                 |    6 +++
 vala/valareferencetransferexpression.vala |   10 ++++-
 vala/valaregexliteral.vala                |    7 +++
 vala/valareturnstatement.vala             |   12 +++++-
 vala/valasetliteral.vala                  |   10 ++++
 vala/valasizeofexpression.vala            |    8 +++-
 vala/valasliceexpression.vala             |   13 +++++-
 vala/valastatementlist.vala               |    8 +++-
 vala/valastringliteral.vala               |    6 +++
 vala/valaswitchlabel.vala                 |    6 ++-
 vala/valaswitchsection.vala               |    8 +++
 vala/valaswitchstatement.vala             |    8 +++
 vala/valathrowstatement.vala              |   10 ++++
 vala/valatrystatement.vala                |    4 ++
 vala/valatuple.vala                       |   10 ++++
 vala/valatypecheck.vala                   |   10 ++++-
 vala/valatypeofexpression.vala            |    8 +++-
 vala/valaunaryexpression.vala             |    8 +++
 vala/valaunlockstatement.vala             |    8 +++-
 vala/valayieldstatement.vala              |   12 +++++-
 80 files changed, 638 insertions(+), 214 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 21c9651..c2c2daf 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -1,6 +1,6 @@
 /* valaccodearraymodule.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -43,8 +43,6 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 	}
 
 	public override void visit_array_creation_expression (ArrayCreationExpression expr) {
-		expr.accept_children (codegen);
-
 		var array_type = expr.target_type as ArrayType;
 		if (array_type != null && array_type.fixed_length) {
 			// no heap allocation for fixed-length arrays
@@ -400,8 +398,6 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 	}
 
 	public override void visit_element_access (ElementAccess expr) {
-		expr.accept_children (codegen);
-
 		List<Expression> indices = expr.get_indices ();
 		int rank = indices.size;
 
@@ -442,8 +438,6 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 	}
 
 	public override void visit_slice_expression (SliceExpression expr) {
-		expr.accept_children (codegen);
-
 		var ccontainer = (CCodeExpression) expr.container.ccodenode;
 		var cstart = (CCodeExpression) expr.start.ccodenode;
 		var cstop = (CCodeExpression) expr.stop.ccodenode;
@@ -1004,10 +998,6 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 		var array_type = (ArrayType) array.value_type;
 		var element = binary.right;
 
-		array.accept (codegen);
-		element.target_type = array_type.element_type.copy ();
-		element.accept (codegen);
-
 		var value_param = new FormalParameter ("value", element.target_type);
 
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_array_add_wrapper (array_type)));
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index a4054de..1a9dca1 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -1,6 +1,6 @@
 /* valaccodeassignmentmodule.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -232,8 +232,6 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
 	}
 
 	public override void visit_assignment (Assignment assignment) {
-		assignment.right.accept (codegen);
-
 		if (assignment.left.error || assignment.right.error) {
 			assignment.error = true;
 			return;
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index a30d6de..19e18c7 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -693,7 +693,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
 					flag_shift += 1;
 				}
 			} else {
-				ev.value.accept (codegen);
+				ev.value.emit (codegen);
 				c_ev = new CCodeEnumValue (ev.get_cname (), (CCodeExpression) ev.value.ccodenode);
 			}
 			c_ev.deprecated = ev.deprecated;
@@ -782,11 +782,11 @@ public class Vala.CCodeBaseModule : CCodeModule {
 			return;
 		}
 
-		c.accept_children (codegen);
-
 		if (!c.external) {
 			generate_type_declaration (c.type_reference, decl_space);
 
+			c.value.emit (codegen);
+
 			var initializer_list = c.value as InitializerList;
 			if (initializer_list != null) {
 				var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
@@ -916,7 +916,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
 
 		check_type (f.variable_type);
 
-		f.accept_children (codegen);
+		if (f.initializer != null) {
+			f.initializer.emit (codegen);
+		}
 
 		var cl = f.parent_symbol as Class;
 		bool is_gtypeinstance = (cl != null && !cl.is_compact);
@@ -1366,7 +1368,13 @@ public class Vala.CCodeBaseModule : CCodeModule {
 
 		bool returns_real_struct = acc.readable && prop.property_type.is_real_non_null_struct_type ();
 
-		acc.accept_children (codegen);
+		if (acc.result_var != null) {
+			acc.result_var.accept (codegen);
+		}
+
+		if (acc.body != null) {
+			acc.body.emit (codegen);
+		}
 
 		var t = (TypeSymbol) prop.parent_symbol;
 
@@ -1612,7 +1620,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
 		bool old_method_inner_error = current_method_inner_error;
 		current_method_inner_error = false;
 
-		d.accept_children (codegen);
+		d.body.emit (codegen);
 
 		if (d.binding == MemberBinding.STATIC && !in_plugin) {
 			Report.error (d.source_reference, "static destructors are only supported for dynamic types");
@@ -1707,7 +1715,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
 		var old_symbol = current_symbol;
 		current_symbol = b;
 
-		b.accept_children (codegen);
+		foreach (Statement stmt in b.get_statements ()) {
+			stmt.emit (codegen);
+		}
 
 		var local_vars = b.get_local_variables ();
 		foreach (LocalVariable local in local_vars) {
@@ -2003,7 +2013,11 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	public override void visit_local_variable (LocalVariable local) {
 		check_type (local.variable_type);
 
-		local.accept_children (codegen);
+		if (local.initializer != null) {
+			local.initializer.emit (codegen);
+
+			visit_end_full_expression (local.initializer);
+		}
 
 		generate_type_declaration (local.variable_type, source_declarations);
 
@@ -2212,8 +2226,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_initializer_list (InitializerList list) {
-		list.accept_children (codegen);
-
 		if (list.target_type.data_type is Struct) {
 			/* initializer is used as struct initializer */
 			var st = (Struct) list.target_type.data_type;
@@ -3164,8 +3176,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_expression_statement (ExpressionStatement stmt) {
-		stmt.accept_children (codegen);
-
 		if (stmt.expression.error) {
 			stmt.error = true;
 			return;
@@ -3317,7 +3327,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
 		stmt.ccodenode = cfrag;
 	}
 
-	public virtual bool variable_accessible_in_finally (LocalVariable local) {
+	public bool variable_accessible_in_finally (LocalVariable local) {
 		if (current_try == null) {
 			return false;
 		}
@@ -3338,23 +3348,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_return_statement (ReturnStatement stmt) {
-		// avoid unnecessary ref/unref pair
-		if (stmt.return_expression != null) {
-			var local = stmt.return_expression.symbol_reference as LocalVariable;
-			if (current_return_type.value_owned
-			    && local != null && local.variable_type.value_owned
-			    && !local.captured
-			    && !variable_accessible_in_finally (local)) {
-				/* return expression is local variable taking ownership and
-				 * current method is transferring ownership */
-
-				// don't ref expression
-				stmt.return_expression.value_type.value_owned = true;
-			}
-		}
-
-		stmt.accept_children (codegen);
-
 		Symbol return_expression_symbol = null;
 
 		if (stmt.return_expression != null) {
@@ -3367,9 +3360,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
 				/* return expression is local variable taking ownership and
 				 * current method is transferring ownership */
 
-				// don't unref variable
 				return_expression_symbol = local;
-				return_expression_symbol.active = false;
 			}
 		}
 
@@ -3540,8 +3531,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_delete_statement (DeleteStatement stmt) {
-		stmt.accept_children (codegen);
-
 		var pointer_type = (PointerType) stmt.expression.value_type;
 		DataType type = pointer_type;
 		if (pointer_type.base_type.data_type != null && pointer_type.base_type.data_type.is_reference_type ()) {
@@ -4140,8 +4129,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_object_creation_expression (ObjectCreationExpression expr) {
-		expr.accept_children (codegen);
-
 		CCodeExpression instance = null;
 		CCodeExpression creation_expr = null;
 
@@ -4298,7 +4285,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
 				/* evaluate default expression here as the code
 				 * generator might not have visited the formal
 				 * parameter yet */
-				param.initializer.accept (codegen);
+				param.initializer.emit (codegen);
 			
 				carg_map.set (get_param_pos (param.cparameter_position), (CCodeExpression) param.initializer.ccodenode);
 				i++;
@@ -4483,8 +4470,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_unary_expression (UnaryExpression expr) {
-		expr.accept_children (codegen);
-
 		CCodeUnaryOperator op;
 		if (expr.operator == UnaryOperator.PLUS) {
 			op = CCodeUnaryOperator.PLUS;
@@ -4675,8 +4660,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 	
 	public override void visit_named_argument (NamedArgument expr) {
-		expr.accept_children (codegen);
-
 		expr.ccodenode = expr.inner.ccodenode;
 	}
 
@@ -4697,8 +4680,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_reference_transfer_expression (ReferenceTransferExpression expr) {
-		expr.accept_children (codegen);
-
 		/* (tmp = var, var = null, tmp) */
 		var ccomma = new CCodeCommaExpression ();
 		var temp_decl = get_temp_variable (expr.value_type, true, expr, false);
@@ -4712,8 +4693,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
 	}
 
 	public override void visit_binary_expression (BinaryExpression expr) {
-		expr.accept_children (codegen);
-
 		var cleft = (CCodeExpression) expr.left.ccodenode;
 		var cright = (CCodeExpression) expr.right.ccodenode;
 
@@ -5587,7 +5566,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
 
 	public CCodeNode? get_ccodenode (CodeNode node) {
 		if (node.ccodenode == null) {
-			node.accept (codegen);
+			node.emit (codegen);
 		}
 		return node.ccodenode;
 	}
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index 8132c9d..b6d9ca5 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -30,7 +30,10 @@ public class Vala.CCodeControlFlowModule : CCodeMethodModule {
 	}
 
 	public override void visit_if_statement (IfStatement stmt) {
-		stmt.accept_children (codegen);
+		stmt.true_statement.emit (codegen);
+		if (stmt.false_statement != null) {
+			stmt.false_statement.emit (codegen);
+		}
 
 		if (stmt.false_statement != null) {
 			stmt.ccodenode = new CCodeIfStatement ((CCodeExpression) stmt.condition.ccodenode, (CCodeStatement) stmt.true_statement.ccodenode, (CCodeStatement) stmt.false_statement.ccodenode);
@@ -189,7 +192,9 @@ public class Vala.CCodeControlFlowModule : CCodeMethodModule {
 	}
 
 	public override void visit_switch_statement (SwitchStatement stmt) {
-		stmt.accept_children (codegen);
+		foreach (SwitchSection section in stmt.get_sections ()) {
+			section.emit (codegen);
+		}
 
 		if (stmt.expression.value_type.compatible (string_type)) {
 			visit_string_switch_statement (stmt);
@@ -220,16 +225,16 @@ public class Vala.CCodeControlFlowModule : CCodeMethodModule {
 		create_temp_decl (stmt, stmt.expression.temp_vars);
 	}
 
-	public override void visit_switch_section (SwitchSection section) {
-		visit_block (section);
-	}
-
 	public override void visit_switch_label (SwitchLabel label) {
-		label.accept_children (codegen);
+		if (label.expression != null) {
+			label.expression.emit (codegen);
+
+			codegen.visit_end_full_expression (label.expression);
+		}
 	}
 
 	public override void visit_loop (Loop stmt) {
-		stmt.accept_children (codegen);
+		stmt.body.emit (codegen);
 
 		if (context.profile == Profile.GOBJECT) {
 			stmt.ccodenode = new CCodeWhileStatement (new CCodeConstant ("TRUE"), (CCodeStatement) stmt.body.ccodenode);
@@ -240,11 +245,7 @@ public class Vala.CCodeControlFlowModule : CCodeMethodModule {
 	}
 
 	public override void visit_foreach_statement (ForeachStatement stmt) {
-		stmt.element_variable.active = true;
-		stmt.collection_variable.active = true;
-		if (stmt.iterator_variable != null) {
-			stmt.iterator_variable.active = true;
-		}
+		stmt.body.emit (codegen);
 
 		visit_block (stmt);
 
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 52ea34d..6e8ff0c 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -30,8 +30,6 @@ public class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 	}
 
 	public override void visit_member_access (MemberAccess expr) {
-		expr.accept_children (codegen);
-
 		CCodeExpression pub_inst = null;
 		DataType base_type = null;
 	
@@ -368,6 +366,20 @@ public class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 				expr.ccodenode = new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), get_variable_cname (local.name));
 			} else {
 				expr.ccodenode = get_variable_cexpression (local.name);
+
+				if (expr.parent_node is ReturnStatement &&
+				    current_return_type.value_owned &&
+				    local.variable_type.value_owned &&
+				    !variable_accessible_in_finally (local)) {
+					/* return expression is local variable taking ownership and
+					 * current method is transferring ownership */
+
+					// don't ref expression
+					expr.value_type.value_owned = true;
+
+					// don't unref variable
+					local.active = false;
+				}
 			}
 		} else if (expr.symbol_reference is FormalParameter) {
 			var p = (FormalParameter) expr.symbol_reference;
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 2f2306b..c118700 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -30,8 +30,6 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 	}
 
 	public override void visit_method_call (MethodCall expr) {
-		expr.accept_children (codegen);
-
 		// the bare function call
 		var ccall = new CCodeFunctionCall ((CCodeExpression) expr.call.ccodenode);
 
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 2bf5785..71836cf 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -316,7 +316,29 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
 		if (m.binding == MemberBinding.CLASS || m.binding == MemberBinding.STATIC) {
 			in_static_or_class_context = true;
 		}
-		m.accept_children (codegen);
+
+
+		foreach (FormalParameter param in m.get_parameters ()) {
+			param.accept (codegen);
+		}
+
+		if (m.result_var != null) {
+			m.result_var.accept (codegen);
+		}
+
+		foreach (Expression precondition in m.get_preconditions ()) {
+			precondition.emit (codegen);
+		}
+
+		foreach (Expression postcondition in m.get_postconditions ()) {
+			postcondition.emit (codegen);
+		}
+
+		if (m.body != null) {
+			m.body.emit (codegen);
+		}
+
+
 		in_static_or_class_context = false;
 
 		if (m is CreationMethod) {
diff --git a/codegen/valadbusclientmodule.vala b/codegen/valadbusclientmodule.vala
index cb9ff5d..9593ff6 100644
--- a/codegen/valadbusclientmodule.vala
+++ b/codegen/valadbusclientmodule.vala
@@ -927,11 +927,11 @@ public class Vala.DBusClientModule : DBusModule {
 		Expression object_path = args.get (1);
 
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier (type.type_symbol.get_lower_case_cprefix () + "dbus_proxy_new"));
-		connection.accept (codegen);
+		connection.emit (codegen);
 		ccall.add_argument ((CCodeExpression) connection.ccodenode);
-		bus_name.accept (codegen);
+		bus_name.emit (codegen);
 		ccall.add_argument ((CCodeExpression) bus_name.ccodenode);
-		object_path.accept (codegen);
+		object_path.emit (codegen);
 		ccall.add_argument ((CCodeExpression) object_path.ccodenode);
 		expr.ccodenode = ccall;
 	}
@@ -1413,11 +1413,11 @@ public class Vala.DBusClientModule : DBusModule {
 		if (proxy_get_all) {
 			var ma = expr.call as MemberAccess;
 			var instance = ma.inner;
-			instance.accept (codegen);
+			instance.emit (codegen);
 
 			var args = expr.get_argument_list ();
 			Expression interface_name = args.get (0);
-			interface_name.accept (codegen);
+			interface_name.emit (codegen);
 
 			var ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_get_all_function (mtype.method_symbol)));
 			ccall.add_argument ((CCodeExpression) instance.ccodenode);
@@ -1441,7 +1441,7 @@ public class Vala.DBusClientModule : DBusModule {
 		quark_call.add_argument (new CCodeConstant ("\"ValaDBusInterfaceProxyType\""));
 
 		var qdata_call = new CCodeFunctionCall (new CCodeIdentifier ("g_type_get_qdata"));
-		type.accept (codegen);
+		type.emit (codegen);
 		qdata_call.add_argument ((CCodeExpression) type.ccodenode);
 		qdata_call.add_argument (quark_call);
 
@@ -1450,16 +1450,16 @@ public class Vala.DBusClientModule : DBusModule {
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_new"));
 		ccall.add_argument (get_type_call);
 		ccall.add_argument (new CCodeConstant ("\"connection\""));
-		connection.accept (codegen);
+		connection.emit (codegen);
 		ccall.add_argument ((CCodeExpression) connection.ccodenode);
 		ccall.add_argument (new CCodeConstant ("\"name\""));
-		bus_name.accept (codegen);
+		bus_name.emit (codegen);
 		ccall.add_argument ((CCodeExpression) bus_name.ccodenode);
 		ccall.add_argument (new CCodeConstant ("\"path\""));
-		object_path.accept (codegen);
+		object_path.emit (codegen);
 		ccall.add_argument ((CCodeExpression) object_path.ccodenode);
 		ccall.add_argument (new CCodeConstant ("\"interface\""));
-		interface_name.accept (codegen);
+		interface_name.emit (codegen);
 		ccall.add_argument ((CCodeExpression) interface_name.ccodenode);
 		ccall.add_argument (new CCodeConstant ("NULL"));
 		expr.ccodenode = ccall;
diff --git a/codegen/valadbusservermodule.vala b/codegen/valadbusservermodule.vala
index 54f6474..a872303 100644
--- a/codegen/valadbusservermodule.vala
+++ b/codegen/valadbusservermodule.vala
@@ -1637,8 +1637,6 @@ public class Vala.DBusServerModule : DBusClientModule {
 
 		add_dbus_helpers ();
 
-		expr.accept_children (codegen);
-
 		var ma = (MemberAccess) expr.call;
 
 		var raw_conn = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_connection_get_connection"));
diff --git a/codegen/valadovaarraymodule.vala b/codegen/valadovaarraymodule.vala
index d8b4e51..c532d17 100644
--- a/codegen/valadovaarraymodule.vala
+++ b/codegen/valadovaarraymodule.vala
@@ -33,8 +33,6 @@ internal class Vala.DovaArrayModule : DovaMethodCallModule {
 	}
 
 	public override void visit_array_creation_expression (ArrayCreationExpression expr) {
-		expr.accept_children (codegen);
-
 		var array_type = expr.target_type as ArrayType;
 		if (array_type != null && array_type.fixed_length) {
 			// no heap allocation for fixed-length arrays
@@ -67,8 +65,6 @@ internal class Vala.DovaArrayModule : DovaMethodCallModule {
 	}
 
 	public override void visit_element_access (ElementAccess expr) {
-		expr.accept_children (codegen);
-
 		List<Expression> indices = expr.get_indices ();
 
 		var ccontainer = (CCodeExpression) expr.container.ccodenode;
diff --git a/codegen/valadovaassignmentmodule.vala b/codegen/valadovaassignmentmodule.vala
index 17fcfc5..f1667de 100644
--- a/codegen/valadovaassignmentmodule.vala
+++ b/codegen/valadovaassignmentmodule.vala
@@ -175,8 +175,6 @@ internal class Vala.DovaAssignmentModule : DovaMemberAccessModule {
 	}
 
 	public override void visit_assignment (Assignment assignment) {
-		assignment.right.accept (codegen);
-
 		if (assignment.left.error || assignment.right.error) {
 			assignment.error = true;
 			return;
diff --git a/codegen/valadovabasemodule.vala b/codegen/valadovabasemodule.vala
index 79a8198..cbb85c6 100644
--- a/codegen/valadovabasemodule.vala
+++ b/codegen/valadovabasemodule.vala
@@ -376,7 +376,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
 			if (ev.value == null) {
 				cenum.add_value (new CCodeEnumValue (ev.get_cname ()));
 			} else {
-				ev.value.accept (codegen);
+				ev.value.emit (codegen);
 				cenum.add_value (new CCodeEnumValue (ev.get_cname (), (CCodeExpression) ev.value.ccodenode));
 			}
 		}
@@ -400,9 +400,9 @@ internal class Vala.DovaBaseModule : CCodeModule {
 			return;
 		}
 
-		c.accept_children (codegen);
-
 		if (!c.external) {
+			c.value.emit (codegen);
+
 			if (c.value is InitializerList) {
 				var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
 				var arr = "";
@@ -456,7 +456,9 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_field (Field f) {
-		f.accept_children (codegen);
+		if (f.initializer != null) {
+			f.initializer.emit (codegen);
+		}
 
 		var cl = f.parent_symbol as Class;
 
@@ -591,7 +593,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_formal_parameter (FormalParameter p) {
-		p.accept_children (codegen);
 	}
 
 	public override void visit_property (Property prop) {
@@ -656,7 +657,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_destructor (Destructor d) {
-		d.accept_children (codegen);
+		d.body.emit (codegen);
 
 		CCodeFragment cfrag = new CCodeFragment ();
 
@@ -707,7 +708,9 @@ internal class Vala.DovaBaseModule : CCodeModule {
 		var old_symbol = current_symbol;
 		current_symbol = b;
 
-		b.accept_children (codegen);
+		foreach (Statement stmt in b.get_statements ()) {
+			stmt.emit (codegen);
+		}
 
 		var local_vars = b.get_local_variables ();
 		foreach (LocalVariable local in local_vars) {
@@ -954,7 +957,11 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_local_variable (LocalVariable local) {
-		local.accept_children (codegen);
+		if (local.initializer != null) {
+			local.initializer.emit (codegen);
+
+			visit_end_full_expression (local.initializer);
+		}
 
 		generate_type_declaration (local.variable_type, source_declarations);
 
@@ -999,8 +1006,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_initializer_list (InitializerList list) {
-		list.accept_children (codegen);
-
 		if (list.target_type.data_type is Struct) {
 			/* initializer is used as struct initializer */
 			var st = (Struct) list.target_type.data_type;
@@ -1310,8 +1315,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_expression_statement (ExpressionStatement stmt) {
-		stmt.accept_children (codegen);
-
 		if (stmt.expression.error) {
 			stmt.error = true;
 			return;
@@ -1467,8 +1470,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_return_statement (ReturnStatement stmt) {
-		stmt.accept_children (codegen);
-
 		var cfrag = new CCodeFragment ();
 
 		// free local variables
@@ -1480,8 +1481,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_delete_statement (DeleteStatement stmt) {
-		stmt.accept_children (codegen);
-
 		var pointer_type = (PointerType) stmt.expression.value_type;
 		DataType type = pointer_type;
 		if (pointer_type.base_type.data_type != null && pointer_type.base_type.data_type.is_reference_type ()) {
@@ -1744,8 +1743,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_object_creation_expression (ObjectCreationExpression expr) {
-		expr.accept_children (codegen);
-
 		CCodeExpression instance = null;
 		CCodeExpression creation_expr = null;
 
@@ -1837,7 +1834,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
 				/* evaluate default expression here as the code
 				 * generator might not have visited the formal
 				 * parameter yet */
-				param.initializer.accept (codegen);
+				param.initializer.emit (codegen);
 
 				creation_call.add_argument ((CCodeExpression) param.initializer.ccodenode);
 				i++;
@@ -1944,8 +1941,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_unary_expression (UnaryExpression expr) {
-		expr.accept_children (codegen);
-
 		CCodeUnaryOperator op;
 		if (expr.operator == UnaryOperator.PLUS) {
 			op = CCodeUnaryOperator.PLUS;
@@ -2036,8 +2031,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_reference_transfer_expression (ReferenceTransferExpression expr) {
-		expr.accept_children (codegen);
-
 		/* (tmp = var, var = null, tmp) */
 		var ccomma = new CCodeCommaExpression ();
 		var temp_decl = get_temp_variable (expr.value_type, true, expr);
@@ -2051,8 +2044,6 @@ internal class Vala.DovaBaseModule : CCodeModule {
 	}
 
 	public override void visit_binary_expression (BinaryExpression expr) {
-		expr.accept_children (codegen);
-
 		var cleft = (CCodeExpression) expr.left.ccodenode;
 		var cright = (CCodeExpression) expr.right.ccodenode;
 
@@ -2441,7 +2432,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
 
 	public CCodeNode? get_ccodenode (CodeNode node) {
 		if (node.ccodenode == null) {
-			node.accept (codegen);
+			node.emit (codegen);
 		}
 		return node.ccodenode;
 	}
diff --git a/codegen/valadovacontrolflowmodule.vala b/codegen/valadovacontrolflowmodule.vala
index ab142cb..f75368c 100644
--- a/codegen/valadovacontrolflowmodule.vala
+++ b/codegen/valadovacontrolflowmodule.vala
@@ -26,7 +26,10 @@ internal class Vala.DovaControlFlowModule : DovaMethodModule {
 	}
 
 	public override void visit_if_statement (IfStatement stmt) {
-		stmt.accept_children (codegen);
+		stmt.true_statement.emit (codegen);
+		if (stmt.false_statement != null) {
+			stmt.false_statement.emit (codegen);
+		}
 
 		if (stmt.false_statement != null) {
 			stmt.ccodenode = new CCodeIfStatement ((CCodeExpression) stmt.condition.ccodenode, (CCodeStatement) stmt.true_statement.ccodenode, (CCodeStatement) stmt.false_statement.ccodenode);
@@ -38,7 +41,9 @@ internal class Vala.DovaControlFlowModule : DovaMethodModule {
 	}
 
 	public override void visit_switch_statement (SwitchStatement stmt) {
-		stmt.accept_children (codegen);
+		foreach (SwitchSection section in stmt.get_sections ()) {
+			section.emit (codegen);
+		}
 
 		var cswitch = new CCodeSwitchStatement ((CCodeExpression) stmt.expression.ccodenode);
 		stmt.ccodenode = cswitch;
@@ -68,16 +73,16 @@ internal class Vala.DovaControlFlowModule : DovaMethodModule {
 		create_temp_decl (stmt, stmt.expression.temp_vars);
 	}
 
-	public override void visit_switch_section (SwitchSection section) {
-		visit_block (section);
-	}
-
 	public override void visit_switch_label (SwitchLabel label) {
-		label.accept_children (codegen);
+		if (label.expression != null) {
+			label.expression.emit (codegen);
+
+			codegen.visit_end_full_expression (label.expression);
+		}
 	}
 
 	public override void visit_loop (Loop stmt) {
-		stmt.accept_children (codegen);
+		stmt.body.emit (codegen);
 
 		stmt.ccodenode = new CCodeWhileStatement (new CCodeConstant ("true"), (CCodeStatement) stmt.body.ccodenode);
 	}
diff --git a/codegen/valadovaerrormodule.vala b/codegen/valadovaerrormodule.vala
index 13c6936..ecee398 100644
--- a/codegen/valadovaerrormodule.vala
+++ b/codegen/valadovaerrormodule.vala
@@ -33,8 +33,6 @@ internal class Vala.DovaErrorModule : DovaDelegateModule {
 	}
 
 	public override void visit_throw_statement (ThrowStatement stmt) {
-		stmt.accept_children (codegen);
-
 		var cfrag = new CCodeFragment ();
 
 		// method will fail
@@ -242,15 +240,15 @@ internal class Vala.DovaErrorModule : DovaDelegateModule {
 		}
 
 		if (stmt.finally_body != null) {
-			stmt.finally_body.accept (codegen);
+			stmt.finally_body.emit (codegen);
 		}
 
 		is_in_catch = false;
-		stmt.body.accept (codegen);
+		stmt.body.emit (codegen);
 		is_in_catch = true;
 
 		foreach (CatchClause clause in stmt.get_catch_clauses ()) {
-			clause.accept (codegen);
+			clause.emit (codegen);
 		}
 
 		current_try = old_try;
@@ -278,13 +276,9 @@ internal class Vala.DovaErrorModule : DovaDelegateModule {
 	}
 
 	public override void visit_catch_clause (CatchClause clause) {
-		if (clause.error_variable != null) {
-			clause.error_variable.active = true;
-		}
-
 		generate_type_declaration (clause.error_type, source_declarations);
 
-		clause.accept_children (codegen);
+		clause.body.emit (codegen);
 
 		var cfrag = new CCodeFragment ();
 		cfrag.append (new CCodeLabel (clause.clabel_name));
diff --git a/codegen/valadovamemberaccessmodule.vala b/codegen/valadovamemberaccessmodule.vala
index 3785932..58fb664 100644
--- a/codegen/valadovamemberaccessmodule.vala
+++ b/codegen/valadovamemberaccessmodule.vala
@@ -28,8 +28,6 @@ internal class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 	}
 
 	public override void visit_member_access (MemberAccess expr) {
-		expr.accept_children (codegen);
-
 		CCodeExpression pub_inst = null;
 		DataType base_type = null;
 
diff --git a/codegen/valadovamethodcallmodule.vala b/codegen/valadovamethodcallmodule.vala
index ed4d571..aab0f3b 100644
--- a/codegen/valadovamethodcallmodule.vala
+++ b/codegen/valadovamethodcallmodule.vala
@@ -26,8 +26,6 @@ internal class Vala.DovaMethodCallModule : DovaAssignmentModule {
 	}
 
 	public override void visit_method_call (MethodCall expr) {
-		expr.accept_children (codegen);
-
 		// the bare function call
 		var ccall = new CCodeFunctionCall ((CCodeExpression) expr.call.ccodenode);
 
diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala
index 175a176..ed1f933 100644
--- a/codegen/valadovaobjectmodule.vala
+++ b/codegen/valadovaobjectmodule.vala
@@ -1144,7 +1144,13 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
 
 		var prop = (Property) acc.prop;
 
-		acc.accept_children (codegen);
+		if (acc.result_var != null) {
+			acc.result_var.accept (codegen);
+		}
+
+		if (acc.body != null) {
+			acc.body.emit (codegen);
+		}
 
 		// do not declare overriding properties and interface implementations
 		if (prop.is_abstract || prop.is_virtual
@@ -1383,7 +1389,27 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
 		variable_name_map = new HashMap<string,string> (str_hash, str_equal);
 		current_try = null;
 
-		m.accept_children (codegen);
+
+		foreach (FormalParameter param in m.get_parameters ()) {
+			param.accept (codegen);
+		}
+
+		if (m.result_var != null) {
+			m.result_var.accept (codegen);
+		}
+
+		foreach (Expression precondition in m.get_preconditions ()) {
+			precondition.emit (codegen);
+		}
+
+		foreach (Expression postcondition in m.get_postconditions ()) {
+			postcondition.emit (codegen);
+		}
+
+		if (m.body != null) {
+			m.body.emit (codegen);
+		}
+
 
 		current_symbol = old_symbol;
 		next_temp_var_id = old_next_temp_var_id;
diff --git a/codegen/valadovavaluemodule.vala b/codegen/valadovavaluemodule.vala
index cabf73b..ac3b614 100644
--- a/codegen/valadovavaluemodule.vala
+++ b/codegen/valadovavaluemodule.vala
@@ -539,8 +539,6 @@ internal class Vala.DovaValueModule : DovaObjectModule {
 	}
 
 	public override void visit_list_literal (ListLiteral expr) {
-		expr.accept_children (codegen);
-
 		var ce = new CCodeCommaExpression ();
 		int length = expr.get_expressions ().size;
 
@@ -575,8 +573,6 @@ internal class Vala.DovaValueModule : DovaObjectModule {
 	}
 
 	public override void visit_set_literal (SetLiteral expr) {
-		expr.accept_children (codegen);
-
 		var ce = new CCodeCommaExpression ();
 		int length = expr.get_expressions ().size;
 
@@ -611,8 +607,6 @@ internal class Vala.DovaValueModule : DovaObjectModule {
 	}
 
 	public override void visit_map_literal (MapLiteral expr) {
-		expr.accept_children (codegen);
-
 		var key_ce = new CCodeCommaExpression ();
 		var value_ce = new CCodeCommaExpression ();
 		int length = expr.get_keys ().size;
@@ -661,8 +655,6 @@ internal class Vala.DovaValueModule : DovaObjectModule {
 	}
 
 	public override void visit_tuple (Tuple tuple) {
-		tuple.accept_children (codegen);
-
 		var type_array_type = new ArrayType (new PointerType (new VoidType ()), 1, tuple.source_reference);
 		type_array_type.inline_allocated = true;
 		type_array_type.fixed_length = true;
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 9be0657..c2c1fd9 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -576,8 +576,6 @@ public class Vala.GAsyncModule : GSignalModule {
 			return;
 		}
 
-		stmt.accept_children (codegen);
-
 		if (stmt.yield_expression.error) {
 			stmt.error = true;
 			return;
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index cd4a0ff..6e19674 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -263,19 +263,19 @@ public class Vala.GDBusClientModule : GDBusModule {
 
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_initable_new"));
 		ccall.add_argument (new CCodeIdentifier ("%s_PROXY".printf (iface.get_type_id ())));
-		cancellable.accept (codegen);
+		cancellable.emit (codegen);
 		ccall.add_argument ((CCodeExpression) cancellable.ccodenode);
 		ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_")));
 		ccall.add_argument (new CCodeConstant ("\"g-flags\""));
 		ccall.add_argument (new CCodeConstant ("G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES"));
 		ccall.add_argument (new CCodeConstant ("\"g-name\""));
-		name.accept (codegen);
+		name.emit (codegen);
 		ccall.add_argument ((CCodeExpression) name.ccodenode);
 		ccall.add_argument (new CCodeConstant ("\"g-bus-type\""));
-		bus_type.accept (codegen);
+		bus_type.emit (codegen);
 		ccall.add_argument ((CCodeExpression) bus_type.ccodenode);
 		ccall.add_argument (new CCodeConstant ("\"g-object-path\""));
-		object_path.accept (codegen);
+		object_path.emit (codegen);
 		ccall.add_argument ((CCodeExpression) object_path.ccodenode);
 		ccall.add_argument (new CCodeConstant ("\"g-interface-name\""));
 		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dbus_name (iface))));
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index 2680a86..a5760e7 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -1030,8 +1030,6 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 			return;
 		}
 
-		expr.accept_children (codegen);
-
 		var ma = (MemberAccess) expr.call;
 		var type_arg = (ObjectType) ma.get_type_arguments ().get (0);
 
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index b86cfa6..deca24b 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -1,6 +1,6 @@
 /* valagerrormodule.vala
  *
- * Copyright (C) 2008-2009  Jürg Billeter
+ * Copyright (C) 2008-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
@@ -43,7 +43,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 			if (ecode.value == null) {
 				cenum.add_value (new CCodeEnumValue (ecode.get_cname ()));
 			} else {
-				ecode.value.accept (codegen);
+				ecode.value.emit (codegen);
 				cenum.add_value (new CCodeEnumValue (ecode.get_cname (), (CCodeExpression) ecode.value.ccodenode));
 			}
 		}
@@ -85,8 +85,6 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 	}
 
 	public override void visit_throw_statement (ThrowStatement stmt) {
-		stmt.accept_children (codegen);
-
 		var cfrag = new CCodeFragment ();
 
 		// method will fail
@@ -333,15 +331,15 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 		}
 
 		if (stmt.finally_body != null) {
-			stmt.finally_body.accept (codegen);
+			stmt.finally_body.emit (codegen);
 		}
 
 		is_in_catch = false;
-		stmt.body.accept (codegen);
+		stmt.body.emit (codegen);
 		is_in_catch = true;
 
 		foreach (CatchClause clause in stmt.get_catch_clauses ()) {
-			clause.accept (codegen);
+			clause.emit (codegen);
 		}
 
 		current_try = old_try;
@@ -369,10 +367,6 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 	}
 
 	public override void visit_catch_clause (CatchClause clause) {
-		if (clause.error_variable != null) {
-			clause.error_variable.active = true;
-		}
-
 		current_method_inner_error = true;
 
 		var error_type = (ErrorType) clause.error_type;
@@ -380,7 +374,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 			generate_error_domain_declaration (error_type.error_domain, source_declarations);
 		}
 
-		clause.accept_children (codegen);
+		clause.body.emit (codegen);
 
 		var cfrag = new CCodeFragment ();
 		cfrag.append (new CCodeLabel (clause.clabel_name));
diff --git a/codegen/valagobjectmodule.vala b/codegen/valagobjectmodule.vala
index d1c2eea..d6ce29d 100644
--- a/codegen/valagobjectmodule.vala
+++ b/codegen/valagobjectmodule.vala
@@ -458,7 +458,7 @@ public class Vala.GObjectModule : GTypeModule {
 		} else {
 			in_constructor = true;
 		}
-		c.accept_children (codegen);
+		c.body.emit (codegen);
 		in_static_or_class_context = false;
 
 		in_constructor = false;
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index d62b30d..8d09f30 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -1,6 +1,6 @@
 /* valagsignalmodule.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -460,7 +460,6 @@ public class Vala.GSignalModule : GObjectModule {
 			// detailed signal emission
 			var sig = (Signal) expr.symbol_reference;
 			var ma = (MemberAccess) expr.container;
-			expr.accept_children (codegen);
 
 			var detail_expr = expr.get_indices ().get (0) as StringLiteral;
 			string signal_detail = detail_expr.eval ();
@@ -504,8 +503,6 @@ public class Vala.GSignalModule : GObjectModule {
 
 	public override void visit_assignment (Assignment assignment) {
 		if (assignment.left.symbol_reference is Signal) {
-			assignment.right.accept (codegen);
-
 			if (assignment.left.error || assignment.right.error) {
 				assignment.error = true;
 				return;
@@ -519,8 +516,6 @@ public class Vala.GSignalModule : GObjectModule {
 
 	public override void visit_member_access (MemberAccess expr) {
 		if (expr.symbol_reference is Signal) {
-			expr.accept_children (codegen);
-
 			CCodeExpression pub_inst = null;
 	
 			if (expr.inner != null) {
@@ -571,9 +566,6 @@ public class Vala.GSignalModule : GObjectModule {
 		var signal_access = ((MemberAccess) expr.call).inner;
 		var handler = expr.get_argument_list ().get (0);
 
-		signal_access.accept (codegen);
-		handler.accept (codegen);
-
 		bool disconnect = (method_type.method_symbol.name == "disconnect");
 		bool after = (method_type.method_symbol.name == "connect_after");
 
diff --git a/vala/valaaddressofexpression.vala b/vala/valaaddressofexpression.vala
index ad00968..c6804d6 100644
--- a/vala/valaaddressofexpression.vala
+++ b/vala/valaaddressofexpression.vala
@@ -1,6 +1,6 @@
 /* valaaddressofexpression.vala
  *
- * Copyright (C) 2007-2008  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -98,4 +98,12 @@ public class Vala.AddressofExpression : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_addressof_expression (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 80f4367..d8d0f2c 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -244,4 +244,18 @@ public class Vala.ArrayCreationExpression : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (Expression e in sizes) {
+			e.emit (codegen);
+		}
+
+		if (initializer_list != null) {
+			initializer_list.emit (codegen);
+		}
+
+		codegen.visit_array_creation_expression (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index bcbe96a..3f7e592 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -443,6 +443,37 @@ public class Vala.Assignment : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		var ma = left as MemberAccess;
+		var ea = left as ElementAccess;
+		var pi = left as PointerIndirection;
+		if (ma != null) {
+			var field = ma.symbol_reference as Field;
+			var property = ma.symbol_reference as Property;
+
+			bool instance = (field != null && field.binding == MemberBinding.INSTANCE)
+				|| (property != null && property.binding == MemberBinding.INSTANCE);
+
+			if (instance) {
+				ma.inner.emit (codegen);
+			}
+		} else if (ea != null) {
+			ea.container.emit (codegen);
+
+			foreach (var index in ea.get_indices ()) {
+				index.emit (codegen);
+			}
+		} else if (pi != null) {
+			pi.inner.emit (codegen);
+		}
+
+		right.emit (codegen);
+
+		codegen.visit_assignment (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		right.get_defined_variables (collection);
 		left.get_defined_variables (collection);
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index b434f56..e03baf7 100644
--- a/vala/valabaseaccess.vala
+++ b/vala/valabaseaccess.vala
@@ -90,4 +90,10 @@ public class Vala.BaseAccess : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_base_access (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index f2652f9..ccbdf07 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -306,6 +306,8 @@ public class Vala.BinaryExpression : Expression {
 				return false;
 			}
 
+			right.target_type = array_type.element_type.copy ();
+
 			value_type = array_type.copy ();
 			value_type.value_owned = true;
 		} else if (operator == BinaryOperator.PLUS
@@ -486,6 +488,15 @@ public class Vala.BinaryExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		left.emit (codegen);
+		right.emit (codegen);
+
+		codegen.visit_binary_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		left.get_defined_variables (collection);
 		right.get_defined_variables (collection);
diff --git a/vala/valablock.vala b/vala/valablock.vala
index 5b570a7..64cbfaa 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -154,6 +154,10 @@ public class Vala.Block : Symbol, Statement {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_block (this);
+	}
+
 	public void insert_before (Statement stmt, Statement new_stmt) {
 		for (int i = 0; i < statement_list.size; i++) {
 			var stmt_list = statement_list[i] as StatementList;
diff --git a/vala/valabooleanliteral.vala b/vala/valabooleanliteral.vala
index bf0842f..e027944 100644
--- a/vala/valabooleanliteral.vala
+++ b/vala/valabooleanliteral.vala
@@ -1,6 +1,6 @@
 /* valabooleanliteral.vala
  *
- * Copyright (C) 2006-2008  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
@@ -72,4 +72,10 @@ public class Vala.BooleanLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_boolean_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valabreakstatement.vala b/vala/valabreakstatement.vala
index 97e93df..3f69c85 100644
--- a/vala/valabreakstatement.vala
+++ b/vala/valabreakstatement.vala
@@ -1,6 +1,6 @@
 /* valabreakstatement.vala
  *
- * Copyright (C) 2006-2007  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
@@ -39,4 +39,8 @@ public class Vala.BreakStatement : CodeNode, Statement {
 	public override void accept (CodeVisitor visitor) {
 		visitor.visit_break_statement (this);
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_break_statement (this);
+	}
 }
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index a17f09f..536fe14 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -147,6 +147,14 @@ public class Vala.CastExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_cast_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		inner.get_defined_variables (collection);
 	}
diff --git a/vala/valacatchclause.vala b/vala/valacatchclause.vala
index efe71d0..b6d742e 100644
--- a/vala/valacatchclause.vala
+++ b/vala/valacatchclause.vala
@@ -1,6 +1,6 @@
 /* valacatchclause.vala
  *
- * Copyright (C) 2007-2009  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -139,6 +139,14 @@ public class Vala.CatchClause : CodeNode {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		if (error_variable != null) {
+			error_variable.active = true;
+		}
+
+		codegen.visit_catch_clause (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		if (error_variable != null) {
 			collection.add (error_variable);
diff --git a/vala/valacharacterliteral.vala b/vala/valacharacterliteral.vala
index c69eeb5..0de9918 100644
--- a/vala/valacharacterliteral.vala
+++ b/vala/valacharacterliteral.vala
@@ -102,4 +102,10 @@ public class Vala.CharacterLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_character_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valacodegenerator.vala b/vala/valacodegenerator.vala
index 43ce901..39442ab 100644
--- a/vala/valacodegenerator.vala
+++ b/vala/valacodegenerator.vala
@@ -1,6 +1,6 @@
 /* valacodegenerator.vala
  *
- * Copyright (C) 2007-2008  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -20,8 +20,6 @@
  * 	Jürg Billeter <j bitron ch>
  */
 
-using GLib;
-
 /**
  * Abstract code visitor generating code.
  */
diff --git a/vala/valacodenode.vala b/vala/valacodenode.vala
index f3ae4a4..4b0584d 100644
--- a/vala/valacodenode.vala
+++ b/vala/valacodenode.vala
@@ -145,6 +145,9 @@ public abstract class Vala.CodeNode {
 		return true;
 	}
 
+	public virtual void emit (CodeGenerator codegen) {
+	}
+
 	public virtual void replace_type (DataType old_type, DataType new_type) {
 	}
 
diff --git a/vala/valacontinuestatement.vala b/vala/valacontinuestatement.vala
index 8ca4111..1de109d 100644
--- a/vala/valacontinuestatement.vala
+++ b/vala/valacontinuestatement.vala
@@ -1,6 +1,6 @@
 /* valacontinuestatement.vala
  *
- * Copyright (C) 2006-2007  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
@@ -39,4 +39,8 @@ public class Vala.ContinueStatement : CodeNode, Statement {
 	public override void accept (CodeVisitor visitor) {
 		visitor.visit_continue_statement (this);
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_continue_statement (this);
+	}
 }
diff --git a/vala/valadeclarationstatement.vala b/vala/valadeclarationstatement.vala
index 344000e..51d80fc 100644
--- a/vala/valadeclarationstatement.vala
+++ b/vala/valadeclarationstatement.vala
@@ -1,6 +1,6 @@
 /* valadeclarationstatement.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
@@ -85,6 +85,10 @@ public class Vala.DeclarationStatement : CodeNode, Statement {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_declaration_statement (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		var local = declaration as LocalVariable;
 		if (local != null) {
diff --git a/vala/valadeletestatement.vala b/vala/valadeletestatement.vala
index e984084..ce76bfd 100644
--- a/vala/valadeletestatement.vala
+++ b/vala/valadeletestatement.vala
@@ -1,6 +1,6 @@
 /* valadeletestatement.vala
  *
- * Copyright (C) 2008  Jürg Billeter
+ * Copyright (C) 2008-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
@@ -20,8 +20,6 @@
  * 	Jürg Billeter <j bitron ch>
  */
 
-using GLib;
-
 /**
  * Represents a delete statement e.g. "delete a".
  */
@@ -63,4 +61,10 @@ public class Vala.DeleteStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		expression.emit (codegen);
+
+		codegen.visit_delete_statement (this);
+	}
 }
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index 3622a1d..42c386f 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -234,6 +234,17 @@ public class Vala.ElementAccess : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		container.emit (codegen);
+		foreach (Expression e in indices) {
+			e.emit (codegen);
+		}
+
+		codegen.visit_element_access (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		container.get_defined_variables (collection);
 		foreach (Expression index in indices) {
diff --git a/vala/valaemptystatement.vala b/vala/valaemptystatement.vala
index 8b6826d..1cc6ae0 100644
--- a/vala/valaemptystatement.vala
+++ b/vala/valaemptystatement.vala
@@ -1,6 +1,6 @@
 /* valaemptystatement.vala
  *
- * Copyright (C) 2006-2007  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
@@ -39,4 +39,8 @@ public class Vala.EmptyStatement : CodeNode, Statement {
 	public override void accept (CodeVisitor visitor) {
 		visitor.visit_empty_statement (this);
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_empty_statement (this);
+	}
 }
diff --git a/vala/valaexpressionstatement.vala b/vala/valaexpressionstatement.vala
index 50d0deb..c6450c0 100644
--- a/vala/valaexpressionstatement.vala
+++ b/vala/valaexpressionstatement.vala
@@ -85,6 +85,12 @@ public class Vala.ExpressionStatement : CodeNode, Statement {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		expression.emit (codegen);
+
+		codegen.visit_expression_statement (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		expression.get_defined_variables (collection);
 	}
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 07a38db..bc0cf3d 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -348,6 +348,24 @@ public class Vala.ForeachStatement : Block {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		if (use_iterator) {
+			base.emit (codegen);
+			return;
+		}
+
+		collection.emit (codegen);
+		codegen.visit_end_full_expression (collection);
+
+		element_variable.active = true;
+		collection_variable.active = true;
+		if (iterator_variable != null) {
+			iterator_variable.active = true;
+		}
+
+		codegen.visit_foreach_statement (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		collection.add (element_variable);
 	}
diff --git a/vala/valaifstatement.vala b/vala/valaifstatement.vala
index 0804bb4..8cb1bac 100644
--- a/vala/valaifstatement.vala
+++ b/vala/valaifstatement.vala
@@ -139,4 +139,12 @@ public class Vala.IfStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		condition.emit (codegen);
+
+		codegen.visit_end_full_expression (condition);
+
+		codegen.visit_if_statement (this);
+	}
 }
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index c415ff2..5028caf 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -1,6 +1,6 @@
 /* valainitializerlist.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -198,4 +198,12 @@ public class Vala.InitializerList : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (Expression expr in initializers) {
+			expr.emit (codegen);
+		}
+
+		codegen.visit_initializer_list (this);
+	}
 }
diff --git a/vala/valaintegerliteral.vala b/vala/valaintegerliteral.vala
index 815c4e3..297eb3e 100644
--- a/vala/valaintegerliteral.vala
+++ b/vala/valaintegerliteral.vala
@@ -131,4 +131,10 @@ public class Vala.IntegerLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_integer_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 34130d4..d71c4b5 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -235,6 +235,12 @@ public class Vala.LambdaExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_lambda_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_used_variables (Collection<LocalVariable> collection) {
 		// require captured variables to be initialized
 		if (method.closure) {
diff --git a/vala/valalistliteral.vala b/vala/valalistliteral.vala
index bee7431..f816550 100644
--- a/vala/valalistliteral.vala
+++ b/vala/valalistliteral.vala
@@ -115,4 +115,14 @@ public class Vala.ListLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (Expression expr in expression_list) {
+			expr.emit (codegen);
+		}
+
+		codegen.visit_list_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valalockstatement.vala b/vala/valalockstatement.vala
index da9a0be..39ad4e0 100644
--- a/vala/valalockstatement.vala
+++ b/vala/valalockstatement.vala
@@ -1,7 +1,8 @@
 /* valalockstatement.vala
  *
  * Copyright (C) 2009  JiÅ?í Zárevúcky
- * Copyright (C) 2006-2007  Raffaele Sandrini, Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
+ * Copyright (C) 2006-2007  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -100,4 +101,9 @@ public class Vala.LockStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		resource.emit (codegen);
+		codegen.visit_lock_statement (this);
+	}
 }
diff --git a/vala/valaloop.vala b/vala/valaloop.vala
index a0281e9..e73174d 100644
--- a/vala/valaloop.vala
+++ b/vala/valaloop.vala
@@ -1,6 +1,6 @@
 /* valaloop.vala
  *
- * Copyright (C) 2009  Jürg Billeter
+ * Copyright (C) 2009-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
@@ -74,5 +74,9 @@ public class Vala.Loop : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_loop (this);
+	}
 }
 
diff --git a/vala/valamapliteral.vala b/vala/valamapliteral.vala
index 677a5db..9d4fe10 100644
--- a/vala/valamapliteral.vala
+++ b/vala/valamapliteral.vala
@@ -125,4 +125,15 @@ public class Vala.MapLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		for (int i = 0; i < keys.size; i++) {
+			keys[i].emit (codegen);
+			values[i].emit (codegen);
+		}
+
+		codegen.visit_map_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index bc9717f..443e67b 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -784,6 +784,16 @@ public class Vala.MemberAccess : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		if (inner != null) {
+			inner.emit (codegen);
+		}
+
+		codegen.visit_member_access (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		if (inner != null) {
 			inner.get_defined_variables (collection);
diff --git a/vala/valamemberinitializer.vala b/vala/valamemberinitializer.vala
index 2057e31..afcb230 100644
--- a/vala/valamemberinitializer.vala
+++ b/vala/valamemberinitializer.vala
@@ -1,6 +1,6 @@
 /* valamemberinitializer.vala
  *
- * Copyright (C) 2007-2009  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -72,6 +72,10 @@ public class Vala.MemberInitializer : CodeNode {
 		return initializer.check (analyzer);
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		initializer.emit (codegen);
+	}
+
 	public override void replace_expression (Expression old_node, Expression new_node) {
 		if (initializer == old_node) {
 			initializer = new_node;
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index af41a66..a493c56 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -706,6 +706,25 @@ public class Vala.MethodCall : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		var method_type = call.value_type as MethodType;
+
+		if (method_type != null && method_type.method_symbol.parent_symbol is Signal) {
+			var signal_access = ((MemberAccess) call).inner;
+			signal_access.emit (codegen);
+		} else {
+			call.emit (codegen);
+		}
+
+		foreach (Expression expr in argument_list) {
+			expr.emit (codegen);
+		}
+
+		codegen.visit_method_call (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		call.get_defined_variables (collection);
 
diff --git a/vala/valanamedargument.vala b/vala/valanamedargument.vala
index f758fbb..6b67649 100644
--- a/vala/valanamedargument.vala
+++ b/vala/valanamedargument.vala
@@ -81,6 +81,14 @@ public class Vala.NamedArgument : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_named_argument (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		inner.get_defined_variables (collection);
 	}
diff --git a/vala/valanullliteral.vala b/vala/valanullliteral.vala
index a82217d..94be504 100644
--- a/vala/valanullliteral.vala
+++ b/vala/valanullliteral.vala
@@ -1,6 +1,6 @@
 /* valanullliteral.vala
  *
- * Copyright (C) 2006-2008  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
@@ -61,4 +61,10 @@ public class Vala.NullLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_null_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 1a3ecc7..d7cc008 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -429,6 +429,20 @@ public class Vala.ObjectCreationExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		foreach (Expression arg in argument_list) {
+			arg.emit (codegen);
+		}
+
+		foreach (MemberInitializer init in object_initializer) {
+			init.emit (codegen);
+		}
+
+		codegen.visit_object_creation_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		foreach (Expression arg in argument_list) {
 			arg.get_defined_variables (collection);
diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala
index fa5b759..17295e4 100644
--- a/vala/valapointerindirection.vala
+++ b/vala/valapointerindirection.vala
@@ -1,6 +1,6 @@
 /* valapointerindirection.vala
  *
- * Copyright (C) 2007-2008  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -101,6 +101,14 @@ public class Vala.PointerIndirection : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_pointer_indirection (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		inner.get_defined_variables (collection);
 	}
diff --git a/vala/valapostfixexpression.vala b/vala/valapostfixexpression.vala
index b9d6af1..ee53151 100644
--- a/vala/valapostfixexpression.vala
+++ b/vala/valapostfixexpression.vala
@@ -1,6 +1,6 @@
 /* valapostfixexpression.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
@@ -125,4 +125,12 @@ public class Vala.PostfixExpression : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_postfix_expression (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valarealliteral.vala b/vala/valarealliteral.vala
index bd4c19a..f45560f 100644
--- a/vala/valarealliteral.vala
+++ b/vala/valarealliteral.vala
@@ -85,4 +85,10 @@ public class Vala.RealLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_real_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valareferencetransferexpression.vala b/vala/valareferencetransferexpression.vala
index e09d06b..945593f 100644
--- a/vala/valareferencetransferexpression.vala
+++ b/vala/valareferencetransferexpression.vala
@@ -1,6 +1,6 @@
 /* valareferencetransferexpression.vala
  *
- * Copyright (C) 2007-2008  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -115,6 +115,14 @@ public class Vala.ReferenceTransferExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_reference_transfer_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		inner.get_defined_variables (collection);
 	}
diff --git a/vala/valaregexliteral.vala b/vala/valaregexliteral.vala
index eb1edd5..8e4cdc6 100644
--- a/vala/valaregexliteral.vala
+++ b/vala/valaregexliteral.vala
@@ -1,6 +1,7 @@
 /* valaregexliteral.vala
  *
  * Copyright (C) 2010  Jukka-Pekka Iivonen
+ * Copyright (C) 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
@@ -85,5 +86,11 @@ public class Vala.RegexLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_regex_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
 
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index 399ca69..b8b2e83 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -1,6 +1,6 @@
 /* valareturnstatement.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
@@ -148,6 +148,16 @@ public class Vala.ReturnStatement : CodeNode, Statement {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		if (return_expression != null) {
+			return_expression.emit (codegen);
+
+			codegen.visit_end_full_expression (return_expression);
+		}
+
+		codegen.visit_return_statement (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		if (return_expression != null) {
 			return_expression.get_defined_variables (collection);
diff --git a/vala/valasetliteral.vala b/vala/valasetliteral.vala
index fdbb44f..42be178 100644
--- a/vala/valasetliteral.vala
+++ b/vala/valasetliteral.vala
@@ -99,4 +99,14 @@ public class Vala.SetLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (Expression expr in expression_list) {
+			expr.emit (codegen);
+		}
+
+		codegen.visit_set_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valasizeofexpression.vala b/vala/valasizeofexpression.vala
index 57866e3..d7b2c04 100644
--- a/vala/valasizeofexpression.vala
+++ b/vala/valasizeofexpression.vala
@@ -1,6 +1,6 @@
 /* valasizeofexpression.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
@@ -82,4 +82,10 @@ public class Vala.SizeofExpression : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_sizeof_expression (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valasliceexpression.vala b/vala/valasliceexpression.vala
index 7713f73..77c5743 100644
--- a/vala/valasliceexpression.vala
+++ b/vala/valasliceexpression.vala
@@ -1,7 +1,7 @@
 /* valasliceexpression.vala
  *
  * Copyright (C) 2009 Robin Sonefors
- * Copyright (C) 2009 Jürg Billeter
+ * Copyright (C) 2009-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
@@ -163,6 +163,17 @@ public class Vala.SliceExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		container.emit (codegen);
+
+		start.emit (codegen);
+		stop.emit (codegen);
+
+		codegen.visit_slice_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		container.get_defined_variables (collection);
 		start.get_defined_variables (collection);
diff --git a/vala/valastatementlist.vala b/vala/valastatementlist.vala
index 91d9d93..934227a 100644
--- a/vala/valastatementlist.vala
+++ b/vala/valastatementlist.vala
@@ -1,6 +1,6 @@
 /* valastatementlist.vala
  *
- * Copyright (C) 2008  Jürg Billeter
+ * Copyright (C) 2008-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
@@ -53,4 +53,10 @@ public class Vala.StatementList : CodeNode, Statement {
 			stmt.accept (visitor);
 		}
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (Statement stmt in list) {
+			stmt.emit (codegen);
+		}
+	}
 }
diff --git a/vala/valastringliteral.vala b/vala/valastringliteral.vala
index 318c218..2a1cbc7 100644
--- a/vala/valastringliteral.vala
+++ b/vala/valastringliteral.vala
@@ -88,4 +88,10 @@ public class Vala.StringLiteral : Literal {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_string_literal (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valaswitchlabel.vala b/vala/valaswitchlabel.vala
index 67fcdc2..2a15d96 100644
--- a/vala/valaswitchlabel.vala
+++ b/vala/valaswitchlabel.vala
@@ -1,6 +1,6 @@
 /* valaswitchlabel.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
@@ -86,4 +86,8 @@ public class Vala.SwitchLabel : CodeNode {
 
 		return true;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_switch_label (this);
+	}
 }
diff --git a/vala/valaswitchsection.vala b/vala/valaswitchsection.vala
index 944035c..c8faae5 100644
--- a/vala/valaswitchsection.vala
+++ b/vala/valaswitchsection.vala
@@ -117,4 +117,12 @@ public class Vala.SwitchSection : Block {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (SwitchLabel label in labels) {
+			label.emit (codegen);
+		}
+
+		base.emit (codegen);
+	}
 }
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index be38a29..1fbcb16 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -140,4 +140,12 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		expression.emit (codegen);
+
+		codegen.visit_end_full_expression (expression);
+
+		codegen.visit_switch_statement (this);
+	}
 }
diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala
index f946540..444df3c 100644
--- a/vala/valathrowstatement.vala
+++ b/vala/valathrowstatement.vala
@@ -113,6 +113,16 @@ public class Vala.ThrowStatement : CodeNode, Statement {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		if (error_expression != null) {
+			error_expression.emit (codegen);
+
+			codegen.visit_end_full_expression (error_expression);
+		}
+
+		codegen.visit_throw_statement (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		error_expression.get_defined_variables (collection);
 	}
diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala
index 540af3e..e5d3b2e 100644
--- a/vala/valatrystatement.vala
+++ b/vala/valatrystatement.vala
@@ -147,4 +147,8 @@ public class Vala.TryStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_try_statement (this);
+	}
 }
diff --git a/vala/valatuple.vala b/vala/valatuple.vala
index 75d22c4..2fcc45d 100644
--- a/vala/valatuple.vala
+++ b/vala/valatuple.vala
@@ -89,4 +89,14 @@ public class Vala.Tuple : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		foreach (Expression expr in expression_list) {
+			expr.emit (codegen);
+		}
+
+		codegen.visit_tuple (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index 7097ab8..4e002dc 100644
--- a/vala/valatypecheck.vala
+++ b/vala/valatypecheck.vala
@@ -1,6 +1,6 @@
 /* valatypecheck.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
@@ -112,4 +112,12 @@ public class Vala.TypeCheck : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		expression.emit (codegen);
+
+		codegen.visit_type_check (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index 99d9145..2a31ec0 100644
--- a/vala/valatypeofexpression.vala
+++ b/vala/valatypeofexpression.vala
@@ -1,6 +1,6 @@
 /* valatypeofexpression.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
@@ -82,4 +82,10 @@ public class Vala.TypeofExpression : Expression {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		codegen.visit_typeof_expression (this);
+
+		codegen.visit_expression (this);
+	}
 }
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index d2d38dd..c137cb2 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -234,6 +234,14 @@ public class Vala.UnaryExpression : Expression {
 		return !error;
 	}
 
+	public override void emit (CodeGenerator codegen) {
+		inner.emit (codegen);
+
+		codegen.visit_unary_expression (this);
+
+		codegen.visit_expression (this);
+	}
+
 	public override void get_defined_variables (Collection<LocalVariable> collection) {
 		inner.get_defined_variables (collection);
 		if (operator == UnaryOperator.OUT || operator == UnaryOperator.REF) {
diff --git a/vala/valaunlockstatement.vala b/vala/valaunlockstatement.vala
index e0ae1a0..f862955 100644
--- a/vala/valaunlockstatement.vala
+++ b/vala/valaunlockstatement.vala
@@ -1,6 +1,7 @@
 /* valaunlockstatement.vala
  *
- * Copyright (C) 2009  JiÅ?í Zárevúcky, Jürg Billeter
+ * Copyright (C) 2009-2010  Jürg Billeter
+ * Copyright (C) 2009  JiÅ?í Zárevúcky
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -67,4 +68,9 @@ public class Vala.UnlockStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		resource.emit (codegen);
+		codegen.visit_unlock_statement (this);
+	}
 }
diff --git a/vala/valayieldstatement.vala b/vala/valayieldstatement.vala
index ca4d0d6..be526a1 100644
--- a/vala/valayieldstatement.vala
+++ b/vala/valayieldstatement.vala
@@ -1,6 +1,6 @@
 /* valayieldstatement.vala
  *
- * Copyright (C) 2008  Jürg Billeter
+ * Copyright (C) 2008-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
@@ -77,5 +77,15 @@ public class Vala.YieldStatement : CodeNode, Statement {
 
 		return !error;
 	}
+
+	public override void emit (CodeGenerator codegen) {
+		if (yield_expression != null) {
+			yield_expression.emit (codegen);
+
+			codegen.visit_end_full_expression (yield_expression);
+		}
+
+		codegen.visit_yield_statement (this);
+	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]