1.1 --- a/micropython/inspect.py Sun Jul 03 20:11:13 2011 +0200
1.2 +++ b/micropython/inspect.py Sun Jul 03 22:51:51 2011 +0200
1.3 @@ -345,6 +345,13 @@
1.4 unit = self.get_namespace()
1.5 self.importer.use_name(name, unit.full_name(), value)
1.6
1.7 + def use_constant(self, const):
1.8 +
1.9 + "Use the given 'const' within the current namespace/unit."
1.10 +
1.11 + unit = self.get_namespace()
1.12 + self.importer.use_constant(const, unit.full_name())
1.13 +
1.14 # Attribute usage methods.
1.15 # These are convenience methods which refer to the specific namespace's
1.16 # implementation of these operations.
1.17 @@ -511,7 +518,9 @@
1.18 """
1.19
1.20 self.use_specific_attribute("__builtins__", self.importer.get_constant_type_name(value))
1.21 - return self.importer.make_constant(value)
1.22 + const = self.importer.make_constant(value)
1.23 + self.use_constant(const)
1.24 + return const
1.25
1.26 def _visitFunction(self, node, name):
1.27