Commit 64c45122 authored by mattip's avatar mattip

MAINT: refactor from review

parent 53eb14de
......@@ -2245,18 +2245,23 @@ class ReplacePropertyNode(CythonTransform):
return node
# transform @property decorators on ctypedef class functions
for decorator_node in node.decorators[::-1]:
decorator = decorator_node.decorator
if decorator.is_name and decorator.name == 'property':
if len(node.decorators) > 1:
return self._reject_decorated_property(node, decorator_node)
# Mark the node as a cgetter
node.type.is_cgetter = True
# Add a func_cname to be output instead of the attribute
node.entry.func_cname = node.body.stats[0].value.function.name
# done - remove the decorator node
_node = self.analyse_decorator(node, decorator_node.decorator)
if _node:
node.decorators.remove(decorator_node)
return [node]
return [node]
node = _node
break
return node
def analyse_decorator(self, node, decorator):
if decorator.is_name and decorator.name == 'property':
if len(node.decorators) > 1:
return self._reject_decorated_property(node, decorator_node)
# Mark the node as a cgetter
node.type.is_cgetter = True
# Add a func_cname to be output instead of the attribute
node.entry.func_cname = node.body.stats[0].value.function.name
return node
return None
class FindInvalidUseOfFusedTypes(CythonTransform):
......
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