# HG changeset patch # User Paul Boddie # Date 1320106569 -3600 # Node ID 45f4bba5a1e62f805e15ea577ee86e86bc5fcd53 # Parent 22dca03fcccba5781c0475903c276f8668268b87 Introduced attribute user finalisation to modules. diff -r 22dca03fcccb -r 45f4bba5a1e6 micropython/data.py --- a/micropython/data.py Mon Oct 31 20:40:40 2011 +0100 +++ b/micropython/data.py Tue Nov 01 01:16:09 2011 +0100 @@ -411,6 +411,18 @@ importer.use_names(user, name, tuple([attrnames for attrnames in usage if attrnames]), self.full_name()) + def finalise_users(self, objtable): + + "Record the object types for generating guards." + + # Visit each user and examine the attribute usage for each name. + + for user in self.all_attribute_users: + user._attrtypes = {} + for name, usage in user._attrcombined.items(): + if usage is not None: + user._attrtypes[name] = get_object_types_for_usage(usage, objtable, name, self.full_name()) + def get_usage_from_contributors(self, node): """ @@ -1876,18 +1888,6 @@ return i - def finalise_users(self, objtable): - - "Record the object types for generating guards." - - # Visit each user and examine the attribute usage for each name. - - for user in self.all_attribute_users: - user._attrtypes = {} - for name, usage in user._attrcombined.items(): - if usage is not None: - user._attrtypes[name] = get_object_types_for_usage(usage, objtable, name, self.full_name()) - def as_instantiator(self): "Make an instantiator function from a method, keeping all arguments." diff -r 22dca03fcccb -r 45f4bba5a1e6 micropython/inspect.py --- a/micropython/inspect.py Mon Oct 31 20:40:40 2011 +0100 +++ b/micropython/inspect.py Tue Nov 01 01:16:09 2011 +0100 @@ -253,6 +253,8 @@ for obj in self.all_objects: obj.finalise(objtable) + self.finalise_users(objtable) + def add_object(self, obj, any_scope=0): """