Commit ec9d4af3 authored by gsamain's avatar gsamain

Initial cypclass definition support in Nodes.py

parent 2bd2e7e5
......@@ -7,7 +7,7 @@ from __future__ import absolute_import
import cython
cython.declare(sys=object, os=object, copy=object,
Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object,
py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=object,
py_object_type=object, cy_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=object,
StructOrUnionScope=object, PyClassScope=object,
CppClassScope=object, UtilityCode=object, EncodedString=object,
error_type=object, _py_int_types=object)
......@@ -20,7 +20,7 @@ from .Errors import error, warning, InternalError, CompileError
from . import Naming
from . import PyrexTypes
from . import TypeSlots
from .PyrexTypes import py_object_type, error_type
from .PyrexTypes import py_object_type, cy_object_type, error_type
from .Symtab import (ModuleScope, LocalScope, ClosureScope,
StructOrUnionScope, PyClassScope, CppClassScope, TemplateScope)
from .Code import UtilityCode
......@@ -1013,6 +1013,9 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
error(self.pos, "Unrecognised type modifier combination")
elif self.name == "object" and not self.module_path:
type = py_object_type
elif self.name == "cyobject":
type = cy_object_type
self.arg_name = EncodedString(self.name)
elif self.name is None:
if self.is_self_arg and env.is_c_class_scope:
#print "CSimpleBaseTypeNode.analyse: defaulting to parent type" ###
......@@ -1479,9 +1482,18 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
error(self.pos, "Required template parameters must precede optional template parameters.")
self.entry = env.declare_cpp_class(
self.name, None, self.pos, self.cname,
base_classes=[], visibility=self.visibility, templates=template_types)
base_classes=[], visibility=self.visibility, templates=template_types, cypclass=self.cypclass)
def analyse_declarations(self, env):
if self.cypclass:
cyobject_class = CSimpleBaseTypeNode(self.pos,
name = "cyobject", module_path = [],
is_basic_c_type = 0, signed = 0,
complex = 0, longness = 0,
is_self_arg = 0, templates = None
)
self.base_classes.append(cyobject_class)
if self.templates is None:
template_types = template_names = None
else:
......@@ -1499,7 +1511,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
base_class_types = filter(base_ok, [b.analyse(scope or env) for b in self.base_classes])
self.entry = env.declare_cpp_class(
self.name, scope, self.pos,
self.cname, base_class_types, visibility=self.visibility, templates=template_types)
self.cname, base_class_types, visibility=self.visibility, templates=template_types, cypclass=self.cypclass)
if self.entry is None:
return
self.entry.is_cpp_class = 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