1.1 --- a/deducer.py Mon Mar 13 14:47:44 2017 +0100
1.2 +++ b/deducer.py Mon Mar 13 17:09:50 2017 +0100
1.3 @@ -22,7 +22,7 @@
1.4 from common import first, get_assigned_attributes, \
1.5 get_attrname_from_location, get_attrnames, \
1.6 get_invoked_attributes, get_name_path, init_item, \
1.7 - sorted_output, CommonOutput
1.8 + order_dependencies_partial, sorted_output, CommonOutput
1.9 from encoders import encode_access_location, encode_constrained, \
1.10 encode_instruction, encode_location, encode_usage, \
1.11 get_kinds, test_label_for_kind, test_label_for_type
1.12 @@ -146,6 +146,7 @@
1.13 self.init_accessors()
1.14 self.init_accesses()
1.15 self.init_aliases()
1.16 + self.init_alias_network()
1.17 self.modify_mutated_attributes()
1.18 self.identify_references()
1.19 self.classify_accessors()
1.20 @@ -1018,6 +1019,21 @@
1.21 self.alias_index[accessor_location] = updated_locations
1.22 return updated_locations
1.23
1.24 + def init_alias_network(self):
1.25 +
1.26 + """
1.27 + Initialise a network of aliases, their initialising accesses, and the
1.28 + accessors supporting those accesses.
1.29 + """
1.30 +
1.31 + self.alias_network = {}
1.32 + self.alias_network.update(self.alias_index)
1.33 +
1.34 + for accessor_location, access_locations in self.alias_index.items():
1.35 + for access_location in access_locations:
1.36 + if not self.alias_network.has_key(access_location):
1.37 + self.alias_network[access_location] = self.get_accessors_for_access(access_location)
1.38 +
1.39 # Attribute mutation for types.
1.40
1.41 def modify_mutated_attributes(self):
1.42 @@ -1352,8 +1368,9 @@
1.43 # Aliased name definitions. All aliases with usage will have been
1.44 # defined, but they may be refined according to referenced accesses.
1.45
1.46 - for accessor_location in self.alias_index.keys():
1.47 - self.record_types_for_alias(accessor_location)
1.48 + for location in order_dependencies_partial(self.alias_network):
1.49 + if self.alias_index.has_key(location):
1.50 + self.record_types_for_alias(location)
1.51
1.52 # Update accesses employing aliases.
1.53