1.1 --- a/micropython/__init__.py Sun Jun 26 17:01:29 2011 +0200
1.2 +++ b/micropython/__init__.py Sun Jun 26 23:54:37 2011 +0200
1.3 @@ -37,8 +37,7 @@
1.4 which the functionality of the micropython package may be accessed.
1.5 """
1.6
1.7 -from micropython.common import ObjectSet, ProcessingError, TableError, \
1.8 - TableGenerationError
1.9 +from micropython.common import *
1.10 import micropython.ast
1.11 import micropython.data
1.12 import micropython.opt
1.13 @@ -95,13 +94,14 @@
1.14 self.get_parameter_table()
1.15
1.16 self.importer.vacuum(objtable)
1.17 - self.importer.finalise()
1.18
1.19 # Now remove unneeded things from the tables.
1.20
1.21 - self.get_object_table(reset=1)
1.22 + objtable = self.get_object_table(reset=1)
1.23 self.get_parameter_table(reset=1)
1.24
1.25 + self.importer.finalise(objtable)
1.26 +
1.27 def get_image(self, with_builtins=0):
1.28
1.29 """
1.30 @@ -432,7 +432,7 @@
1.31
1.32 self.vacuumed = 1
1.33
1.34 - def finalise(self):
1.35 + def finalise(self, objtable):
1.36
1.37 "Finalise the program (which should have been vacuumed first)."
1.38
1.39 @@ -447,7 +447,7 @@
1.40 # Prepare module information again.
1.41
1.42 for module in self.get_modules():
1.43 - module.finalise()
1.44 + module.finalise(objtable)
1.45
1.46 self.finalised = 1
1.47
1.48 @@ -612,25 +612,9 @@
1.49 # Using all attribute names for a particular name, attempt to get
1.50 # specific object types.
1.51
1.52 - all_objtypes = set()
1.53 -
1.54 - for attrnames in usage:
1.55 - objtypes = objtable.all_possible_objects_plus_status(attrnames)
1.56 - if not objtypes:
1.57 - print "Warning: usage in %r for %r finds no object supporting all attributes %r" % (from_name, name, attrnames)
1.58 - objtypes = objtable.any_possible_objects_plus_status(attrnames)
1.59 - if not objtypes:
1.60 - print "Warning: usage in %r for %r finds no object supporting any attributes %r" % (from_name, name, attrnames)
1.61 + all_objtypes = get_object_types_for_usage(usage, objtable, name, from_name)
1.62
1.63 - all_objtypes.update(objtypes)
1.64 -
1.65 - # Record the object types for generating guards.
1.66 -
1.67 - if user is not None:
1.68 - if not hasattr(user, "_attrtypes"):
1.69 - user._attrtypes = {}
1.70 -
1.71 - user._attrtypes[name] = all_objtypes
1.72 + # Investigate the object types.
1.73
1.74 self._collect_attributes_for_types(from_name, objtable, all_objtypes, usage)
1.75