1.1 --- a/optimiser.py Tue Dec 13 19:19:23 2016 +0100
1.2 +++ b/optimiser.py Tue Dec 13 22:46:52 2016 +0100
1.3 @@ -274,10 +274,12 @@
1.4
1.5 f = open(join(self.output, "constants"), "w")
1.6 try:
1.7 - constants = [(n, value) for (value, n) in self.constants.items()]
1.8 + constants = []
1.9 + for (value, value_type), n in self.constants.items():
1.10 + constants.append((n, value_type, value))
1.11 constants.sort()
1.12 - for n, value in constants:
1.13 - print >>f, repr(value)
1.14 + for n, value_type, value in constants:
1.15 + print >>f, value_type, repr(value)
1.16
1.17 finally:
1.18 f.close()
1.19 @@ -644,16 +646,17 @@
1.20 self.constants = {}
1.21
1.22 for path, constants in self.importer.all_constants.items():
1.23 - for constant, n in constants.items():
1.24
1.25 - # Record constants and obtain a number for them.
1.26 + # Record constants and obtain a number for them.
1.27 + # Each constant is actually (value, value_type).
1.28
1.29 + for constant, n in constants.items():
1.30 add_counter_item(self.constants, constant)
1.31
1.32 self.constant_numbers = {}
1.33
1.34 - for name, (value, value_type) in self.importer.all_constant_values.items():
1.35 - self.constant_numbers[name] = self.constants[value]
1.36 + for name, constant in self.importer.all_constant_values.items():
1.37 + self.constant_numbers[name] = self.constants[constant]
1.38
1.39 def combine_rows(a, b):
1.40 c = []