Commit be671f42 authored by Robert Bradshaw's avatar Robert Bradshaw

Mark closure visitor

parent 185adaa1
...@@ -1883,9 +1883,10 @@ class OverrideCheckNode(StatNode): ...@@ -1883,9 +1883,10 @@ class OverrideCheckNode(StatNode):
# code.put_decref(self.func_temp, PyrexTypes.py_object_type) # code.put_decref(self.func_temp, PyrexTypes.py_object_type)
code.putln("}") code.putln("}")
class ClassDefNode(StatNode, BlockNode):
pass
class PyClassDefNode(ClassDefNode):
class PyClassDefNode(StatNode, BlockNode):
# A Python class definition. # A Python class definition.
# #
# name EncodedString Name of the class # name EncodedString Name of the class
...@@ -1957,7 +1958,7 @@ class PyClassDefNode(StatNode, BlockNode): ...@@ -1957,7 +1958,7 @@ class PyClassDefNode(StatNode, BlockNode):
self.dict.generate_disposal_code(code) self.dict.generate_disposal_code(code)
class CClassDefNode(StatNode, BlockNode): class CClassDefNode(ClassDefNode):
# An extension type definition. # An extension type definition.
# #
# visibility 'private' or 'public' or 'extern' # visibility 'private' or 'public' or 'extern'
......
...@@ -185,3 +185,26 @@ class AnalyseExpressionsTransform(VisitorTransform): ...@@ -185,3 +185,26 @@ class AnalyseExpressionsTransform(VisitorTransform):
self.visitchildren(node) self.visitchildren(node)
return node return node
class MarkClosureNode(VisitorTransform):
needs_closure = False
def visit_FuncDefNode(self, node):
self.needs_closure = False
self.visitchildren(node)
node.needs_closure = self.needs_closure
self.needs_closure = True
return node
def visit_ClassDefNode(self, node):
self.visitchildren(node)
self.needs_closure = True
return node
def visit_YieldNode(self, node):
self.needs_closure = True
def visit_Node(self, node):
self.visitchildren(node)
return node
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