1.1 --- a/common.py Sat Nov 26 23:05:45 2016 +0100
1.2 +++ b/common.py Sat Nov 26 23:07:09 2016 +0100
1.3 @@ -231,9 +231,26 @@
1.4
1.5 # Record the value and type for the constant.
1.6
1.7 - self.constant_values[objpath] = name_ref.value, name_ref.get_origin()
1.8 + self._reserve_constant(objpath, name_ref.value, name_ref.get_origin())
1.9 return name_ref
1.10
1.11 + def reserve_constant(self, objpath, value, origin):
1.12 +
1.13 + """
1.14 + Reserve a constant within 'objpath' with the given 'value' and having a
1.15 + type with the given 'origin'.
1.16 + """
1.17 +
1.18 + constant_name = self.get_constant_name(value)
1.19 + objpath = self.get_object_path(constant_name)
1.20 + self._reserve_constant(objpath, value, origin)
1.21 +
1.22 + def _reserve_constant(self, objpath, value, origin):
1.23 +
1.24 + "Store a constant for 'objpath' with the given 'value' and 'origin'."
1.25 +
1.26 + self.constant_values[objpath] = value, origin
1.27 +
1.28 def get_literal_reference(self, name, ref, items, cls):
1.29
1.30 """