Lichen

Changeset

843:d305986d05c8
2018-07-05 Paul Boddie raw files shortlog changelog graph Employed sets for attributes and providers referenced by accesses. This causes various attributes to be identified definitively in the access plans and instruction sequences.
deducer.py (file) translator.py (file)
     1.1 --- a/deducer.py	Thu Jul 05 19:34:04 2018 +0200
     1.2 +++ b/deducer.py	Thu Jul 05 23:40:53 2018 +0200
     1.3 @@ -659,24 +659,22 @@
     1.4  
     1.5              attrname = location.get_attrname()
     1.6  
     1.7 -            self.reference_all_attrs[location] = all_accessed_attrs = []
     1.8 -            self.reference_all_providers[location] = all_providers = []
     1.9 +            self.reference_all_attrs[location] = all_accessed_attrs = set()
    1.10 +            self.reference_all_providers[location] = all_providers = set()
    1.11              self.reference_all_provider_kinds[location] = all_provider_kinds = set()
    1.12  
    1.13              # Obtain provider and attribute details for this kind of
    1.14              # object.
    1.15  
    1.16              for attrtype, object_type, attr in referenced_attrs:
    1.17 -                all_accessed_attrs.append(attr)
    1.18 -                all_providers.append(object_type)
    1.19 +                all_accessed_attrs.add(attr)
    1.20 +                all_providers.add(object_type)
    1.21                  all_provider_kinds.add(attrtype)
    1.22  
    1.23              # Obtain reference and provider information as sets for the
    1.24              # operations below, retaining the list forms for use with
    1.25              # instruction plan preparation.
    1.26  
    1.27 -            all_accessed_attrs = set(all_accessed_attrs)
    1.28 -            all_providers = set(all_providers)
    1.29              all_general_providers = self.get_most_general_types(all_providers)
    1.30  
    1.31              # Determine which attributes would be provided by the
    1.32 @@ -1930,9 +1928,9 @@
    1.33  
    1.34          "Return the references identified for 'access_location'."
    1.35  
    1.36 -        attrs = []
    1.37 +        attrs = set()
    1.38          for attrtype, object_type, attr in self.referenced_attrs[access_location]:
    1.39 -            attrs.append(attr)
    1.40 +            attrs.add(attr)
    1.41          return attrs
    1.42  
    1.43      def convert_invocation_providers(self, refs, invocation):
     2.1 --- a/translator.py	Thu Jul 05 19:34:04 2018 +0200
     2.2 +++ b/translator.py	Thu Jul 05 23:40:53 2018 +0200
     2.3 @@ -601,8 +601,7 @@
     2.4          # Get full final identity details.
     2.5  
     2.6          if final_identity and not refs:
     2.7 -            ref = self.importer.identify(final_identity)
     2.8 -            refs = [ref]
     2.9 +            refs = set([self.importer.identify(final_identity)])
    2.10  
    2.11          del self.attrs[0]
    2.12          return AttrResult(output, refs, location, context_identity, context_identity_verified, accessor_test)
    2.13 @@ -661,14 +660,9 @@
    2.14          access_location = self.deducer.const_accesses.get(location)
    2.15  
    2.16          if remaining and not access_location:
    2.17 -            return []
    2.18 -
    2.19 -        refs = []
    2.20 -        l = self.deducer.referenced_attrs.get(access_location or location)
    2.21 -        if l:
    2.22 -            for attrtype, objpath, attr in l:
    2.23 -                refs.append(attr)
    2.24 -        return refs
    2.25 +            return set()
    2.26 +
    2.27 +        return self.deducer.get_references_for_access(access_location or location)
    2.28  
    2.29      def get_referenced_attribute_invocations(self, location):
    2.30