Skip to content

Commit

Permalink
Fix C3 MRO handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jun 6, 2011
1 parent 1e5cc31 commit b9ff148
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Metamodel.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ class Class is Module {
sub c3merge(@onto, @lists) {
my $ix = 0;
while $ix < @lists {
#say "C3 MRO status ($ix):";
#say "Onto: ", @onto.map({ $*unit.deref($_).name }).join(" <- ");
#say $_.map({ $*unit.deref($_).name }).join(" <- ") for @lists;
#say "---";
my $l = @lists[$ix];
if !$l || !c3clear((my $item = $l[0]), @lists) {
$ix++;
Expand Down Expand Up @@ -333,12 +337,13 @@ class Class is Module {
}

my @merge;
push @merge, [ $.xref, @( $.superclasses ) ];
push @merge, [ $.xref ];
for @$.superclasses -> $x {
my $d = $*unit.deref($x);
$d.close unless $d.linearized_mro;
push @merge, [ @( $d.linearized_mro ) ];
}
push @merge, [ @( $.superclasses ) ];
my @mro;
c3merge(@mro, @merge);
$.linearized_mro = @mro;
Expand Down

0 comments on commit b9ff148

Please sign in to comment.