Skip to content

Commit

Permalink
More correctly fake up role MROs
Browse files Browse the repository at this point in the history
(Take roles of roles into account)
  • Loading branch information
coke committed Oct 26, 2017
1 parent 9e98885 commit 1e4ad0c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Perl6/TypeGraph.pm
Expand Up @@ -69,9 +69,13 @@ class Perl6::TypeGraph {
}
for %.types.values -> $t {
# roles that have a superclass actually apply that superclass
# to the class that does them, so mimic that here:
for $t.roles -> $r {
# to the class that does them, so mimic that here, including
# parent roles
my @roles = $t.roles;
while @roles {
my $r = @roles.shift;
$t.super.append: $r.super if $r.super;
@roles.append: $r.roles if $r.roles;
}
# non-roles default to superclass Any
if $t.packagetype ne 'role' && !$t.super && $t ne 'Mu' {
Expand Down

0 comments on commit 1e4ad0c

Please sign in to comment.