Permalink
Browse files

Merge branch 'master' into pass-manager

  • Loading branch information...
2 parents d224501 + e3dd6b2 commit fd9186dd61760ffe10f96d4b3d931bda1fd33b0b tcurtis committed Aug 4, 2010
Showing with 13 additions and 2 deletions.
  1. +1 −1 src/Tree/Pattern/Transformer.nqp
  2. +12 −1 t/pastpattern.t
@@ -119,7 +119,7 @@ module Tree::Walker {
$shouldDescend := !$walker.descend_until.ACCEPTS($node);
}
- if ($shouldDescend) {
+ if ($shouldDescend && !pir::isnull__IP($result)) {
$walker.depth($walker.depth + 1);
my $newChildren := walkChildren($walker, $result);
replaceChildren($result, $newChildren);
View
@@ -5,7 +5,7 @@
pir::load_bytecode('PCT.pbc');
pir::load_bytecode('PAST/Pattern.pbc');
-plan(2151);
+plan(2153);
test_type_matching();
test_attribute_exact_matching();
@@ -825,6 +825,17 @@ sub test_transform_sub () {
'Matched node 2 is changed. 2');
ok($result[1][1][0].value() == 2,
'Matched nodes within other matched nodes are changed.');
+
+ sub del ($/) {
+ pir::null__P;
+ }
+ $pattern := PAST::Pattern::Val.new;
+ $past := PAST::Stmts.new(PAST::Val.new, PAST::Op.new);
+ $result := $pattern.transform($past, del);
+ ok($result ~~ PAST::Stmts,
+ 'Non-matched nodes left unchanged 2.');
+ ok($result[0] ~~ PAST::Op,
+ 'Deletion of nodes is correctly handled.');
}
sub test_transform_options () {

0 comments on commit fd9186d

Please sign in to comment.