Commit ca53faeb authored by Robert Bradshaw's avatar Robert Bradshaw

De-allocate function temp variables _after_ computing return value, in case an...

De-allocate function temp variables _after_ computing return value, in case an exception is thrown, caught, and said temp variables still need to be accessed.
parent f3a3bbcf
......@@ -2933,8 +2933,6 @@ class ReturnStatNode(StatNode):
if not self.return_type:
# error reported earlier
return
for entry in self.temps_in_use:
code.put_var_decref_clear(entry)
if self.value:
self.value.generate_evaluation_code(code)
self.value.make_owned_reference(code)
......@@ -2951,6 +2949,8 @@ class ReturnStatNode(StatNode):
"%s = %s;" % (
Naming.retval_cname,
self.return_type.default_value))
for entry in self.temps_in_use:
code.put_var_decref_clear(entry)
code.putln(
"goto %s;" %
code.return_label)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment