Fix non-template nested class declarations.
authorRobert Bradshaw <robertwb@gmail.com>
Tue, 30 Oct 2012 08:07:20 +0000 (01:07 -0700)
committerRobert Bradshaw <robertwb@gmail.com>
Tue, 30 Oct 2012 08:07:20 +0000 (01:07 -0700)
Cython/Compiler/Nodes.py

index eb43d8c..b2f394e 100644 (file)
@@ -818,9 +818,21 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
                 type = py_object_type
         else:
             if self.module_path:
-                scope = env.find_imported_module(self.module_path, self.pos)
-                if scope:
-                    scope.fused_to_specific = env.fused_to_specific
+                # Maybe it's a nested C++ class.
+                scope = env
+                for item in self.module_path:
+                    entry = scope.lookup(item)
+                    if entry.is_cpp_class:
+                        scope = entry.type.scope
+                    else:
+                        scope = None
+                        break
+                
+                if scope is None:
+                    # Maybe it's a cimport.
+                    scope = env.find_imported_module(self.module_path, self.pos)
+                    if scope:
+                        scope.fused_to_specific = env.fused_to_specific
             else:
                 scope = env