Permalink
Browse files

Fix null handling in Tree::Optimizer's transformers.

  • Loading branch information...
1 parent ca78f94 commit d224501de1571dbde46dedfd8f966b312945bc47 tcurtis committed Aug 4, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/Tree/Optimizer/Transformers.nqp
@@ -33,17 +33,20 @@ class Tree::Optimizer::Transformer::Combined is Tree::Transformer {
module Tree::Walker {
our multi walk (Tree::Optimizer::Transformer::Single $walker, $node) {
my $result := $walker.transform()($node);
- replaceChildren($result, walkChildren($walker, $result));
+ replaceChildren($result, walkChildren($walker, $result))
+ unless pir::isnull__IP($result);
$result;
}
our multi walk (Tree::Optimizer::Transformer::Combined $walker, $node) {
my $result := $node;
for $walker.passes -> $pass {
- my $/ := $pass.when.ACCEPTS($node, :exact(1));
+ my $/ := $pass.when.ACCEPTS($result, :exact(1));
$result := $pass.transformation()($/) if $/;
+ last if pir::isnull__IP($result);
}
- replaceChildren($result, walkChildren($walker, $result));
+ replaceChildren($result, walkChildren($walker, $result))
+ unless pir::isnull__IP($result);
$result;
}
}

0 comments on commit d224501

Please sign in to comment.