Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
19193e74
Commit
19193e74
authored
Jun 01, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make dedicated node for cypclass wrapping c class
parent
a782a197
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
163 deletions
+137
-163
Cython/Compiler/CypclassWrapper.py
Cython/Compiler/CypclassWrapper.py
+2
-23
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+134
-138
Cython/Compiler/Pipeline.py
Cython/Compiler/Pipeline.py
+1
-2
No files found.
Cython/Compiler/CypclassWrapper.py
View file @
19193e74
...
...
@@ -167,7 +167,7 @@ class CypclassWrapperInjection(VisitorTransform):
cclass_body
=
Nodes
.
StatListNode
(
pos
=
node
.
pos
,
stats
=
stats
)
cclass_doc
=
EncodedString
(
"Python Object wrapper for underlying cypclass %s"
%
node
.
name
)
wrapper
=
Nodes
.
C
Class
DefNode
(
wrapper
=
Nodes
.
C
ypclassWrapper
DefNode
(
node
.
pos
,
visibility
=
'private'
,
typedef_flag
=
0
,
...
...
@@ -182,10 +182,9 @@ class CypclassWrapperInjection(VisitorTransform):
in_pxd
=
node
.
in_pxd
,
doc
=
cclass_doc
,
body
=
cclass_body
,
is_cyp_wrapper
=
1
wrapped_cypclass
=
node
)
node
.
cyp_wrapper
=
wrapper
return
wrapper
def
synthesize_underlying_cyobject_attribute
(
self
,
node
):
...
...
@@ -219,26 +218,6 @@ class CypclassWrapperInjection(VisitorTransform):
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
...
...
Cython/Compiler/Nodes.py
View file @
19193e74
This diff is collapsed.
Click to expand it.
Cython/Compiler/Pipeline.py
View file @
19193e74
...
...
@@ -141,7 +141,7 @@ def inject_utility_code_stage_factory(context):
def
create_pipeline
(
context
,
mode
,
exclude_classes
=
()):
assert
mode
in
(
'pyx'
,
'py'
,
'pxd'
)
from
.Visitor
import
PrintTree
from
.CypclassWrapper
import
CypclassWrapperInjection
,
CypclassPostDeclarationsVisitor
from
.CypclassWrapper
import
CypclassWrapperInjection
from
.ParseTreeTransforms
import
WithTransform
,
NormalizeTree
,
PostParse
,
PxdPostParse
from
.ParseTreeTransforms
import
ForwardDeclareTypes
,
InjectGilHandling
,
AnalyseDeclarationsTransform
from
.ParseTreeTransforms
import
AnalyseExpressionsTransform
,
FindInvalidUseOfFusedTypes
...
...
@@ -199,7 +199,6 @@ def create_pipeline(context, mode, exclude_classes=()):
ForwardDeclareTypes
(
context
),
InjectGilHandling
(),
AnalyseDeclarationsTransform
(
context
),
CypclassPostDeclarationsVisitor
(
context
),
AutoTestDictTransform
(
context
),
EmbedSignature
(
context
),
EarlyReplaceBuiltinCalls
(
context
),
## Necessary?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment