1.1 --- a/annotate.py Mon Oct 30 23:33:58 2006 +0100
1.2 +++ b/annotate.py Tue Oct 31 00:44:10 2006 +0100
1.3 @@ -294,14 +294,13 @@
1.4 def visitLoadAttr(self, loadattr):
1.5 loadattr.expr = self.dispatch(loadattr.expr)
1.6 types = []
1.7 - non_types = []
1.8 + non_accesses = []
1.9 accesses = {}
1.10 for attr in self.namespace.types:
1.11 attributes = get_attributes(attr.type, loadattr.name)
1.12 if not attributes:
1.13 - print "No attributes for", loadattr.name, "in", attr.type
1.14 - if not attr.type in non_types:
1.15 - non_types.append(attr)
1.16 + if not attr.type in non_accesses:
1.17 + non_accesses.append(attr)
1.18 for attribute, accessor in attributes:
1.19 if attribute is not None:
1.20 types.append(attribute)
1.21 @@ -310,11 +309,12 @@
1.22 if not (attribute, accessor) in accesses[attr.type]:
1.23 accesses[attr.type].append((attribute, accessor))
1.24 else:
1.25 - print "Empty attribute", loadattr.name, "via accessor", accessor
1.26 - if not attr.type in non_types:
1.27 - non_types.append(attr)
1.28 + if not attr.type in non_accesses:
1.29 + non_accesses.append(attr)
1.30 + if not types:
1.31 + print "No attribute found for", loadattr.name, "given", self.namespace.types
1.32 self.namespace.set_types(types)
1.33 - loadattr.non_types = non_types
1.34 + loadattr.non_accesses = non_accesses
1.35 loadattr.accesses = accesses
1.36 self.annotate(loadattr)
1.37 return loadattr
2.1 --- a/viewer.py Mon Oct 30 23:33:58 2006 +0100
2.2 +++ b/viewer.py Tue Oct 31 00:44:10 2006 +0100
2.3 @@ -133,11 +133,6 @@
2.4 float: right;
2.5 }
2.6
2.7 - .non-types {
2.8 - padding: 0.5em; background-color: #FF0000;
2.9 - float: right;
2.10 - }
2.11 -
2.12 .raises {
2.13 padding: 0.5em; background-color: #7700FF;
2.14 float: right;
2.15 @@ -148,6 +143,11 @@
2.16 float: left;
2.17 }
2.18
2.19 + .non-accesses {
2.20 + padding: 0.5em; background-color: #FF0000;
2.21 + float: right;
2.22 + }
2.23 +
2.24 .op,
2.25 .name,
2.26 .attr,
2.27 @@ -726,11 +726,12 @@
2.28
2.29 def _types(self, node):
2.30 if hasattr(node, "types"):
2.31 - self._types_list(node.types)
2.32 - if hasattr(node, "non_types") and node.non_types:
2.33 - self._types_list(node.non_types, style_class="non-types")
2.34 - elif hasattr(node, "writes"):
2.35 - self._types_list(flatten(node.writes.values()))
2.36 + if node.types:
2.37 + self._types_list(node.types)
2.38 + else:
2.39 + self.stream.write("<div class='types'>\n")
2.40 + self.stream.write("no types\n")
2.41 + self.stream.write("</div>\n")
2.42 else:
2.43 self.stream.write("<div class='types'>\n")
2.44 self.stream.write("unvisited\n")
2.45 @@ -751,7 +752,7 @@
2.46
2.47 def _scopes(self, node):
2.48 if not isinstance(node, LoadName):
2.49 - if hasattr(node, "writes") or hasattr(node, "accesses"):
2.50 + if hasattr(node, "writes") and node.writes or hasattr(node, "accesses") and node.accesses:
2.51 self.stream.write("<div class='scopes'>\n")
2.52 for ref in getattr(node, "writes", getattr(node, "accesses", {})).keys():
2.53 fn = ref.full_name()
2.54 @@ -759,6 +760,8 @@
2.55 self.stream.write(self._text(fn))
2.56 self.stream.write("</div>\n")
2.57 self.stream.write("</div>\n")
2.58 + if hasattr(node, "non_accesses") and node.non_accesses:
2.59 + self._types_list(node.non_accesses, style_class="non-accesses")
2.60
2.61 # Utility functions.
2.62