fix backward propagateSideEffect impl
authorWolfgang Bumiller <wry.git@bumiller.com>
Sun, 1 Feb 2015 11:12:25 +0000 (12:12 +0100)
committerWolfgang Bumiller <wry.git@bumiller.com>
Sun, 1 Feb 2015 11:12:40 +0000 (12:12 +0100)
ast.cpp
ast.h

diff --git a/ast.cpp b/ast.cpp
index 58ed660..96d9e2f 100644 (file)
--- a/ast.cpp
+++ b/ast.cpp
@@ -24,9 +24,10 @@ ast_node::~ast_node()
 }
 
 /* weight and side effects */
-void ast_node::propagateSideEffects(ast_node *other) const
+void ast_node::propagateSideEffects(const ast_node *other)
 {
-    other->m_side_effects = m_side_effects;
+    if (other->m_side_effects)
+        m_side_effects = true;
 }
 
 /* General expression initialization */
diff --git a/ast.h b/ast.h
index 04f8c0e..b305dac 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -110,7 +110,7 @@ struct ast_node
     bool             m_keep_node;
     bool             m_side_effects;
 
-    void propagateSideEffects(ast_node *other) const;
+    void propagateSideEffects(const ast_node *other);
 };
 
 #define ast_unref(x) do        \