]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix result of copy_value for arrays
authorLuca Bruno <lucabru@src.gnome.org>
Sun, 8 May 2011 06:41:26 +0000 (08:41 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sun, 8 May 2011 06:55:12 +0000 (08:55 +0200)
codegen/valaccodebasemodule.vala

index 7dbf9aa97415d5926744a542041bb10b4e9f40bb..8864e17a33d796d7c07875d44cf5ac504e935f63 100644 (file)
@@ -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;
                }
        }