Permalink
Browse files

Add .clone method to Tree::Optimizer::Pass and ensure @!dependencies …

…is always initialized.
  • Loading branch information...
1 parent 231e920 commit eb54e94a12abe0ad29af416b8670ecd0f8622792 tcurtis committed Aug 6, 2010
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/Tree/Optimizer/Pass.nqp
@@ -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++;
@@ -43,6 +48,8 @@ method BUILD (:$transformation, :$name, :$recursive, :$when, *%rest) {
@!dependencies := (pir::isa__IPP($depends-on, String)
?? [ $depends-on ]
!! $depends-on);
+ } else {
+ @!dependencies := [];
}
}

0 comments on commit eb54e94

Please sign in to comment.