From: Luca Bruno Date: Sat, 18 Jun 2011 06:56:20 +0000 (+0200) Subject: codegen: Drop useless temporary variable in simple assignment X-Git-Tag: 0.13.2~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2508c5c560f2dd61fa2f307b8d3059d52074cf3b;p=thirdparty%2Fvala.git codegen: Drop useless temporary variable in simple assignment --- diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala index b74886861..c53a0287e 100644 --- a/codegen/valaccodeassignmentmodule.vala +++ b/codegen/valaccodeassignmentmodule.vala @@ -47,16 +47,6 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule { } if (unref_old || array || instance_delegate) { - if (!is_pure_ccode_expression (lhs)) { - /* Assign lhs to temp var to avoid repeating side effect */ - var lhs_value_type = assignment.left.value_type.copy (); - string lhs_temp_name = "_tmp%d_".printf (next_temp_var_id++); - var lhs_temp = new LocalVariable (lhs_value_type, "*" + lhs_temp_name); - emit_temp_var (lhs_temp); - ccode.add_assignment (get_variable_cexpression (lhs_temp_name), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, lhs)); - lhs = new CCodeParenthesizedExpression (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (lhs_temp_name))); - } - var temp_decl = get_temp_variable (assignment.left.value_type, true, null, false); emit_temp_var (temp_decl); ccode.add_assignment (get_variable_cexpression (temp_decl.name), rhs);