summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ParseTreeTransforms.py
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@gmail.com>2014-07-17 00:47:30 -0700
committerRobert Bradshaw <robertwb@gmail.com>2014-07-17 00:47:30 -0700
commitfe73aba5a6a386000df7550ea1a2ff6bd99bd562 (patch)
tree41e97c6a618d5a4c95bc3c5f182387274533a36d /Cython/Compiler/ParseTreeTransforms.py
parent49d90c94815b9987156a6dc158fc724ae383749e (diff)
downloadcython-fe73aba5a6a386000df7550ea1a2ff6bd99bd562.tar.gz
Support @staticmethod decorator for C++ classes.
Diffstat (limited to 'Cython/Compiler/ParseTreeTransforms.py')
-rw-r--r--Cython/Compiler/ParseTreeTransforms.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index 26422ef33..8eb54d1fb 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -951,11 +951,11 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
for name, value in directives.iteritems():
if name == 'locals':
node.directive_locals = value
- elif name != 'final':
+ elif name not in ('final', 'staticmethod'):
self.context.nonfatal_error(PostParseError(
node.pos,
- "Cdef functions can only take cython.locals() "
- "or final decorators, got %s." % name))
+ "Cdef functions can only take cython.locals(), "
+ "staticmethod, or final decorators, got %s." % name))
body = Nodes.StatListNode(node.pos, stats=[node])
return self.visit_with_directives(body, directives)
@@ -966,6 +966,13 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
body = Nodes.StatListNode(node.pos, stats=[node])
return self.visit_with_directives(body, directives)
+ def visit_CppClassNode(self, node):
+ directives = self._extract_directives(node, 'cppclass')
+ if not directives:
+ return self.visit_Node(node)
+ body = Nodes.StatListNode(node.pos, stats=[node])
+ return self.visit_with_directives(body, directives)
+
def visit_PyClassDefNode(self, node):
directives = self._extract_directives(node, 'class')
if not directives: