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
1c7b2328
Commit
1c7b2328
authored
Jun 11, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate code to correctly resolve cypclass methods according to MRO
parent
a4a225bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+9
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
1c7b2328
...
...
@@ -7421,6 +7421,8 @@ class AttributeNode(ExprNode):
if
obj
.
type
.
is_builtin_type
and
self
.
entry
and
self
.
entry
.
is_variable
:
# accessing a field of a builtin type, need to cast better than result_as() does
obj_code
=
obj
.
type
.
cast_code
(
obj
.
result
(),
to_object_struct
=
True
)
if
obj
.
type
.
is_cyp_class
and
self
.
entry
and
self
.
entry
.
from_type
:
self
.
member
=
"%s::%s"
%
(
self
.
entry
.
from_type
.
empty_declaration_code
(),
self
.
member
)
return
"%s%s%s"
%
(
obj_code
,
self
.
op
,
self
.
member
)
def
generate_result_code
(
self
,
code
):
...
...
Cython/Compiler/Symtab.py
View file @
1c7b2328
...
...
@@ -142,6 +142,11 @@ class Entry(object):
#
# is_default boolean This entry is a compiler-generated default and
# is not user-defined (e.g default contructor)
#
# from_type CypClassType or CppClassType or CStructOrUnionType or None
# The type in which this entry was first declared
# when it is later inherited by a cypclass
#
# mro_index integer The index of the type where this entry was originally
# declared in the mro of the cypclass where it is now
...
...
@@ -232,6 +237,7 @@ class Entry(object):
self
.
inner_entries
=
[]
self
.
defining_entry
=
self
self
.
mro_index
=
0
self
.
from_type
=
None
def
__repr__
(
self
):
return
"%s(<%x>, name=%s, type=%s)"
%
(
type
(
self
).
__name__
,
id
(
self
),
self
.
name
,
self
.
type
)
...
...
@@ -509,12 +515,14 @@ class Scope(object):
if
alt_entry
.
is_default
:
previous_alternative_indices
.
append
(
index
)
ccp_override_allowed
=
True
continue
# Any inherited method is visible
# until overloaded by a method with the same signature
if
alt_entry
.
is_inherited
:
previous_alternative_indices
.
append
(
index
)
cpp_override_allowed
=
True
continue
if
cpp_override_allowed
:
# C++ function/method overrides with different signatures are ok.
...
...
@@ -541,6 +549,7 @@ class Scope(object):
entry
=
Entry
(
name
,
cname
,
type
,
pos
=
pos
)
if
from_type
and
self
.
is_cyp_class_scope
:
entry
.
mro_index
=
self
.
parent_type
.
mro
().
index
(
from_type
)
entry
.
from_type
=
from_type
entry
.
in_cinclude
=
self
.
in_cinclude
entry
.
create_wrapper
=
create_wrapper
...
...
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