# HG changeset patch # User Paul Boddie # Date 1530826853 -7200 # Node ID d305986d05c873a86f06471ec962e69de543b7c7 # Parent 3b243cd23b58d6251a35e5ab633b57eb9d1c0842 Employed sets for attributes and providers referenced by accesses. This causes various attributes to be identified definitively in the access plans and instruction sequences. diff -r 3b243cd23b58 -r d305986d05c8 deducer.py --- a/deducer.py Thu Jul 05 19:34:04 2018 +0200 +++ b/deducer.py Thu Jul 05 23:40:53 2018 +0200 @@ -659,24 +659,22 @@ attrname = location.get_attrname() - self.reference_all_attrs[location] = all_accessed_attrs = [] - self.reference_all_providers[location] = all_providers = [] + self.reference_all_attrs[location] = all_accessed_attrs = set() + self.reference_all_providers[location] = all_providers = set() self.reference_all_provider_kinds[location] = all_provider_kinds = set() # Obtain provider and attribute details for this kind of # object. for attrtype, object_type, attr in referenced_attrs: - all_accessed_attrs.append(attr) - all_providers.append(object_type) + all_accessed_attrs.add(attr) + all_providers.add(object_type) all_provider_kinds.add(attrtype) # Obtain reference and provider information as sets for the # operations below, retaining the list forms for use with # instruction plan preparation. - all_accessed_attrs = set(all_accessed_attrs) - all_providers = set(all_providers) all_general_providers = self.get_most_general_types(all_providers) # Determine which attributes would be provided by the @@ -1930,9 +1928,9 @@ "Return the references identified for 'access_location'." - attrs = [] + attrs = set() for attrtype, object_type, attr in self.referenced_attrs[access_location]: - attrs.append(attr) + attrs.add(attr) return attrs def convert_invocation_providers(self, refs, invocation): diff -r 3b243cd23b58 -r d305986d05c8 translator.py --- a/translator.py Thu Jul 05 19:34:04 2018 +0200 +++ b/translator.py Thu Jul 05 23:40:53 2018 +0200 @@ -601,8 +601,7 @@ # Get full final identity details. if final_identity and not refs: - ref = self.importer.identify(final_identity) - refs = [ref] + refs = set([self.importer.identify(final_identity)]) del self.attrs[0] return AttrResult(output, refs, location, context_identity, context_identity_verified, accessor_test) @@ -661,14 +660,9 @@ access_location = self.deducer.const_accesses.get(location) if remaining and not access_location: - return [] - - refs = [] - l = self.deducer.referenced_attrs.get(access_location or location) - if l: - for attrtype, objpath, attr in l: - refs.append(attr) - return refs + return set() + + return self.deducer.get_references_for_access(access_location or location) def get_referenced_attribute_invocations(self, location):