# HG changeset patch # User Paul Boddie # Date 1716159632 -7200 # Node ID 2ef21d25c6e5361e6b10cd93fdf559cb7191179a # Parent 7b9b59b4501fe4821f5417d842c44530bb490f6a# Parent e8ff2a117367b904684095bebdf96d1a0ab2b2d8 Merged changes from the default branch. diff -r 7b9b59b4501f -r 2ef21d25c6e5 translator.py --- a/translator.py Sun May 19 22:53:57 2024 +0200 +++ b/translator.py Mon May 20 01:00:32 2024 +0200 @@ -607,9 +607,14 @@ # Record temporary name usage. + temps = set() + for sub in substituted: if self.temp_subs.has_key(sub): - self.record_temp(self.temp_subs[sub]) + temps.add(self.temp_subs[sub]) + + for temp in temps: + self.next_temp(temp) # Get full final identity details. @@ -1493,6 +1498,24 @@ len(args), "__ARGS(%s)" % argstr)) return InvocationResult(stages) + def next_temp(self, name): + + "Allocate the next temporary storage element for 'name'." + + if name == "__tmp_targets": + self.next_target() + elif name == "__tmp_contexts": + self.next_context() + elif name == "__tmp_values": + self.next_accessor() + elif name in ("__tmp_private_context", "__tmp_target_value", "__tmp_result"): + pass + else: + raise TranslateError("Temporary storage %s is not recognised." % name, + self.get_namespace_path()) + + self.record_temp(name) + def next_target(self): "Allocate the next function target storage." @@ -1582,15 +1605,17 @@ else: self.record_temp("__tmp_values") + accessor_index = self.accessor_index + self.next_accessor() return make_expression("""\ (__set_accessor(%d, __ATTRVALUE(__COPY(&%s, sizeof(%s)))), %s, __get_accessor(%d))""" % ( - self.accessor_index, + accessor_index, encode_path(function_name), encode_symbol("obj", function_name), ", ".join(defaults), - self.accessor_index)) + accessor_index)) def process_logical_node(self, n):