Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dump the contents of QAST::VM nodes when dumping the ast.
  • Loading branch information
pmurias committed May 30, 2013
1 parent 2a557de commit 0255fc8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/QAST/VM.nqp
Expand Up @@ -16,4 +16,28 @@ class QAST::VM is QAST::Node {
method alternative($option) {
nqp::atkey(%!alternatives, $option)
}

method dump_children(int $indent, @onto) {
for %!alternatives {
nqp::push(@onto, nqp::x(' ', $indent));
nqp::push(@onto, '[');
nqp::push(@onto, $_.key);
nqp::push(@onto, "]\n");

if nqp::istype($_.value, QAST::Node) {
nqp::push(@onto, $_.value.dump($indent+2));
}
else {
nqp::push(@onto, nqp::x(' ', $indent+2));
nqp::push(@onto, '- ');
if $_.key eq 'loadlibs' {
nqp::push(@onto, nqp::join(' ',$_.value));
}
else {
nqp::push(@onto, ~$_.value);
}
nqp::push(@onto, "\n");
}
}
}
}

0 comments on commit 0255fc8

Please sign in to comment.