Improve multiple inheritance support

Current algorithm doesn't support multiple inheritance when inheritance
depth is more than 1 on two parents. It'll not parse the "_add" or
"_remove" attributes on a second parent which is at the same level
as that of a parent that defines the attribute.

This change ensures that second parent which is at the same level
as that of a parent that defines the attribute is parsed for "_add" or
"_remove" attributes. However, this change will parse the parent which
defines the attributes twice, once to evaluate the attribute and then to
evaluate the "_add" or "_remove" attribute. But, no target is allowed to
define an attribute and also "_add" or "_remove" for the same attribute.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
pull/12402/head
Devaraj Ranganna 2019-11-13 10:10:19 +00:00 committed by Jaeden Amero
parent 6ac9c6eb04
commit 20ddc3ae90
1 changed files with 4 additions and 1 deletions

View File

@ -292,7 +292,10 @@ class Target(namedtuple(
# inheritance level, left to right order to figure out all the
# other classes that change the definition by adding or removing
# elements
for idx in range(self.resolution_order[def_idx][1] - 1, -1, -1):
highest_order = 0
for t in self.resolution_order:
highest_order = highest_order if highest_order > t[1] else t[1]
for idx in range(highest_order - 1, -1, -1):
same_level_targets = [tar[0] for tar in self.resolution_order
if tar[1] == idx]
for tar in same_level_targets: