[vala] codegen: Move freeing of locals to append_scope_free method



commit a07c2c208b33f4f9e801d18b09b4c9336dc207a8
Author: Jürg Billeter <j bitron ch>
Date:   Fri Apr 29 22:31:27 2011 +0200

    codegen: Move freeing of locals to append_scope_free method

 codegen/valaccodebasemodule.vala |    9 +++++----
 codegen/valagerrormodule.vala    |    2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index f963c49..64aebb8 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3250,7 +3250,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		temp_ref_vars.clear ();
 	}
 
-	public virtual void append_local_free (Symbol sym, bool stop_at_loop = false, CodeNode? stop_at = null) {
+	protected virtual void append_scope_free (Symbol sym, CodeNode? stop_at = null) {
 		var b = (Block) sym;
 
 		var local_vars = b.get_local_variables ();
@@ -3270,6 +3270,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			ccode.add_expression (data_unref);
 			ccode.add_assignment (get_variable_cexpression ("_data%d_".printf (block_id)), new CCodeConstant ("NULL"));
 		}
+	}
+
+	public void append_local_free (Symbol sym, bool stop_at_loop = false, CodeNode? stop_at = null) {
+		var b = (Block) sym;
 
 		append_scope_free (sym, stop_at);
 
@@ -3292,9 +3296,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		}
 	}
 
-	protected virtual void append_scope_free (Symbol sym, CodeNode? stop_at = null) {
-	}
-
 	private void append_param_free (Method m) {
 		foreach (Parameter param in m.get_parameters ()) {
 			if (!param.ellipsis && requires_destroy (param.variable_type) && param.direction == ParameterDirection.IN) {
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 157778b..8483636 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -362,6 +362,8 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 	}
 
 	protected override void append_scope_free (Symbol sym, CodeNode? stop_at = null) {
+		base.append_scope_free (sym, stop_at);
+
 		if (!(stop_at is TryStatement || stop_at is CatchClause)) {
 			var finally_block = (Block) null;
 			if (sym.parent_node is TryStatement) {



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