micropython

Changeset

478:45f4bba5a1e6
2011-11-01 Paul Boddie raw files shortlog changelog graph Introduced attribute user finalisation to modules.
micropython/data.py (file) micropython/inspect.py (file)
     1.1 --- a/micropython/data.py	Mon Oct 31 20:40:40 2011 +0100
     1.2 +++ b/micropython/data.py	Tue Nov 01 01:16:09 2011 +0100
     1.3 @@ -411,6 +411,18 @@
     1.4  
     1.5                      importer.use_names(user, name, tuple([attrnames for attrnames in usage if attrnames]), self.full_name())
     1.6  
     1.7 +    def finalise_users(self, objtable):
     1.8 +
     1.9 +        "Record the object types for generating guards."
    1.10 +
    1.11 +        # Visit each user and examine the attribute usage for each name.
    1.12 +
    1.13 +        for user in self.all_attribute_users:
    1.14 +            user._attrtypes = {}
    1.15 +            for name, usage in user._attrcombined.items():
    1.16 +                if usage is not None:
    1.17 +                    user._attrtypes[name] = get_object_types_for_usage(usage, objtable, name, self.full_name())
    1.18 +
    1.19      def get_usage_from_contributors(self, node):
    1.20  
    1.21          """
    1.22 @@ -1876,18 +1888,6 @@
    1.23  
    1.24          return i
    1.25  
    1.26 -    def finalise_users(self, objtable):
    1.27 -
    1.28 -        "Record the object types for generating guards."
    1.29 -
    1.30 -        # Visit each user and examine the attribute usage for each name.
    1.31 -
    1.32 -        for user in self.all_attribute_users:
    1.33 -            user._attrtypes = {}
    1.34 -            for name, usage in user._attrcombined.items():
    1.35 -                if usage is not None:
    1.36 -                    user._attrtypes[name] = get_object_types_for_usage(usage, objtable, name, self.full_name())
    1.37 -
    1.38      def as_instantiator(self):
    1.39  
    1.40          "Make an instantiator function from a method, keeping all arguments."
     2.1 --- a/micropython/inspect.py	Mon Oct 31 20:40:40 2011 +0100
     2.2 +++ b/micropython/inspect.py	Tue Nov 01 01:16:09 2011 +0100
     2.3 @@ -253,6 +253,8 @@
     2.4          for obj in self.all_objects:
     2.5              obj.finalise(objtable)
     2.6  
     2.7 +        self.finalise_users(objtable)
     2.8 +
     2.9      def add_object(self, obj, any_scope=0):
    2.10  
    2.11          """