# HG changeset patch # User paulb@jeremy # Date 1162251850 -3600 # Node ID c61ceee0c8d37e8a232449e175a703a7c76397b6 # Parent cf4d0daa1291c2afbf7312d67e0f521805211d86 Changed non_types to non_accesses. Tidied up the viewer output of types, non_accesses, accesses and writes. diff -r cf4d0daa1291 -r c61ceee0c8d3 annotate.py --- a/annotate.py Mon Oct 30 23:33:58 2006 +0100 +++ b/annotate.py Tue Oct 31 00:44:10 2006 +0100 @@ -294,14 +294,13 @@ def visitLoadAttr(self, loadattr): loadattr.expr = self.dispatch(loadattr.expr) types = [] - non_types = [] + non_accesses = [] accesses = {} for attr in self.namespace.types: attributes = get_attributes(attr.type, loadattr.name) if not attributes: - print "No attributes for", loadattr.name, "in", attr.type - if not attr.type in non_types: - non_types.append(attr) + if not attr.type in non_accesses: + non_accesses.append(attr) for attribute, accessor in attributes: if attribute is not None: types.append(attribute) @@ -310,11 +309,12 @@ if not (attribute, accessor) in accesses[attr.type]: accesses[attr.type].append((attribute, accessor)) else: - print "Empty attribute", loadattr.name, "via accessor", accessor - if not attr.type in non_types: - non_types.append(attr) + if not attr.type in non_accesses: + non_accesses.append(attr) + if not types: + print "No attribute found for", loadattr.name, "given", self.namespace.types self.namespace.set_types(types) - loadattr.non_types = non_types + loadattr.non_accesses = non_accesses loadattr.accesses = accesses self.annotate(loadattr) return loadattr diff -r cf4d0daa1291 -r c61ceee0c8d3 viewer.py --- a/viewer.py Mon Oct 30 23:33:58 2006 +0100 +++ b/viewer.py Tue Oct 31 00:44:10 2006 +0100 @@ -133,11 +133,6 @@ float: right; } - .non-types { - padding: 0.5em; background-color: #FF0000; - float: right; - } - .raises { padding: 0.5em; background-color: #7700FF; float: right; @@ -148,6 +143,11 @@ float: left; } + .non-accesses { + padding: 0.5em; background-color: #FF0000; + float: right; + } + .op, .name, .attr, @@ -726,11 +726,12 @@ def _types(self, node): if hasattr(node, "types"): - self._types_list(node.types) - if hasattr(node, "non_types") and node.non_types: - self._types_list(node.non_types, style_class="non-types") - elif hasattr(node, "writes"): - self._types_list(flatten(node.writes.values())) + if node.types: + self._types_list(node.types) + else: + self.stream.write("
\n") + self.stream.write("no types\n") + self.stream.write("
\n") else: self.stream.write("
\n") self.stream.write("unvisited\n") @@ -751,7 +752,7 @@ def _scopes(self, node): if not isinstance(node, LoadName): - if hasattr(node, "writes") or hasattr(node, "accesses"): + if hasattr(node, "writes") and node.writes or hasattr(node, "accesses") and node.accesses: self.stream.write("
\n") for ref in getattr(node, "writes", getattr(node, "accesses", {})).keys(): fn = ref.full_name() @@ -759,6 +760,8 @@ self.stream.write(self._text(fn)) self.stream.write("
\n") self.stream.write("
\n") + if hasattr(node, "non_accesses") and node.non_accesses: + self._types_list(node.non_accesses, style_class="non-accesses") # Utility functions.