[vala] codegen: Drop Expression dependency in copy_value



commit c9ad312acb22e02e36c4f879d3b67adf2195dd86
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat May 7 11:15:23 2011 +0200

    codegen: Drop Expression dependency in copy_value

 codegen/valaccodearraymodule.vala       |   10 +++++-----
 codegen/valaccodebasemodule.vala        |    6 +++---
 codegen/valaccodecontrolflowmodule.vala |    2 +-
 codegen/valagasyncmodule.vala           |    2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 4f8a918..c40863a 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -409,7 +409,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 		cfile.add_function (fun);
 	}
 
-	public override TargetValue? copy_value (TargetValue value, Expression? expr, CodeNode node) {
+	public override TargetValue? copy_value (TargetValue value, CodeNode node) {
 		var type = value.value_type;
 		var cexpr = get_cvalue_ (value);
 
@@ -417,7 +417,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 			var array_type = (ArrayType) type;
 
 			if (!array_type.fixed_length) {
-				return base.copy_value (value, expr, node);
+				return base.copy_value (value, node);
 			}
 
 			var decl = get_temp_variable (type, false, node);
@@ -436,7 +436,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 
 			return new GLibValue (type, ccomma);
 		} else {
-			return base.copy_value (value, expr, node);
+			return base.copy_value (value, node);
 		}
 	}
 
@@ -525,7 +525,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 			                   new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("length")),
 			                   new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier ("i")));
 
-			ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("result"), new CCodeIdentifier ("i")), get_cvalue_ (copy_value (new GLibValue (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i"))), null, array_type)));
+			ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("result"), new CCodeIdentifier ("i")), get_cvalue_ (copy_value (new GLibValue (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i"))), array_type)));
 			ccode.close ();
 
 			ccode.add_return (new CCodeIdentifier ("result"));
@@ -579,7 +579,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 			                   new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier ("i")));
 
 
-			ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("dest"), new CCodeIdentifier ("i")), get_cvalue_ (copy_value (new GLibValue (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i"))), null, array_type)));
+			ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("dest"), new CCodeIdentifier ("i")), get_cvalue_ (copy_value (new GLibValue (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i"))), array_type)));
 		} else {
 			cfile.add_include ("string.h");
 
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index da73707..e6afe37 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3707,11 +3707,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			value.delegate_target_cvalue = get_delegate_target_cvalue (expr.target_value);
 			value.delegate_target_destroy_notify_cvalue = get_delegate_target_destroy_notify_cvalue (expr.target_value);
 		}
-		var result = copy_value (value, expr, node);
+		var result = copy_value (value, node);
 		return get_cvalue_ (result);
 	}
 
-	public virtual TargetValue? copy_value (TargetValue value, Expression? expr, CodeNode node) {
+	public virtual TargetValue? copy_value (TargetValue value, CodeNode node) {
 		var type = value.value_type;
 		var cexpr = get_cvalue_ (value);
 
@@ -3820,7 +3820,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 		if (!(type is ArrayType) && get_non_null (value) && !is_ref_function_void (type)) {
 			// expression is non-null
-			ccall.add_argument (get_cvalue (expr));
+			ccall.add_argument (cexpr);
 			
 			return new GLibValue (type, ccall);
 		} else {
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index 29b1412..59756d1 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -328,7 +328,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
 			CCodeExpression element_expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_item);
 
 			if (stmt.type_reference.value_owned) {
-				element_expr = get_cvalue_ (copy_value (new GLibValue (stmt.type_reference, element_expr), null, new StructValueType (gvalue_type)));
+				element_expr = get_cvalue_ (copy_value (new GLibValue (stmt.type_reference, element_expr), new StructValueType (gvalue_type)));
 			}
 
 			visit_local_variable (stmt.element_variable);
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 370961c..6bd095a 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -444,7 +444,7 @@ public class Vala.GAsyncModule : GSignalModule {
 			// structs are returned via out parameter
 			CCodeExpression cexpr = new CCodeMemberAccess.pointer (data_var, "result");
 			if (requires_copy (return_type)) {
-				cexpr = get_cvalue_ (copy_value (new GLibValue (return_type, cexpr), null, return_type));
+				cexpr = get_cvalue_ (copy_value (new GLibValue (return_type, cexpr), return_type));
 			}
 			ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result")), cexpr);
 		} else if (!(return_type is VoidType)) {



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