From: Stefan Behnel Date: Sun, 8 Dec 2013 10:15:59 +0000 (+0100) Subject: discard ExprStatNodes with constant expressions X-Git-Tag: 0.20b1~138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb5e8683b0ff9325c4cbdaca055059801b0ef5ac;p=platform%2Fupstream%2Fpython-cython.git discard ExprStatNodes with constant expressions --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 27a10d9..d1a53d6 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -3402,6 +3402,13 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations): return node return None + def visit_ExprStatNode(self, node): + self.visitchildren(node) + # drop unused constant expressions + if node.expr.has_constant_result(): + return None + return node + # in the future, other nodes can have their own handler method here # that can replace them with a constant result node