[vala/wip/effectfree: 10/12] codegen: Use temporary variables for local variable access



commit b0548a69cc7222d04d3cf8d0b8abcb2a60f3757f
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Jun 15 13:27:21 2011 +0200

    codegen: Use temporary variables for local variable access

 codegen/valaccodememberaccessmodule.vala |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 443992f..836d740 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -326,6 +326,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 
 				// don't unref variable
 				local.active = false;
+			} else if (!expr.lvalue && !(expr.parent_node is MemberAccess && expr.target_value.value_type.is_real_non_null_struct_type ()) && !(expr.target_value.value_type is ArrayType && ((ArrayType) expr.target_value.value_type).inline_allocated)) {
+				var temp_value = create_temp_value (expr.target_value.value_type, expr.target_value, expr);
+				expr.target_value = temp_value;
 			}
 		} else if (expr.symbol_reference is Parameter) {
 			var param = (Parameter) expr.symbol_reference;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]