]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Don't set target_value of assignment if parent is an expression statement
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 1 Jul 2011 16:49:59 +0000 (18:49 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 6 Jul 2011 20:32:28 +0000 (22:32 +0200)
vala/valaassignment.vala

index c7af099aff831312b9a26af9f671170f034fafdb..3b8857a11af970acdf2f9587c8da8baa8442808f 100644 (file)
@@ -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);