1.1 --- a/simplify/annotate.py Tue Jun 12 00:35:23 2007 +0200
1.2 +++ b/simplify/annotate.py Sat Jun 16 01:57:38 2007 +0200
1.3 @@ -603,7 +603,7 @@
1.4 self.dispatch(loadattr.expr)
1.5 types = set()
1.6 raises = set()
1.7 - non_accesses = []
1.8 + non_accesses = set()
1.9 accesses = {}
1.10
1.11 # For each expression type...
1.12 @@ -621,7 +621,7 @@
1.13 # Register new invalid accesses and mark a possible exception.
1.14
1.15 if not attr in non_accesses:
1.16 - non_accesses.append(attr)
1.17 + non_accesses.add(attr)
1.18 exc = self.get_builtin_instances(loadattr, "AttributeError")
1.19 raises.update(exc)
1.20 self.namespace.raises.update(exc)
1.21 @@ -649,7 +649,7 @@
1.22
1.23 else:
1.24 if not attr in non_accesses:
1.25 - non_accesses.append(attr)
1.26 + non_accesses.add(attr)
1.27 exc = self.get_builtin_instances(loadattr, "AttributeError")
1.28 raises.update(exc)
1.29 self.namespace.raises.update(exc)
1.30 @@ -865,12 +865,12 @@
1.31 expr = self.namespace.types
1.32 self.dispatch(storeattr.lvalue)
1.33 writes = {}
1.34 - non_writes = []
1.35 + non_writes = set()
1.36 for attr in self.namespace.types:
1.37 # NOTE: Impose "atomic" constraints on certain types.
1.38 if attr is None:
1.39 if not attr in non_writes:
1.40 - non_writes.append(attr)
1.41 + non_writes.add(attr)
1.42 continue
1.43 attr.type.namespace.add(storeattr.name, expr)
1.44 writes[attr.type] = attr.type.namespace.load(storeattr.name)
2.1 --- a/simplify/viewer.py Tue Jun 12 00:35:23 2007 +0200
2.2 +++ b/simplify/viewer.py Sat Jun 16 01:57:38 2007 +0200
2.3 @@ -85,9 +85,9 @@
2.4 float: left;
2.5 }
2.6
2.7 - .non-writes, .non-accesses {
2.8 + .non-scopes {
2.9 padding: 0.5em; background-color: #FF0000;
2.10 - float: right;
2.11 + float: left;
2.12 }
2.13
2.14 .no-types {
2.15 @@ -1246,6 +1246,7 @@
2.16 "Output the scope information for the given simplified 'nodes'."
2.17
2.18 labels = {}
2.19 + non_labels = {}
2.20 for node in nodes:
2.21
2.22 # Straightforward name loading/storing involves the local scope.
2.23 @@ -1280,15 +1281,24 @@
2.24 # Non-loading...
2.25
2.26 if hasattr(node, "non_accesses") and node.non_accesses:
2.27 - self._types_container(node.non_accesses, "non-accesses")
2.28 + for attr in node.non_accesses:
2.29 + fn = attr.type.full_name()
2.30 + non_labels[self._text(fn)] = None
2.31
2.32 # Non-storing...
2.33
2.34 if hasattr(node, "non_writes") and node.non_writes:
2.35 - self._types_container(node.non_writes, "non-writes")
2.36 + for attr in node.non_writes:
2.37 + fn = attr.type.full_name()
2.38 + non_labels[self._text(fn)] = None
2.39
2.40 if labels:
2.41 - return [("scopes", "scope", labels.keys())]
2.42 + spec = []
2.43 + if labels:
2.44 + spec.append(("scopes", "scope", labels.keys()))
2.45 + if non_labels:
2.46 + spec.append(("non-scopes", "scope", non_labels.keys()))
2.47 + return spec
2.48 else:
2.49 return []
2.50