1.1 --- a/micropython/data.py Thu Jun 17 00:35:37 2010 +0200
1.2 +++ b/micropython/data.py Sat Jun 19 02:14:58 2010 +0200
1.3 @@ -351,6 +351,15 @@
1.4
1.5 def use_specific_attribute(self, objname, attrname):
1.6
1.7 + "Declare the usage on 'objname' of the given 'attrname'."
1.8 +
1.9 + self._use_specific_attribute(objname, attrname)
1.10 +
1.11 + # These shadow various methods in the InspectedModule class, and provide
1.12 + # implementations generally.
1.13 +
1.14 + def _use_specific_attribute(self, objname, attrname):
1.15 +
1.16 """
1.17 Note attribute usage specifically on 'objname' - an object which is
1.18 known at inspection time - or in the current unit if 'objname' is None,
1.19 @@ -367,9 +376,6 @@
1.20 if importer is not None:
1.21 importer.use_specific_name(objname, attrname, from_name)
1.22
1.23 - # These shadow various methods in the InspectedModule class, and provide
1.24 - # implementations generally.
1.25 -
1.26 def _use_attribute(self, name, attrname):
1.27
1.28 """
2.1 --- a/micropython/inspect.py Thu Jun 17 00:35:37 2010 +0200
2.2 +++ b/micropython/inspect.py Sat Jun 19 02:14:58 2010 +0200
2.3 @@ -378,6 +378,15 @@
2.4
2.5 return self.get_namespace()._use_attribute(name, attrname)
2.6
2.7 + def use_specific_attribute(self, objname, attrname):
2.8 +
2.9 + """
2.10 + Note usage on the object having the given 'objname' of the attribute
2.11 + 'attrname'.
2.12 + """
2.13 +
2.14 + return self.get_namespace()._use_specific_attribute(objname, attrname)
2.15 +
2.16 # Visitor methods.
2.17
2.18 def default(self, node, *args):
2.19 @@ -864,7 +873,7 @@
2.20 visitLeftShift = _visitBinary
2.21
2.22 def visitList(self, node):
2.23 - self.use_attribute("__builtins__", "list")
2.24 + self.use_specific_attribute("__builtins__", "list")
2.25 self.OP(node)
2.26
2.27 def visitListComp(self, node):
2.28 @@ -934,7 +943,7 @@
2.29 visitRightShift = _visitBinary
2.30
2.31 def visitSlice(self, node):
2.32 - self.use_attribute("__builtins__", "slice")
2.33 + self.use_specific_attribute("__builtins__", "slice")
2.34 self.use_name("__getitem__", node)
2.35 self.OP(node)
2.36