1.1 --- a/annotate.py Wed Feb 14 23:35:19 2007 +0100
1.2 +++ b/annotate.py Thu Feb 15 20:16:42 2007 +0100
1.3 @@ -296,16 +296,24 @@
1.4
1.5 inverted = getattr(checktype, "inverted", 0)
1.6 checktype.expr = self.dispatch(checktype.expr)
1.7 +
1.8 expr_types = self.namespace.types
1.9 choice_types = []
1.10 choices = []
1.11 +
1.12 for choice in checktype.choices:
1.13 choices.append(self.dispatch(choice))
1.14 choice_types += self.namespace.types
1.15 +
1.16 for expr_type in expr_types:
1.17 in_choices = expr_type.type.get_class() in choice_types
1.18 +
1.19 + # Filter out types not in the choices list unless the operation is
1.20 + # inverted; in which case, filter out types in the choices list.
1.21 +
1.22 if not inverted and not in_choices or inverted and in_choices:
1.23 self._prune_non_accesses(checktype.expr, expr_type)
1.24 +
1.25 return checktype
1.26
1.27 def visitConditional(self, conditional):