Permalink
Browse files

Easyfy matching Block WVals with their QAST::Blocks…

…when looking through QAST dumps.

- Teach QAST::Node.dump to dump value for statement_id
- Teach QAST::WVal.dump_extra_node_info to rake for CUID
    from past_block annotation, if one's present
  • Loading branch information...
zoffixznet committed Jan 24, 2018
1 parent 3ce6994 commit 0264b237930f426f4cba744c55f10813869ac40b
Showing with 25 additions and 21 deletions.
  1. +18 −19 src/QAST/Node.nqp
  2. +7 −2 src/QAST/WVal.nqp
@@ -155,26 +155,25 @@ class QAST::Node {
}

method dump_annotations() {
my @anns;
nqp::push(@anns, self.dump_flags);

my @anns;
nqp::push(@anns, self.dump_flags);
if nqp::ishash(%!annotations) {
for %!annotations {
my $k := $_.key;
my $v := $_.value;
try {
if nqp::isconcrete($v) {
if $k eq 'IN_DECL' || $k eq 'BY' {
nqp::push(@anns, ':' ~ $k ~ '<' ~ $v ~ '>');
}
else { # dunno how to introspect
nqp::push(@anns, ':' ~ $k ~ '<?>');
}
}
}
}
}
nqp::join(' ',@anns);
for %!annotations {
my $k := $_.key;
my $v := $_.value;
try {
if nqp::isconcrete($v) {
if $k eq 'IN_DECL' || $k eq 'BY' || $k eq 'statement_id' {
nqp::push(@anns, ':' ~ $k ~ '<' ~ $v ~ '>');
}
else { # dunno how to introspect
nqp::push(@anns, ':' ~ $k ~ '<?>');
}
}
}
}
}
nqp::join(' ',@anns);
}

method dump_children(int $indent, @onto) { }
@@ -24,8 +24,13 @@ class QAST::WVal is QAST::Node does QAST::CompileTimeValue {
}

method dump_extra_node_info() {
CATCH { return "?" }
CATCH { return "?" }
my $v := self.compile_time_value();
$v.HOW.name($v);
my $info := $v.HOW.name($v);
if self.ann('past_block') -> $qast {
$info := "$info :cuid("
~ nqp::ifnull(nqp::getattr($qast, QAST::Block, '$!cuid'), '?') ~ ")";
}
$info;
}
}

0 comments on commit 0264b23

Please sign in to comment.