Commit f121187a authored by gsamain's avatar gsamain

Allow c++ nested class definitions

parent 1ad402ca
...@@ -831,7 +831,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -831,7 +831,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def generate_typedef(self, entry, code): def generate_typedef(self, entry, code):
base_type = entry.type.typedef_base_type base_type = entry.type.typedef_base_type
if base_type.is_numeric: enclosing_scope = entry.scope
if base_type.is_numeric and not enclosing_scope.is_cpp_class_scope:
try: try:
writer = code.globalstate['numeric_typedefs'] writer = code.globalstate['numeric_typedefs']
except KeyError: except KeyError:
...@@ -909,6 +910,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -909,6 +910,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
[base_class.empty_declaration_code() for base_class in type.base_classes]) [base_class.empty_declaration_code() for base_class in type.base_classes])
code.put(" : public %s" % base_class_decl) code.put(" : public %s" % base_class_decl)
code.putln(" {") code.putln(" {")
self.generate_type_header_code(scope.type_entries, code)
py_attrs = [e for e in scope.entries.values() py_attrs = [e for e in scope.entries.values()
if e.type.is_pyobject and not e.is_inherited] if e.type.is_pyobject and not e.is_inherited]
has_virtual_methods = False has_virtual_methods = False
......
...@@ -1509,6 +1509,9 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode): ...@@ -1509,6 +1509,9 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
elif isinstance(attr, CompilerDirectivesNode): elif isinstance(attr, CompilerDirectivesNode):
for sub_attr in func_attributes(attr.body.stats): for sub_attr in func_attributes(attr.body.stats):
yield sub_attr yield sub_attr
elif isinstance(attr, CppClassNode):
for sub_attr in func_attributes(attr.attributes):
yield sub_attr
if self.attributes is not None: if self.attributes is not None:
if self.in_pxd and not env.in_cinclude: if self.in_pxd and not env.in_cinclude:
self.entry.defined_in_pxd = 1 self.entry.defined_in_pxd = 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