1.1 --- a/micropython/data.py Sat Nov 03 00:35:47 2012 +0100
1.2 +++ b/micropython/data.py Sun Nov 04 23:31:22 2012 +0100
1.3 @@ -493,7 +493,7 @@
1.4
1.5 # Collect unfinished contributors and affected nodes.
1.6
1.7 - # Where the contributor is already set to None, a loop has
1.8 + # Where the contributor is already set to Unset, a loop has
1.9 # occurred and this node will need to have its usage
1.10 # recalculated later for the unfinished contributor.
1.11
1.12 @@ -1656,18 +1656,6 @@
1.13 self.allattr[name] = attr
1.14 return self.allattr
1.15
1.16 -class TypeClass(Class):
1.17 -
1.18 - "A special class for the type class."
1.19 -
1.20 - pass
1.21 -
1.22 -class CommonClass(Class):
1.23 -
1.24 - "An inspected class."
1.25 -
1.26 - pass
1.27 -
1.28 class Function(NamespaceDict, Naming, Constant):
1.29
1.30 "An inspected function."
1.31 @@ -2150,9 +2138,18 @@
1.32 else:
1.33 self.importer.use_name(attrname, self.full_name(), value)
1.34
1.35 -# Pre-made instances.
1.36 -
1.37 -type_class = TypeClass("type") # details to be filled in later
1.38 +# Pre-made class instances.
1.39 +# For each of these, their details will be filled in later.
1.40 +
1.41 +premade = {
1.42 + "bool" : Class("bool"),
1.43 + "float" : Class("float"),
1.44 + "int" : Class("int"),
1.45 + "long" : Class("long"),
1.46 + "str" : Class("str"),
1.47 + "unicode" : Class("unicode"),
1.48 + "type" : Class("type"),
1.49 + }
1.50
1.51 # Class construction.
1.52
1.53 @@ -2163,11 +2160,12 @@
1.54 'module' and 'node'.
1.55 """
1.56
1.57 - if name == "type" and module.full_name() == "__builtins__":
1.58 - type_class.set_context(parent, module, node)
1.59 - return type_class
1.60 + if premade.has_key(name) and module.full_name() == "__builtins__":
1.61 + cls = premade[name]
1.62 + cls.set_context(parent, module, node)
1.63 + return cls
1.64 else:
1.65 - return CommonClass(name, parent, module, node)
1.66 + return Class(name, parent, module, node)
1.67
1.68 # Lambda sequence numbering.
1.69