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
271db8ac
Commit
271db8ac
authored
5 years ago
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework the symtab logic for C++ methods in Scope.declare
parent
906fffd2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+21
-10
No files found.
Cython/Compiler/Symtab.py
View file @
271db8ac
...
@@ -448,16 +448,21 @@ class Scope(object):
...
@@ -448,16 +448,21 @@ class Scope(object):
# See https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html#Reserved-Names
# See https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html#Reserved-Names
warning
(
pos
,
"'%s' is a reserved name in C."
%
cname
,
-
1
)
warning
(
pos
,
"'%s' is a reserved name in C."
%
cname
,
-
1
)
entries
=
self
.
entries
entries
=
self
.
entries
old_index
=
-
1
if
name
and
name
in
entries
and
not
shadow
:
if
name
and
name
in
entries
and
not
shadow
:
old_entry
=
entries
[
name
]
old_entry
=
entries
[
name
]
# Reject redeclared C++ functions only if they have the same type signature.
# Reject redeclared C++ functions only if they have the same type signature.
cpp_override_allowed
=
False
cpp_override_allowed
=
False
if
type
.
is_cfunction
and
old_entry
.
type
.
is_cfunction
and
self
.
is_cpp
()
:
if
type
.
is_cfunction
and
old_entry
.
type
.
is_cfunction
and
self
.
is_cpp
_class_scope
:
for
alt_entry
in
old_entry
.
all_alternatives
(
):
for
index
,
alt_entry
in
enumerate
(
old_entry
.
all_alternatives
()
):
if
type
==
alt_entry
.
type
:
if
type
.
compatible_signature_with
(
alt_entry
.
type
)
:
if
name
==
'<init>'
and
not
type
.
args
:
if
name
==
'<init>'
and
not
type
.
args
:
# Cython pre-declares the no-args constructor - allow later user definitions.
# Cython pre-declares the no-args constructor - allow later user definitions.
old_index
=
index
cpp_override_allowed
=
True
elif
alt_entry
.
is_inherited
:
old_index
=
index
cpp_override_allowed
=
True
cpp_override_allowed
=
True
break
break
else
:
else
:
...
@@ -481,11 +486,17 @@ class Scope(object):
...
@@ -481,11 +486,17 @@ class Scope(object):
entry
.
create_wrapper
=
create_wrapper
entry
.
create_wrapper
=
create_wrapper
if
name
:
if
name
:
entry
.
qualified_name
=
self
.
qualify_name
(
name
)
entry
.
qualified_name
=
self
.
qualify_name
(
name
)
# if name in entries and self.is_cpp():
# entries[name].overloaded_alternatives.append(entry)
# else:
# entries[name] = entry
if
not
shadow
:
if
not
shadow
:
if
name
in
entries
and
self
.
is_cpp_class_scope
and
type
.
is_cfunction
:
if
old_index
>
-
1
:
if
old_index
>
0
:
entries
[
name
].
overloaded_alternatives
[
old_index
-
1
]
=
entry
else
:
entry
.
overloaded_alternatives
=
entries
[
name
].
overloaded_alternatives
entries
[
name
]
=
entry
else
:
entries
[
name
].
overloaded_alternatives
.
append
(
entry
)
else
:
entries
[
name
]
=
entry
entries
[
name
]
=
entry
if
type
.
is_memoryviewslice
:
if
type
.
is_memoryviewslice
:
...
@@ -2459,8 +2470,8 @@ class CppClassScope(Scope):
...
@@ -2459,8 +2470,8 @@ class CppClassScope(Scope):
entry
=
self
.
declare_var
(
name
,
type
,
pos
,
entry
=
self
.
declare_var
(
name
,
type
,
pos
,
defining
=
defining
,
defining
=
defining
,
cname
=
cname
,
visibility
=
visibility
)
cname
=
cname
,
visibility
=
visibility
)
if
prev_entry
and
not
defining
:
#
if prev_entry and not defining:
entry
.
overloaded_alternatives
=
prev_entry
.
all_alternatives
()
#
entry.overloaded_alternatives = prev_entry.all_alternatives()
entry
.
utility_code
=
utility_code
entry
.
utility_code
=
utility_code
type
.
entry
=
entry
type
.
entry
=
entry
return
entry
return
entry
...
...
This diff is collapsed.
Click to expand it.
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