]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
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 58ed6603b881be4b3c635eac09c31ab3daa1d980..96d9e2fd07828456414e4556ed31231320d775f4 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 04f8c0eaa5ec76f81327cc00214ada72d585d6ed..b305dac393f82001e018cc2a0d53d7c64394ffc4 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        \