Commit 27f4b996 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Fix #200 (together with Lisandro Dalcin)

parent 83740a00
...@@ -1054,6 +1054,8 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1054,6 +1054,8 @@ class FuncDefNode(StatNode, BlockNode):
code.put_var_declarations(lenv.var_entries) code.put_var_declarations(lenv.var_entries)
init = "" init = ""
if not self.return_type.is_void: if not self.return_type.is_void:
if self.return_type.is_pyobject:
init = " = NULL"
code.putln( code.putln(
"%s%s;" % "%s%s;" %
(self.return_type.declaration_code( (self.return_type.declaration_code(
...@@ -3370,6 +3372,9 @@ class ReturnStatNode(StatNode): ...@@ -3370,6 +3372,9 @@ class ReturnStatNode(StatNode):
if not self.return_type: if not self.return_type:
# error reported earlier # error reported earlier
return return
if self.return_type.is_pyobject:
code.put_xdecref(Naming.retval_cname,
self.return_type)
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)
......
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