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
78b1c068
Commit
78b1c068
authored
Jul 08, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't inherit template parameters as types.
parent
e8a178e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+15
-6
No files found.
Cython/Compiler/Symtab.py
View file @
78b1c068
...
@@ -593,7 +593,7 @@ class Scope(object):
...
@@ -593,7 +593,7 @@ class Scope(object):
error
(
pos
,
"Cannot inherit from incomplete type"
)
error
(
pos
,
"Cannot inherit from incomplete type"
)
else
:
else
:
declare_inherited_attributes
(
entry
,
base_class
.
base_classes
)
declare_inherited_attributes
(
entry
,
base_class
.
base_classes
)
entry
.
type
.
scope
.
declare_inherited_cpp_attributes
(
base_class
.
scope
)
entry
.
type
.
scope
.
declare_inherited_cpp_attributes
(
base_class
)
if
scope
:
if
scope
:
declare_inherited_attributes
(
entry
,
base_classes
)
declare_inherited_attributes
(
entry
,
base_classes
)
scope
.
declare_var
(
name
=
"this"
,
cname
=
"this"
,
type
=
PyrexTypes
.
CPtrType
(
entry
.
type
),
pos
=
entry
.
pos
)
scope
.
declare_var
(
name
=
"this"
,
cname
=
"this"
,
type
=
PyrexTypes
.
CPtrType
(
entry
.
type
),
pos
=
entry
.
pos
)
...
@@ -2276,7 +2276,15 @@ class CppClassScope(Scope):
...
@@ -2276,7 +2276,15 @@ class CppClassScope(Scope):
type
.
entry
=
entry
type
.
entry
=
entry
return
entry
return
entry
def
declare_inherited_cpp_attributes
(
self
,
base_scope
):
def
declare_inherited_cpp_attributes
(
self
,
base_class
):
base_scope
=
base_class
.
scope
template_type
=
base_class
while
getattr
(
template_type
,
'template_type'
,
None
):
template_type
=
template_type
.
template_type
if
getattr
(
template_type
,
'templates'
,
None
):
base_templates
=
[
T
.
name
for
T
in
template_type
.
templates
]
else
:
base_templates
=
()
# Declare entries for all the C++ attributes of an
# Declare entries for all the C++ attributes of an
# inherited type, with cnames modified appropriately
# inherited type, with cnames modified appropriately
# to work with this type.
# to work with this type.
...
@@ -2300,6 +2308,7 @@ class CppClassScope(Scope):
...
@@ -2300,6 +2308,7 @@ class CppClassScope(Scope):
utility_code
=
base_entry
.
utility_code
)
utility_code
=
base_entry
.
utility_code
)
entry
.
is_inherited
=
1
entry
.
is_inherited
=
1
for
base_entry
in
base_scope
.
type_entries
:
for
base_entry
in
base_scope
.
type_entries
:
if
base_entry
.
name
not
in
base_templates
:
entry
=
self
.
declare_type
(
base_entry
.
name
,
base_entry
.
type
,
entry
=
self
.
declare_type
(
base_entry
.
name
,
base_entry
.
type
,
base_entry
.
pos
,
base_entry
.
cname
,
base_entry
.
pos
,
base_entry
.
cname
,
base_entry
.
visibility
)
base_entry
.
visibility
)
...
...
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