[vala] codegen: Fix result of copy_value for arrays



commit 98b5f82d7d6fde37bf741257efe089618b8c7efb
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun May 8 08:41:26 2011 +0200

    codegen: Fix result of copy_value for arrays

 codegen/valaccodebasemodule.vala |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 7dbf9aa..8864e17 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3702,9 +3702,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 	public virtual TargetValue? copy_value (TargetValue value, CodeNode node) {
 		var type = value.value_type;
 		var cexpr = get_cvalue_ (value);
+		var result = ((GLibValue) value).copy ();
 
 		if (type is DelegateType) {
-			var result = ((GLibValue) value).copy ();
 			result.delegate_target_destroy_notify_cvalue = new CCodeConstant ("NULL");
 			return result;
 		}
@@ -3751,7 +3751,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 				ccode.add_expression (copy_call);
 			}
 
-			return get_local_cvalue (decl);
+			result.value_type = decl.variable_type;
+			result.cvalue = ctemp;
+			return result;
 		}
 
 		/* (temp = expr, temp == NULL ? NULL : ref (temp))
@@ -3801,7 +3803,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 			var ccall = new CCodeFunctionCall (new CCodeIdentifier (dup0_func));
 			ccall.add_argument (cexpr);
-			return new GLibValue (type, ccall);
+			result.cvalue = ccall;
+			return result;
 		}
 
 		var ccall = new CCodeFunctionCall (dupexpr);
@@ -3866,7 +3869,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 				ccomma.append_expression (ctemp);
 			}
 
-			return new GLibValue (type, ccomma);
+			result.value_type = decl.variable_type;
+			result.cvalue = ccomma;
+			return result;
 		}
 	}
 



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