From: Rafael Garcia-Suarez Date: Tue, 16 Apr 2002 19:53:28 +0000 (+0000) Subject: B::walkoptree bugfix (see also #15850) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3be9b723687406602d002dae264a30089a212fe;p=p5sagit%2Fp5-mst-13.2.git B::walkoptree bugfix (see also #15850) p4raw-id: //depot/perl@15953 --- diff --git a/ext/B/B.xs b/ext/B/B.xs index 885a73c..6392b9b 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 35f5eee..33b2313 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: {