1.1 --- a/translator.py Thu Mar 30 18:48:36 2017 +0200
1.2 +++ b/translator.py Thu Mar 30 19:41:24 2017 +0200
1.3 @@ -19,7 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from common import CommonModule, CommonOutput, \
1.8 +from common import AccessLocation, CommonModule, CommonOutput, Location, \
1.9 first, get_builtin_class, init_item, is_newer, \
1.10 predefined_constants
1.11 from encoders import encode_access_instruction, encode_access_instruction_arg, \
1.12 @@ -648,7 +648,7 @@
1.13 # Determine whether any deduced references refer to the accessed
1.14 # attribute.
1.15
1.16 - path, accessor_name, attrnames, access_number = location
1.17 + attrnames = location.attrnames
1.18 attrnames = attrnames and attrnames.split(".")
1.19 remaining = attrnames and len(attrnames) > 1
1.20
1.21 @@ -695,7 +695,7 @@
1.22 attrnames = attrnames and ".".join(self.attrs)
1.23 access_number = self.get_access_number(path, name, attrnames)
1.24 self.update_access_number(path, name, attrnames)
1.25 - return (path, name, attrnames, access_number)
1.26 + return AccessLocation(path, name, attrnames, access_number)
1.27
1.28 def get_access_number(self, path, name, attrnames):
1.29 access = name, attrnames
1.30 @@ -723,9 +723,9 @@
1.31 # Get the location used by the deducer and optimiser and find any
1.32 # recorded accessor.
1.33
1.34 - access_number = self.get_accessor_number(path, name)
1.35 + version = self.get_accessor_number(path, name)
1.36 self.update_accessor_number(path, name)
1.37 - return (path, name, None, access_number)
1.38 + return Location(path, name, None, version)
1.39
1.40 def get_accessor_number(self, path, name):
1.41 if self.attr_accessors.has_key(path) and self.attr_accessors[path].has_key(name):
1.42 @@ -1127,7 +1127,7 @@
1.43
1.44 else:
1.45 if location:
1.46 - path, name, attrnames, access_number = location
1.47 + attrnames = location.attrnames
1.48 attrname = attrnames and attrnames.rsplit(".", 1)[-1]
1.49
1.50 # Determine any common aspects of any attribute.