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): ...@@ -2933,8 +2933,6 @@ class ReturnStatNode(StatNode):
if not self.return_type: if not self.return_type:
# error reported earlier # error reported earlier
return return
for entry in self.temps_in_use:
code.put_var_decref_clear(entry)
if self.value: if self.value:
self.value.generate_evaluation_code(code) self.value.generate_evaluation_code(code)
self.value.make_owned_reference(code) self.value.make_owned_reference(code)
...@@ -2951,6 +2949,8 @@ class ReturnStatNode(StatNode): ...@@ -2951,6 +2949,8 @@ class ReturnStatNode(StatNode):
"%s = %s;" % ( "%s = %s;" % (
Naming.retval_cname, Naming.retval_cname,
self.return_type.default_value)) self.return_type.default_value))
for entry in self.temps_in_use:
code.put_var_decref_clear(entry)
code.putln( code.putln(
"goto %s;" % "goto %s;" %
code.return_label) 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