Skip to content

Commit

Permalink
[sinker] recurse into nested blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Feb 19, 2012
1 parent c25fcb8 commit 8274182
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Perl6/Sinker.pm
Expand Up @@ -8,8 +8,19 @@ class Perl6::Sinker {

# Called when we encounter a block in the tree.
method visit_block($block) {
if !$block<sunk> && pir::defined($block[1]) {
$block[1] := self.visit_children($block[1]);
if !$block<sunk> {
if pir::defined($block[0]) {
my $i := 0;
while $i < +@($block[0]) {
if !pir::isa($block[0][$i], 'String') && !pir::isa($block[0][$i], 'Integer') && !pir::isa($block[0][$i], 'Float') && $block[0][$i].isa('PAST::Block') {
$block[0][$i] := self.visit_block($block[0][$i]);
}
$i++;
}
}
if pir::defined($block[1]) {
$block[1] := self.visit_children($block[1]);
}
$block<sunk> := 1;
}
$block;
Expand Down

0 comments on commit 8274182

Please sign in to comment.