Skip to content

Commit

Permalink
Merge branch 'master' into pass-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
tcurtis committed Aug 4, 2010
2 parents d224501 + e3dd6b2 commit fd9186d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Tree/Pattern/Transformer.nqp
Expand Up @@ -119,7 +119,7 @@ module Tree::Walker {
$shouldDescend := !$walker.descend_until.ACCEPTS($node); $shouldDescend := !$walker.descend_until.ACCEPTS($node);
} }


if ($shouldDescend) { if ($shouldDescend && !pir::isnull__IP($result)) {
$walker.depth($walker.depth + 1); $walker.depth($walker.depth + 1);
my $newChildren := walkChildren($walker, $result); my $newChildren := walkChildren($walker, $result);
replaceChildren($result, $newChildren); replaceChildren($result, $newChildren);
Expand Down
13 changes: 12 additions & 1 deletion t/pastpattern.t
Expand Up @@ -5,7 +5,7 @@
pir::load_bytecode('PCT.pbc'); pir::load_bytecode('PCT.pbc');
pir::load_bytecode('PAST/Pattern.pbc'); pir::load_bytecode('PAST/Pattern.pbc');


plan(2151); plan(2153);


test_type_matching(); test_type_matching();
test_attribute_exact_matching(); test_attribute_exact_matching();
Expand Down Expand Up @@ -825,6 +825,17 @@ sub test_transform_sub () {
'Matched node 2 is changed. 2'); 'Matched node 2 is changed. 2');
ok($result[1][1][0].value() == 2, ok($result[1][1][0].value() == 2,
'Matched nodes within other matched nodes are changed.'); '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 () { sub test_transform_options () {
Expand Down

0 comments on commit fd9186d

Please sign in to comment.