op_dump(): display PARENT of top-most node
authorDavid Mitchell <davem@iabyn.com>
Tue, 20 Mar 2018 16:21:20 +0000 (16:21 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 21 Mar 2018 09:30:29 +0000 (09:30 +0000)
When dumping a subtree, display the op_parent() value for
the top-most node of the subtree.

dump.c
ext/Devel-Peek/t/Peek.t

diff --git a/dump.c b/dump.c
index aeb9955..227eb99 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1000,6 +1000,11 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
 
     /* print op common fields */
 
+    if (level == 0) {
+        S_opdump_indent(aTHX_ o, level, bar, file, "PARENT");
+        S_opdump_link(aTHX_ o, op_parent((OP*)o), file);
+    }
+
     if (o->op_targ && optype != OP_NULL)
            S_opdump_indent(aTHX_ o, level, bar, file, "TARG = %ld\n",
                 (long)o->op_targ);
index 58dc109..2c0c849 100644 (file)
@@ -1459,6 +1459,7 @@ for my $test (
 dumpindent is 4 at -e line 1.
      
 1    leave LISTOP(0xNNN) ===> [0x0]
+     PARENT ===> [0x0]
      TARG = 1
      FLAGS = (VOID,KIDS,PARENS,SLABBED)
      PRIVATE = (REFC)