1.1 --- a/transresults.py Sat May 25 17:55:37 2024 +0200
1.2 +++ b/transresults.py Sat May 25 18:02:58 2024 +0200
1.3 @@ -285,21 +285,23 @@
1.4
1.5 "A translation result for an invocation."
1.6
1.7 - def __init__(self, instructions, args=None):
1.8 + def __init__(self, instructions, result_type=None, args=None):
1.9 InstructionSequence.__init__(self, instructions)
1.10 + self.result_type = result_type
1.11 self.args = args
1.12
1.13 def yields_integer(self):
1.14 - return self.args and True or False
1.15 + return self.result_type == "__builtins__.int.int"
1.16
1.17 def __str__(self):
1.18 - if self.yields_integer():
1.19 + if self.yields_integer() and self.args is not None:
1.20 return ", ".join(self.args)
1.21 else:
1.22 return encode_instructions(self.instructions)
1.23
1.24 def __repr__(self):
1.25 - return "InvocationResult(%r, %r)" % (self.instructions, self.args)
1.26 + return "InvocationResult(%r, %r, %r)" % (self.instructions,
1.27 + self.result_type, self.args)
1.28
1.29 class InstantiationResult(InvocationResult, TrInstanceRef):
1.30
1.31 @@ -309,6 +311,9 @@
1.32 InstanceRef.__init__(self, ref)
1.33 InvocationResult.__init__(self, instructions)
1.34
1.35 + def yields_integer(self):
1.36 + return self.ref.get_origin() == "__builtins__.int.int"
1.37 +
1.38 def __repr__(self):
1.39 return "InstantiationResult(%r, %r)" % (self.ref, self.instructions)
1.40