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
44056f33
Commit
44056f33
authored
Dec 08, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix generation of active methods for template cypclasses
parent
8d153541
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+7
-1
tests/compile/cypclass_template_activable.pyx
tests/compile/cypclass_template_activable.pyx
+8
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
44056f33
...
...
@@ -1002,6 +1002,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
active_entry
=
reified_function_entry
.
active_entry
function_header
=
active_entry
.
type
.
function_header_code
(
active_entry
.
func_cname
,
activated_method_arg_decl_code
)
function_code
=
result_interface_type
.
declaration_code
(
function_header
)
if
entry
.
type
.
templates
:
templates_code
=
"template <typename %s>"
%
", typename "
.
join
(
t
.
name
for
t
in
entry
.
type
.
templates
)
code
.
putln
(
templates_code
)
code
.
putln
(
"%s {"
%
function_code
)
code
.
putln
(
"%s = this->%s();"
%
(
result_interface_type
.
declaration_code
(
"result_object"
),
result_attr_cname
))
...
...
@@ -1080,8 +1083,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
for
reified_function_entry
in
entry
.
type
.
scope
.
reified_entries
:
reifying_class_name
=
"%s%s"
%
(
Naming
.
cypclass_reified_prefix
,
reified_function_entry
.
name
)
reifying_class_full_name
=
"%s::%s"
%
(
PyrexTypes
.
namespace_declaration_code
(
entry
.
type
),
reifying_class_name
)
reifying_class_full_name
=
"%s::%s"
%
(
entry
.
type
.
empty_declaration_code
(
),
reifying_class_name
)
class_name
=
reifying_class_full_name
.
split
(
'::'
)[
-
1
]
if
entry
.
type
.
templates
:
templates_code
=
"template <typename %s>"
%
", typename "
.
join
(
t
.
name
for
t
in
entry
.
type
.
templates
)
code
.
putln
(
templates_code
)
code
.
putln
(
"struct %s : public %s {"
%
(
reifying_class_full_name
,
message_base_type
.
empty_declaration_code
()))
# Declaring target object & reified method arguments
code
.
putln
(
"%s;"
%
target_object_code
)
...
...
tests/compile/cypclass_template_activable.pyx
0 → 100644
View file @
44056f33
# tag: cpp
# mode: compile
cdef
cypclass
A
[
T
]
activable
:
int
foo
(
self
):
return
0
void
bar
(
self
):
pass
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