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
2be36bce
Commit
2be36bce
authored
Sep 04, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up code generation for instanciated template parameters
parent
4d5173e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+9
-9
No files found.
Cython/Compiler/PyrexTypes.py
View file @
2be36bce
...
@@ -4133,7 +4133,7 @@ class CppClassType(CType):
...
@@ -4133,7 +4133,7 @@ class CppClassType(CType):
if
template_params
is
None
:
if
template_params
is
None
:
template_params
=
self
.
templates
template_params
=
self
.
templates
if
self
.
templates
:
if
self
.
templates
:
template_strings
=
[
param
.
declaration_code
(
''
,
for_display
,
None
,
pyrex
)
template_strings
=
[
template_parameter_code
(
param
,
for_display
,
pyrex
)
for
param
in
template_params
for
param
in
template_params
if
not
is_optional_template_param
(
param
)
and
not
param
.
is_fused
]
if
not
is_optional_template_param
(
param
)
and
not
param
.
is_fused
]
if
for_display
:
if
for_display
:
...
@@ -5044,13 +5044,7 @@ def best_match(arg_types, functions, pos=None, env=None, args=None, throw=False)
...
@@ -5044,13 +5044,7 @@ def best_match(arg_types, functions, pos=None, env=None, args=None, throw=False)
else
:
else
:
type_list
=
[
deductions
[
param
]
for
param
in
func_type
.
templates
]
type_list
=
[
deductions
[
param
]
for
param
in
func_type
.
templates
]
from
.Symtab
import
Entry
from
.Symtab
import
Entry
template_cstrings
=
[
template_cstrings
=
[
template_parameter_code
(
t
)
for
t
in
type_list
]
"%s%s"
%
(
t
.
empty_declaration_code
(),
"*"
if
t
.
is_cyp_class
else
""
)
for
t
in
type_list
]
specialization
=
Entry
(
specialization
=
Entry
(
name
=
func
.
name
+
"[%s]"
%
","
.
join
([
str
(
t
)
for
t
in
type_list
]),
name
=
func
.
name
+
"[%s]"
%
","
.
join
([
str
(
t
)
for
t
in
type_list
]),
cname
=
func
.
cname
+
"<%s>"
%
","
.
join
(
template_cstrings
),
cname
=
func
.
cname
+
"<%s>"
%
","
.
join
(
template_cstrings
),
...
@@ -5478,7 +5472,7 @@ def cap_length(s, max_prefix=63, max_len=1024):
...
@@ -5478,7 +5472,7 @@ def cap_length(s, max_prefix=63, max_len=1024):
def
namespace_declaration_code
(
namespace
):
def
namespace_declaration_code
(
namespace
):
"""
"""
Add 'typename' to the beginning of the declaration code when the namespace is template-dependent
Add 'typename' to the beginning of the declaration code when the namespace is template-dependent
.
"""
"""
base_code
=
namespace
.
empty_declaration_code
()
base_code
=
namespace
.
empty_declaration_code
()
if
not
base_code
.
startswith
(
"typename "
):
if
not
base_code
.
startswith
(
"typename "
):
...
@@ -5486,3 +5480,9 @@ def namespace_declaration_code(namespace):
...
@@ -5486,3 +5480,9 @@ def namespace_declaration_code(namespace):
if
any
(
isinstance
(
t
,
TemplatePlaceholderType
)
for
t
in
namespace
.
templates
):
if
any
(
isinstance
(
t
,
TemplatePlaceholderType
)
for
t
in
namespace
.
templates
):
base_code
=
"typename %s"
%
base_code
base_code
=
"typename %s"
%
base_code
return
base_code
return
base_code
def
template_parameter_code
(
T
,
for_display
=
0
,
pyrex
=
0
):
"""
Return the code string for a template parameter in a template instanciation.
"""
return
T
.
declaration_code
(
''
,
for_display
,
None
,
pyrex
)
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