Skip to content

Commit

Permalink
Add .clone method to Tree::Optimizer::Pass and ensure @!dependencies …
Browse files Browse the repository at this point in the history
…is always initialized.
  • Loading branch information
tcurtis committed Aug 6, 2010
1 parent 231e920 commit eb54e94
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Tree/Optimizer/Pass.nqp
Expand Up @@ -29,6 +29,11 @@ method new ($trans, *%adverbs) {
$self;
}

method clone () {
self.new($!transformation, :name($!name), :recursive($!recursive),
:when($!when), :depends-on(pir::clone__PP(@!dependencies)));
}

my $current-gen-name := 0;
sub gen-name () {
'__unnamed_' ~ $current-gen-name++;
Expand All @@ -43,6 +48,8 @@ method BUILD (:$transformation, :$name, :$recursive, :$when, *%rest) {
@!dependencies := (pir::isa__IPP($depends-on, String)
?? [ $depends-on ]
!! $depends-on);
} else {
@!dependencies := [];
}
}

Expand Down

0 comments on commit eb54e94

Please sign in to comment.