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
174755c6
Commit
174755c6
authored
Jun 12, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give all overloaded entries access to all their overloaded alternatives
parent
b0de20a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+13
-8
No files found.
Cython/Compiler/Symtab.py
View file @
174755c6
...
...
@@ -231,7 +231,7 @@ class Entry(object):
self
.
type
=
type
self
.
pos
=
pos
self
.
init
=
init
self
.
overloaded_alternatives
=
[]
self
.
overloaded_alternatives
=
[
self
]
self
.
cf_assignments
=
[]
self
.
cf_references
=
[]
self
.
inner_entries
=
[]
...
...
@@ -250,7 +250,7 @@ class Entry(object):
self
.
already_declared_here
()
def
all_alternatives
(
self
):
return
[
self
]
+
self
.
overloaded_alternatives
return
list
(
self
.
overloaded_alternatives
)
def
all_entries
(
self
):
return
[
self
]
+
self
.
inner_entries
...
...
@@ -559,27 +559,31 @@ class Scope(object):
if
not
shadow
:
if
name
in
entries
and
self
.
is_cpp_class_scope
and
type
.
is_cfunction
:
# give all alternative entries access to all overloaded alternatives
entry
.
overloaded_alternatives
=
entries
[
name
].
overloaded_alternatives
# sort the indices in decreasing order
previous_alternative_indices
.
reverse
()
# remplace the first hidden entry with the new entry
if
previous_alternative_indices
:
first_index
=
previous_alternative_indices
.
pop
()
entries
[
name
].
overloaded_alternatives
[
first_index
]
=
entry
# the overloaded entry at index 0 is always the one in the scope dict
if
first_index
==
0
:
entry
.
overloaded_alternatives
=
entries
[
name
].
overloaded_alternatives
entries
[
name
]
=
entry
else
:
entries
[
name
].
overloaded_alternatives
[
first_index
-
1
]
=
entry
# if no entries are hidden by the new entry, just add it to the alternatives
else
:
entries
[
name
].
overloaded_alternatives
.
append
(
entry
)
# outright remove the entries for the remaining indices (
the first index was removed
)
# outright remove the entries for the remaining indices (
in decreasing order
)
for
index
in
previous_alternative_indices
:
del
entries
[
name
].
overloaded_alternatives
[
index
-
1
]
del
entries
[
name
].
overloaded_alternatives
[
index
]
else
:
# this is the first entry with this name
entries
[
name
]
=
entry
if
type
.
is_memoryviewslice
:
...
...
@@ -980,7 +984,8 @@ class Scope(object):
can_override
=
True
if
can_override
:
temp
=
self
.
add_cfunction
(
name
,
type
,
pos
,
cname
,
visibility
,
modifiers
)
temp
.
overloaded_alternatives
=
entry
.
all_alternatives
()
temp
.
overloaded_alternatives
=
entry
.
overloaded_alternatives
temp
.
overloaded_alternatives
.
insert
(
0
,
temp
)
entry
=
temp
else
:
warning
(
pos
,
"Function signature does not match previous declaration"
,
1
)
...
...
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