[vala/wip/effectfree: 22/43] codegen: Drop useless temporary variable in simple assignment
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/effectfree: 22/43] codegen: Drop useless temporary variable in simple assignment
- Date: Fri, 1 Jul 2011 19:15:51 +0000 (UTC)
commit c721c7cdcce76d47d7ce83842261e9d87d0e7ba5
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Jun 18 08:56:20 2011 +0200
codegen: Drop useless temporary variable in simple assignment
codegen/valaccodeassignmentmodule.vala | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
---
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index b748868..c53a028 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]