]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Drop useless temporary variables when storing a property
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 18 Jun 2011 07:53:15 +0000 (09:53 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 6 Jul 2011 20:32:31 +0000 (22:32 +0200)
codegen/valaccodeassignmentmodule.vala
codegen/valaccodebasemodule.vala

index a3e8b2d94d8791bdce839b30b11529db2bdad388..e2bc0cebf95cd6067bc8aa87b30895199ae71502 100644 (file)
@@ -85,25 +85,8 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                        var ma = assignment.left as MemberAccess;
                        var prop = (Property) assignment.left.symbol_reference;
 
-                       if (assignment.parent_node is ExpressionStatement) {
-                               store_property (prop, ma.inner, assignment.right.target_value);
-
-                               set_cvalue (assignment, get_ccodenode (assignment.right));
-                       } else {
-                               // when load_variable is changed to use temporary
-                               // variables, this exception is no longer necessary
-
-                               var temp_decl = get_temp_variable (prop.property_type);
-                               emit_temp_var (temp_decl);
-                               ccode.add_assignment (get_variable_cexpression (temp_decl.name), get_cvalue_ (assignment.right.target_value));
-
-                               var target_value = ((GLibValue) assignment.right.target_value).copy ();
-                               target_value.cvalue = get_variable_cexpression (temp_decl.name);
-
-                               store_property (prop, ma.inner, target_value);
-
-                               assignment.target_value = target_value;
-                       }
+                       store_property (prop, ma.inner, assignment.right.target_value);
+                       assignment.target_value = assignment.right.target_value;
                } else {
                        assignment.target_value = emit_simple_assignment (assignment);
                }
index d626f72aadaca24cb9149fe23d45732f33d41d10..f61d5fb9ab464b28f6da9b09b3791f1e0735b435 100644 (file)
@@ -5423,14 +5423,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                var array_type = prop.property_type as ArrayType;
 
-               if (array_type != null && !prop.no_array_length) {
-                       var temp_var = get_temp_variable (prop.property_type, true, null, false);
-                       emit_temp_var (temp_var);
-                       ccode.add_assignment (get_variable_cexpression (temp_var.name), cexpr);
-                       ccall.add_argument (get_variable_cexpression (temp_var.name));
-               } else {
-                       ccall.add_argument (cexpr);
-               }
+               ccall.add_argument (cexpr);
 
                if (array_type != null && !prop.no_array_length) {
                        for (int dim = 1; dim <= array_type.rank; dim++) {