[vala/wip/effectfree: 15/44] Don't set target_value of assignment if parent is an expression statement



commit 851b2802354ead100cfe366101be597dbb13e1f1
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri Jul 1 18:49:59 2011 +0200

    Don't set target_value of assignment if parent is an expression statement

 vala/valaassignment.vala |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index c7af099..3b8857a 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -489,15 +489,17 @@ public class Vala.Assignment : Expression {
 					codegen.store_field (field, instance && ma.inner != null ? ma.inner.target_value : null, new_value);
 				}
 
-				// when load_variable is changed to use temporary
-				// variables, replace following code with this line
-				// target_value = new_value;
-				if (local != null) {
-					target_value = codegen.load_local (local);
-				} else if (param != null) {
-					target_value = codegen.load_parameter (param);
-				} else if (field != null) {
-					target_value = codegen.load_field (field, instance && ma.inner != null ? ma.inner.target_value : null);
+				if (!(parent_node is ExpressionStatement)) {
+					// when load_variable is changed to use temporary
+					// variables, replace following code with this line
+					// target_value = new_value;
+					if (local != null) {
+						target_value = codegen.load_local (local);
+					} else if (param != null) {
+						target_value = codegen.load_parameter (param);
+					} else if (field != null) {
+						target_value = codegen.load_field (field, instance && ma.inner != null ? ma.inner.target_value : null);
+					}
 				}
 
 				codegen.visit_expression (this);



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