[vala/wip/effectfree: 17/39] 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: 17/39] codegen: Drop useless temporary variable in simple assignment
- Date: Fri, 1 Jul 2011 07:51:09 +0000 (UTC)
commit 8bbd8b1f46f92f4735ae2a862334c78873b600cd
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 725fde0..16a57fc 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]