# HG changeset patch # User Paul Boddie # Date 1276906498 -7200 # Node ID 7775a7a9fbbfb4c11b95c74e8ef5580eb4b4cb34 # Parent 3d45965e06d03d386312b86c89ac33a8a46308c1 Fixed usage of built-in types, also fixing declarations of specific attribute usage to apply to the actual namespace under inspection (not the module, which was inadvertently the case before this fix). diff -r 3d45965e06d0 -r 7775a7a9fbbf micropython/data.py --- a/micropython/data.py Thu Jun 17 00:35:37 2010 +0200 +++ b/micropython/data.py Sat Jun 19 02:14:58 2010 +0200 @@ -351,6 +351,15 @@ def use_specific_attribute(self, objname, attrname): + "Declare the usage on 'objname' of the given 'attrname'." + + self._use_specific_attribute(objname, attrname) + + # These shadow various methods in the InspectedModule class, and provide + # implementations generally. + + def _use_specific_attribute(self, objname, attrname): + """ Note attribute usage specifically on 'objname' - an object which is known at inspection time - or in the current unit if 'objname' is None, @@ -367,9 +376,6 @@ if importer is not None: importer.use_specific_name(objname, attrname, from_name) - # These shadow various methods in the InspectedModule class, and provide - # implementations generally. - def _use_attribute(self, name, attrname): """ diff -r 3d45965e06d0 -r 7775a7a9fbbf micropython/inspect.py --- a/micropython/inspect.py Thu Jun 17 00:35:37 2010 +0200 +++ b/micropython/inspect.py Sat Jun 19 02:14:58 2010 +0200 @@ -378,6 +378,15 @@ return self.get_namespace()._use_attribute(name, attrname) + def use_specific_attribute(self, objname, attrname): + + """ + Note usage on the object having the given 'objname' of the attribute + 'attrname'. + """ + + return self.get_namespace()._use_specific_attribute(objname, attrname) + # Visitor methods. def default(self, node, *args): @@ -864,7 +873,7 @@ visitLeftShift = _visitBinary def visitList(self, node): - self.use_attribute("__builtins__", "list") + self.use_specific_attribute("__builtins__", "list") self.OP(node) def visitListComp(self, node): @@ -934,7 +943,7 @@ visitRightShift = _visitBinary def visitSlice(self, node): - self.use_attribute("__builtins__", "slice") + self.use_specific_attribute("__builtins__", "slice") self.use_name("__getitem__", node) self.OP(node)