diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B.xs | 9 | ||||
-rw-r--r-- | ext/B/t/terse.t | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/B/B.xs b/ext/B/B.xs index 885a73c6d9..6392b9b2cc 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -365,7 +365,7 @@ void walkoptree(pTHX_ SV *opsv, char *method) { dSP; - OP *o; + OP *o, *kid; dMY_CXT; if (!SvROK(opsv)) @@ -383,13 +383,18 @@ walkoptree(pTHX_ SV *opsv, char *method) PUTBACK; perl_call_method(method, G_DISCARD); if (o && (o->op_flags & OPf_KIDS)) { - OP *kid; for (kid = ((UNOP*)o)->op_first; kid; kid = kid->op_sibling) { /* Use the same opsv. Rely on methods not to mess it up. */ sv_setiv(newSVrv(opsv, cc_opclassname(aTHX_ kid)), PTR2IV(kid)); walkoptree(aTHX_ opsv, method); } } + if (o && (cc_opclass(aTHX_ o) == OPc_PMOP) + && (kid = cPMOPo->op_pmreplroot)) + { + sv_setiv(newSVrv(opsv, opclassnames[OPc_PMOP]), PTR2IV(kid)); + walkoptree(aTHX_ opsv, method); + } } typedef OP *B__OP; diff --git a/ext/B/t/terse.t b/ext/B/t/terse.t index 35f5eeef5e..33b2313137 100644 --- a/ext/B/t/terse.t +++ b/ext/B/t/terse.t @@ -78,6 +78,9 @@ sub bar { # make a PV $foo = "a string"; + + # make an OP_SUBSTCONT + $foo =~ s/(a)/$1/; } SKIP: { |