diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-04-16 19:53:28 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-04-16 19:53:28 +0000 |
commit | f3be9b723687406602d002dae264a30089a212fe (patch) | |
tree | a08aef3035c4fad7cf95484e86f413836845059c /ext | |
parent | 8d3e8850e58492e2cf837de0c4e42975e5f9ab0e (diff) | |
download | perl-f3be9b723687406602d002dae264a30089a212fe.tar.gz |
B::walkoptree bugfix (see also #15850)
p4raw-id: //depot/perl@15953
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: { |