Commit 6ee3cf6e authored by Danilo Freitas's avatar Danilo Freitas

del statement for C++ objects

parent 96e2964e
...@@ -3386,7 +3386,7 @@ class DelStatNode(StatNode): ...@@ -3386,7 +3386,7 @@ class DelStatNode(StatNode):
def analyse_expressions(self, env): def analyse_expressions(self, env):
for arg in self.args: for arg in self.args:
arg.analyse_target_expression(env, None) arg.analyse_target_expression(env, None)
if arg.type.is_pyobject: if arg.type.is_pyobject or (arg.type.is_ptr and arg.type.base_type.is_cpp_class):
self.gil_check(env) self.gil_check(env)
else: else:
error(arg.pos, "Deletion of non-Python object") error(arg.pos, "Deletion of non-Python object")
...@@ -3398,6 +3398,8 @@ class DelStatNode(StatNode): ...@@ -3398,6 +3398,8 @@ class DelStatNode(StatNode):
for arg in self.args: for arg in self.args:
if arg.type.is_pyobject: if arg.type.is_pyobject:
arg.generate_deletion_code(code) arg.generate_deletion_code(code)
elif arg.type.is_ptr and arg.type.base_type.is_cpp_class:
code.putln("delete %s" % arg.name)
# else error reported earlier # else error reported earlier
def annotate(self, code): def annotate(self, 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