1.1 --- a/micropython/inspect.py Sun Oct 25 18:35:53 2009 +0100
1.2 +++ b/micropython/inspect.py Mon Oct 26 00:23:36 2009 +0100
1.3 @@ -417,6 +417,9 @@
1.4
1.5 def visitAssAttr(self, node):
1.6 expr = self.dispatch(node.expr)
1.7 +
1.8 + # Record the attribute on the presumed target.
1.9 +
1.10 if isinstance(expr, Attr):
1.11 if expr.name == "self":
1.12 if not self.store_class_attr(node.attrname):
1.13 @@ -424,6 +427,11 @@
1.14 elif isinstance(expr.get_value(), Module):
1.15 self.store_module_attr(node.attrname, expr.get_value())
1.16 print "Warning: attribute %r of module %r set outside the module." % (node.attrname, expr.get_value().name)
1.17 +
1.18 + # Note usage of the attribute.
1.19 +
1.20 + node._attrnames = expr.use_attribute(node.attrname)
1.21 +
1.22 return None
1.23
1.24 def visitAssList(self, node):
1.25 @@ -633,6 +641,8 @@
1.26 expr = self.dispatch(node.expr)
1.27 attrname = node.attrname
1.28
1.29 + # Attempt to identify the nature of the attribute.
1.30 +
1.31 if isinstance(expr, Attr):
1.32 value = expr.get_value()
1.33 if isinstance(value, (Class, Module)):
1.34 @@ -641,6 +651,11 @@
1.35 attr = UnresolvedName(attrname, value.full_name(), self)
1.36 else:
1.37 attr = None
1.38 +
1.39 + # Note usage of the attribute.
1.40 +
1.41 + node._attrnames = expr.use_attribute(node.attrname)
1.42 +
1.43 elif self.builtins is not None:
1.44 attr = self.builtins.get(attrname)
1.45 else: