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
9a0983ec
Commit
9a0983ec
authored
Nov 23, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove "is_reference" flags from C++ class type added in last pull request
parent
24992169
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
21 deletions
+15
-21
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-10
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+9
-8
No files found.
Cython/Compiler/ExprNodes.py
View file @
9a0983ec
...
...
@@ -2868,11 +2868,10 @@ class IndexNode(ExprNode):
else
:
template_values
=
[
self
.
index
]
type_node
=
Nodes
.
TemplatedTypeNode
(
pos
=
self
.
pos
,
positional_args
=
template_values
,
keyword_args
=
None
,
is_reference
=
False
)
return
type_node
.
analyse
(
env
,
base_type
=
base_type
)
pos
=
self
.
pos
,
positional_args
=
template_values
,
keyword_args
=
None
)
return
type_node
.
analyse
(
env
,
base_type
=
base_type
)
else
:
index
=
self
.
index
.
compile_time_value
(
env
)
if
index
is
not
None
:
...
...
@@ -11377,11 +11376,6 @@ class CoerceFromPyTypeNode(CoercionNode):
if
not
result_type
.
create_from_py_utility_code
(
env
):
error
(
arg
.
pos
,
"Cannot convert Python object to '%s'"
%
result_type
)
elif
result_type
.
is_reference
:
warning
(
arg
.
pos
,
"Cannot pass Python object as C++ data structure "
"reference (%s &), will pass by copy."
%
result_type
,
level
=
1
)
if
self
.
type
.
is_string
or
self
.
type
.
is_pyunicode_ptr
:
if
self
.
arg
.
is_name
and
self
.
arg
.
entry
and
self
.
arg
.
entry
.
is_pyglobal
:
warning
(
arg
.
pos
,
...
...
Cython/Compiler/Nodes.py
View file @
9a0983ec
...
...
@@ -1110,7 +1110,7 @@ class TemplatedTypeNode(CBaseTypeNode):
error
(
template_node
.
pos
,
"unknown type in template argument"
)
return
error_type
template_types
.
append
(
type
)
self
.
type
=
base_type
.
specialize_here
(
self
.
pos
,
template_types
,
is_reference
=
self
.
is_reference
)
self
.
type
=
base_type
.
specialize_here
(
self
.
pos
,
template_types
)
elif
base_type
.
is_pyobject
:
# Buffer
...
...
Cython/Compiler/Parsing.py
View file @
9a0983ec
...
...
@@ -2168,8 +2168,7 @@ def p_buffer_or_template(s, base_type_node, templates):
result
=
Nodes
.
TemplatedTypeNode
(
pos
,
positional_args
=
positional_args
,
keyword_args
=
keyword_dict
,
base_type_node
=
base_type_node
,
is_reference
=
(
s
.
sy
==
'&'
))
base_type_node
=
base_type_node
)
return
result
def
p_bracketed_base_type
(
s
,
base_type_node
,
nonempty
,
empty
):
...
...
Cython/Compiler/PyrexTypes.py
View file @
9a0983ec
...
...
@@ -3198,6 +3198,7 @@ builtin_cpp_conversions = ("std::pair",
"std::set"
,
"std::unordered_set"
,
"std::map"
,
"std::unordered_map"
)
class
CppClassType
(
CType
):
# name string
# cname string
...
...
@@ -3216,7 +3217,7 @@ class CppClassType(CType):
subtypes
=
[
'templates'
]
def
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
=
None
,
template_type
=
None
,
is_reference
=
Fals
e
):
def
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
=
None
,
template_type
=
Non
e
):
self
.
name
=
name
self
.
cname
=
cname
self
.
scope
=
scope
...
...
@@ -3226,7 +3227,6 @@ class CppClassType(CType):
self
.
template_type
=
template_type
self
.
specializations
=
{}
self
.
is_cpp_string
=
cname
in
cpp_string_conversions
self
.
is_reference
=
is_reference
def
use_conversion_utility
(
self
,
from_or_to
):
pass
...
...
@@ -3350,7 +3350,7 @@ class CppClassType(CType):
T
.
get_fused_types
(
result
,
seen
)
return
result
def
specialize_here
(
self
,
pos
,
template_values
=
None
,
is_reference
=
Fals
e
):
def
specialize_here
(
self
,
pos
,
template_values
=
Non
e
):
if
not
self
.
is_template_type
():
error
(
pos
,
"'%s' type is not a template"
%
self
)
return
error_type
...
...
@@ -3366,19 +3366,19 @@ class CppClassType(CType):
"Python object type '%s' cannot be used as a template argument"
%
value
)
if
has_object_template_param
:
return
error_type
return
self
.
specialize
(
dict
(
zip
(
self
.
templates
,
template_values
))
,
is_reference
)
return
self
.
specialize
(
dict
(
zip
(
self
.
templates
,
template_values
)))
def
specialize
(
self
,
values
,
is_reference
=
False
):
def
specialize
(
self
,
values
):
if
not
self
.
templates
and
not
self
.
namespace
:
return
self
if
self
.
templates
is
None
:
self
.
templates
=
[]
key
=
tuple
(
values
.
items
())
+
(
is_reference
,)
key
=
tuple
(
values
.
items
())
if
key
in
self
.
specializations
:
return
self
.
specializations
[
key
]
template_values
=
[
t
.
specialize
(
values
)
for
t
in
self
.
templates
]
specialized
=
self
.
specializations
[
key
]
=
\
CppClassType
(
self
.
name
,
None
,
self
.
cname
,
[],
template_values
,
template_type
=
self
,
is_reference
=
is_reference
)
CppClassType
(
self
.
name
,
None
,
self
.
cname
,
[],
template_values
,
template_type
=
self
)
# Need to do these *after* self.specializations[key] is set
# to avoid infinite recursion on circular references.
specialized
.
base_classes
=
[
b
.
specialize
(
values
)
for
b
in
self
.
base_classes
]
...
...
@@ -3394,7 +3394,8 @@ class CppClassType(CType):
elif
self
.
empty_declaration_code
()
==
actual
.
template_type
.
empty_declaration_code
():
return
reduce
(
merge_template_deductions
,
[
formal_param
.
deduce_template_params
(
actual_param
)
for
(
formal_param
,
actual_param
)
in
zip
(
self
.
templates
,
actual
.
templates
)],
[
formal_param
.
deduce_template_params
(
actual_param
)
for
(
formal_param
,
actual_param
)
in
zip
(
self
.
templates
,
actual
.
templates
)],
{})
else
:
return
None
...
...
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