File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ unit role PDF::Class::OutlineNode;
2
2
3
3
use PDF::COS;
4
4
use PDF::Destination : coerce-dest, : DestinationLike, : DestRef;
5
- has Array $ . parents is rw ;
6
5
sub siblings ($ first ) is rw {
7
6
my class Siblings does Iterable {
8
7
has $ . first is required ;
@@ -27,26 +26,21 @@ method add-kid(Hash $kid is copy = {}) {
27
26
}
28
27
$ kid = (require PDF::Outline). COERCE: $ kid ;
29
28
$ kid . Dest = $ _ with $ dest ;
30
- $ kid . parents // = [];
31
- $ kid . parents. push : self ;
29
+ $ kid . Parent = self ;
32
30
with self . Last {
33
31
. Next = $ kid ;
34
32
$ kid . Prev = $ _ ;
35
33
}
36
34
self . Last = $ kid ;
37
35
self . First // = $ kid ;
38
36
my % seen {Any };
39
- my @ nodes = $ kid ;
37
+ my $ node = $ kid ;
40
38
41
- while @ nodes {
42
- my $ node = @ nodes . shift ;
43
- unless % seen {$ node }++ {
44
- $ node . Count++ ;
45
- with $ node . parents {
46
- @ nodes . push : $ _
47
- for . list;
48
- }
49
- }
39
+ while $ node {
40
+ last if % seen {$ node }++ ;
41
+ $ node . Count++ ;
42
+ last unless $ node . can (' Parent' );
43
+ $ node .= Parent;
50
44
}
51
45
$ kid . kids = $ _ with $ grand-kids ;
52
46
$ kid ;
You can’t perform that action at this time.
0 commit comments