From: Luca Bruno Date: Sat, 18 Jun 2011 07:53:15 +0000 (+0200) Subject: codegen: Drop useless temporary variables when storing a property X-Git-Tag: 0.13.2~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6ee590f028271138ebf44509ec0e14bf7f0dea3;p=thirdparty%2Fvala.git codegen: Drop useless temporary variables when storing a property --- diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala index a3e8b2d94..e2bc0cebf 100644 --- a/codegen/valaccodeassignmentmodule.vala +++ b/codegen/valaccodeassignmentmodule.vala @@ -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); } diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index d626f72aa..f61d5fb9a 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -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++) {