From 53b7d59b6a1e86ad3bff2d910779a21188b1615e Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 21 Nov 2016 13:21:32 +0000 Subject: [PATCH] analyses.constness: fix false positive on x[...]. --- artiq/compiler/analyses/constness.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/artiq/compiler/analyses/constness.py b/artiq/compiler/analyses/constness.py index 4fab07ea4..add1f7fac 100644 --- a/artiq/compiler/analyses/constness.py +++ b/artiq/compiler/analyses/constness.py @@ -17,6 +17,12 @@ class Constness(algorithm.Visitor): self.visit(node.targets) self.in_assign = False + def visit_SubscriptT(self, node): + old_in_assign, self.in_assign = self.in_assign, False + self.visit(node.value) + self.visit(node.slice) + self.in_assign = old_in_assign + def visit_AttributeT(self, node): self.generic_visit(node) if self.in_assign: