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):
2.1 --- a/simplified.py Wed Feb 14 23:35:19 2007 +0100
2.2 +++ b/simplified.py Thu Feb 15 20:16:42 2007 +0100
2.3 @@ -64,20 +64,19 @@
2.4 index_separator = "-"
2.5
2.6 def __init__(self):
2.7 - self.obj_to_name = {}
2.8 self.names = {}
2.9
2.10 def get(self, obj):
2.11 - return self.obj_to_name[obj]
2.12 + return obj._unique_name
2.13
2.14 def set(self, obj, name):
2.15 - if self.obj_to_name.has_key(obj):
2.16 + if hasattr(obj, "_unique_name"):
2.17 return
2.18 if not self.names.has_key(name):
2.19 self.names[name] = 0
2.20 n = self.names[name] + 1
2.21 self.names[name] = n
2.22 - self.obj_to_name[obj] = "%s%s%d" % (name, self.index_separator, n)
2.23 + obj._unique_name = "%s%s%d" % (name, self.index_separator, n)
2.24
2.25 naming = Naming()
2.26