[vala/wip/effectfree: 12/12] codegen: Use temporary variables for field access



commit 195ece790a2d6f608fea4eeab9eb68c0b5646cd3
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jun 16 12:27:40 2011 +0200

    codegen: Use temporary variables for field access

 codegen/valaccodememberaccessmodule.vala |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index a85ee44..7ddb5f0 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -125,6 +125,10 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 				expr.target_value = get_field_cvalue (field, expr.inner != null ? expr.inner.target_value : null);
 			} else {
 				expr.target_value = load_field (field, expr.inner != null ? expr.inner.target_value : null);
+				if (!(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 EnumValue) {
 			var ev = (EnumValue) expr.symbol_reference;



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