Commit ed0ba259 authored by gsamain's avatar gsamain

Cypclass generation in ModuleNode (with virtual inheritance)

parent fe702968
......@@ -6,7 +6,7 @@ from __future__ import absolute_import
import cython
cython.declare(Naming=object, Options=object, PyrexTypes=object, TypeSlots=object,
error=object, warning=object, py_object_type=object, UtilityCode=object,
error=object, warning=object, py_object_type=object, cy_object_type=object, UtilityCode=object,
EncodedString=object, re=object)
from collections import defaultdict
......@@ -27,7 +27,7 @@ from . import PyrexTypes
from . import Pythran
from .Errors import error, warning
from .PyrexTypes import py_object_type
from .PyrexTypes import py_object_type, cy_object_type
from ..Utils import open_new_file, replace_suffix, decode_filename, build_hex_version
from .Code import UtilityCode, IncludeCode
from .StringEncoding import EncodedString
......@@ -908,8 +908,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# Just let everything be public.
code.put("struct %s" % type.cname)
if type.base_classes:
base_class_decl = ", public ".join(
[base_class.empty_declaration_code() for base_class in type.base_classes])
base_class_list = [base_class.empty_declaration_code() for base_class in type.base_classes]
if type.is_cyp_class and type.base_classes[-1] is cy_object_type:
base_class_list[-1] = "virtual " + base_class_list[-1]
base_class_decl = ", public ".join(base_class_list)
code.put(" : public %s" % base_class_decl)
code.putln(" {")
self.generate_type_header_code(scope.type_entries, code)
......@@ -1012,6 +1014,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("%s& operator=(const %s& __Pyx_other);" % (type.cname, type.cname))
code.putln("};")
if type.is_cyp_class:
code.globalstate.use_utility_code(
UtilityCode.load_cached("CythonReferenceCounting", "ObjectHandling.c"))
def generate_enum_definition(self, entry, code):
code.mark_pos(entry.pos)
type = entry.type
......
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