Commit 19e88252 authored by Nikita Nemkin's avatar Nikita Nemkin

Allow cdef class decorators in Cython utility code.

parent 54bdaf56
...@@ -7952,10 +7952,14 @@ class CnameDecoratorNode(StatNode): ...@@ -7952,10 +7952,14 @@ class CnameDecoratorNode(StatNode):
def analyse_declarations(self, env): def analyse_declarations(self, env):
self.node.analyse_declarations(env) self.node.analyse_declarations(env)
self.is_function = isinstance(self.node, FuncDefNode) node = self.node
is_struct_or_enum = isinstance(self.node, (CStructOrUnionDefNode, if isinstance(node, CompilerDirectivesNode):
node = node.body.stats[0]
self.is_function = isinstance(node, FuncDefNode)
is_struct_or_enum = isinstance(node, (CStructOrUnionDefNode,
CEnumDefNode)) CEnumDefNode))
e = self.node.entry e = node.entry
if self.is_function: if self.is_function:
e.cname = self.cname e.cname = self.cname
...@@ -7966,7 +7970,7 @@ class CnameDecoratorNode(StatNode): ...@@ -7966,7 +7970,7 @@ class CnameDecoratorNode(StatNode):
elif is_struct_or_enum: elif is_struct_or_enum:
e.cname = e.type.cname = self.cname e.cname = e.type.cname = self.cname
else: else:
scope = self.node.scope scope = node.scope
e.cname = self.cname e.cname = self.cname
e.type.objstruct_cname = self.cname + '_obj' e.type.objstruct_cname = self.cname + '_obj'
......
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