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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
ec9d4af3
Commit
ec9d4af3
authored
Apr 29, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial cypclass definition support in Nodes.py
parent
2bd2e7e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+16
-4
No files found.
Cython/Compiler/Nodes.py
View file @
ec9d4af3
...
@@ -7,7 +7,7 @@ from __future__ import absolute_import
...
@@ -7,7 +7,7 @@ from __future__ import absolute_import
import
cython
import
cython
cython
.
declare
(
sys
=
object
,
os
=
object
,
copy
=
object
,
cython
.
declare
(
sys
=
object
,
os
=
object
,
copy
=
object
,
Builtin
=
object
,
error
=
object
,
warning
=
object
,
Naming
=
object
,
PyrexTypes
=
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
,
StructOrUnionScope
=
object
,
PyClassScope
=
object
,
CppClassScope
=
object
,
UtilityCode
=
object
,
EncodedString
=
object
,
CppClassScope
=
object
,
UtilityCode
=
object
,
EncodedString
=
object
,
error_type
=
object
,
_py_int_types
=
object
)
error_type
=
object
,
_py_int_types
=
object
)
...
@@ -20,7 +20,7 @@ from .Errors import error, warning, InternalError, CompileError
...
@@ -20,7 +20,7 @@ from .Errors import error, warning, InternalError, CompileError
from
.
import
Naming
from
.
import
Naming
from
.
import
PyrexTypes
from
.
import
PyrexTypes
from
.
import
TypeSlots
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
,
from
.Symtab
import
(
ModuleScope
,
LocalScope
,
ClosureScope
,
StructOrUnionScope
,
PyClassScope
,
CppClassScope
,
TemplateScope
)
StructOrUnionScope
,
PyClassScope
,
CppClassScope
,
TemplateScope
)
from
.Code
import
UtilityCode
from
.Code
import
UtilityCode
...
@@ -1013,6 +1013,9 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
...
@@ -1013,6 +1013,9 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
error
(
self
.
pos
,
"Unrecognised type modifier combination"
)
error
(
self
.
pos
,
"Unrecognised type modifier combination"
)
elif
self
.
name
==
"object"
and
not
self
.
module_path
:
elif
self
.
name
==
"object"
and
not
self
.
module_path
:
type
=
py_object_type
type
=
py_object_type
elif
self
.
name
==
"cyobject"
:
type
=
cy_object_type
self
.
arg_name
=
EncodedString
(
self
.
name
)
elif
self
.
name
is
None
:
elif
self
.
name
is
None
:
if
self
.
is_self_arg
and
env
.
is_c_class_scope
:
if
self
.
is_self_arg
and
env
.
is_c_class_scope
:
#print "CSimpleBaseTypeNode.analyse: defaulting to parent type" ###
#print "CSimpleBaseTypeNode.analyse: defaulting to parent type" ###
...
@@ -1479,9 +1482,18 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
...
@@ -1479,9 +1482,18 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
error
(
self
.
pos
,
"Required template parameters must precede optional template parameters."
)
error
(
self
.
pos
,
"Required template parameters must precede optional template parameters."
)
self
.
entry
=
env
.
declare_cpp_class
(
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
None
,
self
.
pos
,
self
.
cname
,
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
):
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
:
if
self
.
templates
is
None
:
template_types
=
template_names
=
None
template_types
=
template_names
=
None
else
:
else
:
...
@@ -1499,7 +1511,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
...
@@ -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
])
base_class_types
=
filter
(
base_ok
,
[
b
.
analyse
(
scope
or
env
)
for
b
in
self
.
base_classes
])
self
.
entry
=
env
.
declare_cpp_class
(
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
scope
,
self
.
pos
,
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
:
if
self
.
entry
is
None
:
return
return
self
.
entry
.
is_cpp_class
=
1
self
.
entry
.
is_cpp_class
=
1
...
...
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