Commit b2b013da authored by Xavier Thompson's avatar Xavier Thompson

Make dedicated node for cypclass wrapping c class

parent 28fbaed2
...@@ -167,7 +167,7 @@ class CypclassWrapperInjection(VisitorTransform): ...@@ -167,7 +167,7 @@ class CypclassWrapperInjection(VisitorTransform):
cclass_body = Nodes.StatListNode(pos=node.pos, stats=stats) cclass_body = Nodes.StatListNode(pos=node.pos, stats=stats)
cclass_doc = EncodedString("Python Object wrapper for underlying cypclass %s" % node.name) cclass_doc = EncodedString("Python Object wrapper for underlying cypclass %s" % node.name)
wrapper = Nodes.CClassDefNode( wrapper = Nodes.CypclassWrapperDefNode(
node.pos, node.pos,
visibility = 'private', visibility = 'private',
typedef_flag = 0, typedef_flag = 0,
...@@ -182,10 +182,9 @@ class CypclassWrapperInjection(VisitorTransform): ...@@ -182,10 +182,9 @@ class CypclassWrapperInjection(VisitorTransform):
in_pxd = node.in_pxd, in_pxd = node.in_pxd,
doc = cclass_doc, doc = cclass_doc,
body = cclass_body, body = cclass_body,
is_cyp_wrapper = 1 wrapped_cypclass = node
) )
node.cyp_wrapper = wrapper
return wrapper return wrapper
def synthesize_underlying_cyobject_attribute(self, node): def synthesize_underlying_cyobject_attribute(self, node):
...@@ -219,26 +218,6 @@ class CypclassWrapperInjection(VisitorTransform): ...@@ -219,26 +218,6 @@ class CypclassWrapperInjection(VisitorTransform):
return underlying_cyobject return underlying_cyobject
#
# Post declaration analysis visitor for wrapped cypclasses
#
# - Associate the type of the wrapper cclass to the wrapped type
# => must run after AnalyseDeclarationsTransform
#
class CypclassPostDeclarationsVisitor(CythonTransform):
"""
Associate the type of each wrapper cclass to the wrapped type.
- Must run after the declarations analysis phase.
"""
# associate the type of the wrapper cclass to the type of the wrapped cypclass
def visit_CppClassNode(self, node):
if node.cypclass and node.cyp_wrapper:
node.entry.type.wrapper_type = node.cyp_wrapper.entry.type
self.visitchildren(node)
return node
# #
# Cypclass code generation # Cypclass code generation
......
This diff is collapsed.
...@@ -140,7 +140,7 @@ def inject_utility_code_stage_factory(context): ...@@ -140,7 +140,7 @@ def inject_utility_code_stage_factory(context):
def create_pipeline(context, mode, exclude_classes=()): def create_pipeline(context, mode, exclude_classes=()):
assert mode in ('pyx', 'py', 'pxd') assert mode in ('pyx', 'py', 'pxd')
from .Visitor import PrintTree from .Visitor import PrintTree
from .CypclassWrapper import CypclassWrapperInjection, CypclassPostDeclarationsVisitor from .CypclassWrapper import CypclassWrapperInjection
from .ParseTreeTransforms import WithTransform, NormalizeTree, PostParse, PxdPostParse from .ParseTreeTransforms import WithTransform, NormalizeTree, PostParse, PxdPostParse
from .ParseTreeTransforms import ForwardDeclareTypes, InjectGilHandling, AnalyseDeclarationsTransform from .ParseTreeTransforms import ForwardDeclareTypes, InjectGilHandling, AnalyseDeclarationsTransform
from .ParseTreeTransforms import AnalyseExpressionsTransform, FindInvalidUseOfFusedTypes from .ParseTreeTransforms import AnalyseExpressionsTransform, FindInvalidUseOfFusedTypes
...@@ -198,7 +198,6 @@ def create_pipeline(context, mode, exclude_classes=()): ...@@ -198,7 +198,6 @@ def create_pipeline(context, mode, exclude_classes=()):
ForwardDeclareTypes(context), ForwardDeclareTypes(context),
InjectGilHandling(), InjectGilHandling(),
AnalyseDeclarationsTransform(context), AnalyseDeclarationsTransform(context),
CypclassPostDeclarationsVisitor(context),
AutoTestDictTransform(context), AutoTestDictTransform(context),
EmbedSignature(context), EmbedSignature(context),
ReplacePropertyNode(context), ReplacePropertyNode(context),
......
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