1.1 --- a/translator.py Sun May 19 22:56:31 2024 +0200
1.2 +++ b/translator.py Mon May 20 01:03:20 2024 +0200
1.3 @@ -625,9 +625,14 @@
1.4
1.5 # Record temporary name usage.
1.6
1.7 + temps = set()
1.8 +
1.9 for sub in substituted:
1.10 if self.temp_subs.has_key(sub):
1.11 - self.record_temp(self.temp_subs[sub])
1.12 + temps.add(self.temp_subs[sub])
1.13 +
1.14 + for temp in temps:
1.15 + self.next_temp(temp)
1.16
1.17 # Get full final identity details.
1.18
1.19 @@ -1567,6 +1572,28 @@
1.20 self.max_accessor_index = 0
1.21 self.max_attribute_ref_index = 0
1.22
1.23 + def next_temp(self, name):
1.24 +
1.25 + "Allocate the next temporary storage element for 'name'."
1.26 +
1.27 + if name == "__tmp_results":
1.28 + self.next_result()
1.29 + elif name == "__tmp_targets":
1.30 + self.next_target()
1.31 + elif name == "__tmp_contexts":
1.32 + self.next_context()
1.33 + elif name == "__tmp_values":
1.34 + self.next_accessor()
1.35 + elif name == "__tmp_attr_refs":
1.36 + self.next_attribute_ref()
1.37 + elif name in ("__tmp_private_context", "__tmp_target_value", "__tmp_result"):
1.38 + pass
1.39 + else:
1.40 + raise TranslateError("Temporary storage %s is not recognised." % name,
1.41 + self.get_namespace_path())
1.42 +
1.43 + self.record_temp(name)
1.44 +
1.45 def next_result(self):
1.46
1.47 "Allocate the next result target storage."
1.48 @@ -1670,15 +1697,17 @@
1.49
1.50 else:
1.51 self.record_temp("__tmp_values")
1.52 + accessor_index = self.accessor_index
1.53 + self.next_accessor()
1.54 return make_expression("""\
1.55 (__set_accessor(%d, __ATTRVALUE(__COPY(&%s, sizeof(%s)))),
1.56 %s,
1.57 __get_accessor(%d))""" % (
1.58 - self.accessor_index,
1.59 + accessor_index,
1.60 encode_path(function_name),
1.61 encode_symbol("obj", function_name),
1.62 ", ".join(defaults),
1.63 - self.accessor_index))
1.64 + accessor_index))
1.65
1.66 def process_logical_node(self, n):
1.67