Commit c8820cf9 authored by da-woods's avatar da-woods

Fixed optimizations in defined cppclass

The problem was they were being skipped with SkipDeclarations
parent b3f8a198
......@@ -52,6 +52,13 @@ class SkipDeclarations(object):
def visit_CStructOrUnionDefNode(self, node):
return node
def visit_CppClassNode(self, node):
if node.visibility == "extern":
return node
else:
self.visitchildren(node)
return node
class NormalizeTree(CythonTransform):
"""
......
......@@ -9,6 +9,7 @@ from libcpp cimport bool
from libcpp.memory cimport unique_ptr
from libcpp.vector cimport vector
from cython.operator cimport dereference as deref
import cython
cdef extern from "shapes.h" namespace "shapes":
cdef cppclass Shape:
......@@ -23,6 +24,9 @@ cdef cppclass RegularPolygon(Shape):
float area() const:
cdef double theta = pi / this.n
return this.radius * this.radius * sin(theta) * cos(theta) * this.n
@cython.test_assert_path_exists('//SwitchCaseNode') # optimized correctly (https://github.com/cython/cython/issues/4212)
int in_list(int x):
return x in [1,2,3]
def test_Poly(int n, float radius=1):
"""
......
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