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
ccda6cd0
Commit
ccda6cd0
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
8ae14b2f
Changes
1
Show 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 @
ccda6cd0
...
@@ -255,7 +255,7 @@ class Entry(object):
...
@@ -255,7 +255,7 @@ class Entry(object):
self
.
type
=
type
self
.
type
=
type
self
.
pos
=
pos
self
.
pos
=
pos
self
.
init
=
init
self
.
init
=
init
self
.
overloaded_alternatives
=
[]
self
.
overloaded_alternatives
=
[
self
]
self
.
cf_assignments
=
[]
self
.
cf_assignments
=
[]
self
.
cf_references
=
[]
self
.
cf_references
=
[]
self
.
inner_entries
=
[]
self
.
inner_entries
=
[]
...
@@ -274,7 +274,7 @@ class Entry(object):
...
@@ -274,7 +274,7 @@ class Entry(object):
self
.
already_declared_here
()
self
.
already_declared_here
()
def
all_alternatives
(
self
):
def
all_alternatives
(
self
):
return
[
self
]
+
self
.
overloaded_alternatives
return
list
(
self
.
overloaded_alternatives
)
def
all_entries
(
self
):
def
all_entries
(
self
):
return
[
self
]
+
self
.
inner_entries
return
[
self
]
+
self
.
inner_entries
...
@@ -587,27 +587,31 @@ class Scope(object):
...
@@ -587,27 +587,31 @@ class Scope(object):
if
not
shadow
:
if
not
shadow
:
if
name
in
entries
and
self
.
is_cpp_class_scope
and
type
.
is_cfunction
:
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
# sort the indices in decreasing order
previous_alternative_indices
.
reverse
()
previous_alternative_indices
.
reverse
()
# remplace the first hidden entry with the new entry
# remplace the first hidden entry with the new entry
if
previous_alternative_indices
:
if
previous_alternative_indices
:
first_index
=
previous_alternative_indices
.
pop
()
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
:
if
first_index
==
0
:
entry
.
overloaded_alternatives
=
entries
[
name
].
overloaded_alternatives
entries
[
name
]
=
entry
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
# if no entries are hidden by the new entry, just add it to the alternatives
else
:
else
:
entries
[
name
].
overloaded_alternatives
.
append
(
entry
)
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
:
for
index
in
previous_alternative_indices
:
del
entries
[
name
].
overloaded_alternatives
[
index
-
1
]
del
entries
[
name
].
overloaded_alternatives
[
index
]
else
:
else
:
# this is the first entry with this name
entries
[
name
]
=
entry
entries
[
name
]
=
entry
if
type
.
is_memoryviewslice
:
if
type
.
is_memoryviewslice
:
...
@@ -1008,7 +1012,8 @@ class Scope(object):
...
@@ -1008,7 +1012,8 @@ class Scope(object):
can_override
=
True
can_override
=
True
if
can_override
:
if
can_override
:
temp
=
self
.
add_cfunction
(
name
,
type
,
pos
,
cname
,
visibility
,
modifiers
)
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
entry
=
temp
else
:
else
:
warning
(
pos
,
"Function signature does not match previous declaration"
,
1
)
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