1.1 --- a/micropython/__init__.py Sun Jul 12 03:28:40 2009 +0200
1.2 +++ b/micropython/__init__.py Sun Jul 12 03:31:48 2009 +0200
1.3 @@ -515,7 +515,8 @@
1.4 "Return whether the given 'name' is used."
1.5
1.6 if self.names_used is None:
1.7 - self.names_used = set(["__init__", "__call__", "__bool__"])
1.8 + self.names_used = set(["bool", "__init__", "__call__", "__bool__", "__builtins__", "__main__"])
1.9 + self._collect_names("__builtins__")
1.10 self._collect_names("__main__")
1.11
1.12 return name in self.names_used
1.13 @@ -548,17 +549,18 @@
1.14 const = micropython.data.Const(value)
1.15 return self.constant_values[const]
1.16
1.17 + def get_constant_type_name(self, value):
1.18 + return value.__class__.__name__
1.19 +
1.20 def make_constant(self, value):
1.21
1.22 "Make and return a constant for the given 'value'."
1.23
1.24 # Ensure the presence of the constant's type.
1.25
1.26 - name = value.__class__.__name__
1.27 + name = self.get_constant_type_name(value)
1.28 if self.modules.has_key("__builtins__"):
1.29 attr = self.modules["__builtins__"].get(name)
1.30 - if attr is not None:
1.31 - attr.set_referenced()
1.32
1.33 # Make a constant object and return it.
1.34