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
Xavier Thompson
cython
Commits
83be22a9
Commit
83be22a9
authored
Jun 11, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead code in cpp inherited attributes declaration
parent
60e03c68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
93 deletions
+51
-93
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+51
-93
No files found.
Cython/Compiler/Symtab.py
View file @
83be22a9
...
...
@@ -2937,9 +2937,7 @@ class CppClassScope(Scope):
base_scope
.
inherited_var_entries
+
base_scope
.
var_entries
:
base_entry_type
=
base_entry
.
type
#constructor/destructor is not inherited
if
base_entry
.
name
==
"<del>"
\
or
base_entry
.
name
==
"<init>"
and
not
self
.
parent_type
.
is_cyp_class
\
or
base_entry
.
name
in
(
"<constructor>"
,
"<alloc>"
,
"<active_self>"
,
"__activate__"
)
and
self
.
parent_type
.
is_cyp_class
:
if
base_entry
.
name
==
"<del>"
or
base_entry
.
name
==
"<init>"
:
continue
elif
base_entry
.
name
==
"<init>"
and
not
self
.
lookup_here
(
"__new__"
):
wrapper_entry
=
self
.
declare_constructor_wrapper
(
base_entry_type
.
args
,
base_entry
.
pos
,
...
...
@@ -2948,35 +2946,9 @@ class CppClassScope(Scope):
op_arg_struct
=
getattr
(
base_entry_type
,
'op_arg_struct'
,
None
),
return_type
=
self
.
parent_type
)
wrapper_entry
.
is_inherited
=
1
#print base_entry.name, self.entries
elif
base_entry
.
name
==
"__new__"
and
self
.
parent_type
.
is_cyp_class
:
# Rewrite first argument for __new__
alloc_type
=
PyrexTypes
.
CPtrType
(
PyrexTypes
.
CFuncType
(
self
.
parent_type
,
[],
nogil
=
1
))
alloc_arg
=
PyrexTypes
.
CFuncTypeArg
(
base_entry
.
type
.
args
[
0
].
name
,
alloc_type
,
base_entry
.
type
.
args
[
0
].
pos
,
cname
=
base_entry
.
type
.
args
[
0
].
cname
)
base_entry_type
=
PyrexTypes
.
CFuncType
(
base_entry_type
.
return_type
,
[
alloc_arg
]
+
base_entry_type
.
args
[
1
:],
nogil
=
1
,
has_varargs
=
base_entry_type
.
has_varargs
,
optional_arg_count
=
base_entry_type
.
optional_arg_count
)
if
hasattr
(
base_entry
.
type
,
'op_arg_struct'
):
base_entry_type
.
op_arg_struct
=
base_entry
.
type
.
op_arg_struct
base_entry_type
.
original_alloc_type
=
base_entry
.
type
.
original_alloc_type
if
base_entry
.
name
in
self
.
entries
:
del
self
.
entries
[
base_entry
.
name
]
del
self
.
entries
[
"<constructor>"
]
elif
"<init>"
in
self
.
entries
:
del
self
.
entries
[
"<constructor>"
]
wrapper_entry
=
self
.
declare_constructor_wrapper
(
base_entry_type
.
args
[
1
:],
base_entry
.
pos
,
defining
=
1
,
has_varargs
=
base_entry_type
.
has_varargs
,
optional_arg_count
=
base_entry_type
.
optional_arg_count
,
op_arg_struct
=
getattr
(
base_entry_type
,
'op_arg_struct'
,
None
),
return_type
=
base_entry_type
.
return_type
)
wrapper_entry
.
is_inherited
=
1
if
base_entry
.
name
in
self
.
entries
:
base_entry
.
name
# FIXME: is there anything to do in this case?
pass
# FIXME: is there anything to do in this case?
entry
=
self
.
declare
(
base_entry
.
name
,
base_entry
.
cname
,
base_entry_type
,
base_entry
.
pos
,
'extern'
)
entry
.
is_variable
=
1
...
...
@@ -2985,14 +2957,7 @@ class CppClassScope(Scope):
if
entry
.
is_cfunction
:
entry
.
func_cname
=
base_entry
.
func_cname
self
.
inherited_var_entries
.
append
(
entry
)
for
base_entry
in
base_scope
.
cfunc_entries
:
entry
=
self
.
declare_cfunction
(
base_entry
.
name
,
base_entry
.
type
,
base_entry
.
pos
,
base_entry
.
cname
,
base_entry
.
visibility
,
api
=
0
,
modifiers
=
base_entry
.
func_modifiers
,
utility_code
=
base_entry
.
utility_code
,
inheriting
=
1
)
entry
.
is_inherited
=
1
for
base_entry
in
base_scope
.
type_entries
+
base_scope
.
inherited_type_entries
:
if
base_entry
.
name
not
in
base_templates
:
entry
=
self
.
declare_type
(
base_entry
.
name
,
base_entry
.
type
,
...
...
@@ -3001,6 +2966,8 @@ class CppClassScope(Scope):
entry
.
is_inherited
=
1
self
.
inherited_type_entries
.
append
(
entry
)
# adapted from 'declare_inherited_cpp_attributes'
# TODO: reduce redundancy with 'declare_inherited_cpp_attributes'
def
declare_inherited_cyp_attributes
(
self
,
base_class
):
base_scope
=
base_class
.
scope
template_type
=
base_class
...
...
@@ -3010,9 +2977,7 @@ class CppClassScope(Scope):
base_templates
=
[
T
.
name
for
T
in
template_type
.
templates
]
else
:
base_templates
=
()
# Declare entries for all the C++ attributes of an
# inherited type, with cnames modified appropriately
# to work with this type.
for
base_entry
in
base_scope
.
var_entries
:
base_entry_type
=
base_entry
.
type
#constructor/destructor is not inherited
...
...
@@ -3058,14 +3023,7 @@ class CppClassScope(Scope):
if
entry
.
is_cfunction
:
entry
.
func_cname
=
base_entry
.
func_cname
self
.
inherited_var_entries
.
append
(
entry
)
for
base_entry
in
base_scope
.
cfunc_entries
:
entry
=
self
.
declare_cfunction
(
base_entry
.
name
,
base_entry
.
type
,
base_entry
.
pos
,
base_entry
.
cname
,
base_entry
.
visibility
,
api
=
0
,
modifiers
=
base_entry
.
func_modifiers
,
utility_code
=
base_entry
.
utility_code
,
inheriting
=
1
)
entry
.
is_inherited
=
1
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
,
...
...
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