summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorRobin Houston <robin@cpan.org>2005-10-14 01:54:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-10-19 20:46:50 +0000
commite4c5ccf3177be837114b952c25e52a6812f35eb5 (patch)
tree3cb0b2f16a4dac34aa1f36c59756b461f2b9ba55 /op.c
parent76e603de23f04d6f155b7c537f88eaf478e50689 (diff)
downloadperl-e4c5ccf3177be837114b952c25e52a6812f35eb5.tar.gz
Re: [PATCH] Re: [perl #37350] $#{@$aref} in debugger gives: Bizarre copy of ARRAY in leave
Message-ID: <20051013235457.GA23386@rpc142.cs.man.ac.uk> p4raw-id: //depot/perl@25808
Diffstat (limited to 'op.c')
-rw-r--r--op.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/op.c b/op.c
index 5d593f8edf..19eb99c64a 100644
--- a/op.c
+++ b/op.c
@@ -1422,7 +1422,7 @@ Perl_refkids(pTHX_ OP *o, I32 type)
}
OP *
-Perl_ref(pTHX_ OP *o, I32 type)
+Perl_doref(pTHX_ OP *o, I32 type, bool set_op_ref)
{
dVAR;
OP *kid;
@@ -1444,12 +1444,12 @@ Perl_ref(pTHX_ OP *o, I32 type)
case OP_COND_EXPR:
for (kid = cUNOPo->op_first->op_sibling; kid; kid = kid->op_sibling)
- ref(kid, type);
+ doref(kid, type, set_op_ref);
break;
case OP_RV2SV:
if (type == OP_DEFINED)
o->op_flags |= OPf_SPECIAL; /* don't create GV */
- ref(cUNOPo->op_first, o->op_type);
+ doref(cUNOPo->op_first, o->op_type, set_op_ref);
/* FALL THROUGH */
case OP_PADSV:
if (type == OP_RV2SV || type == OP_RV2AV || type == OP_RV2HV) {
@@ -1466,28 +1466,30 @@ Perl_ref(pTHX_ OP *o, I32 type)
case OP_RV2AV:
case OP_RV2HV:
- o->op_flags |= OPf_REF;
+ if (set_op_ref)
+ o->op_flags |= OPf_REF;
/* FALL THROUGH */
case OP_RV2GV:
if (type == OP_DEFINED)
o->op_flags |= OPf_SPECIAL; /* don't create GV */
- ref(cUNOPo->op_first, o->op_type);
+ doref(cUNOPo->op_first, o->op_type, set_op_ref);
break;
case OP_PADAV:
case OP_PADHV:
- o->op_flags |= OPf_REF;
+ if (set_op_ref)
+ o->op_flags |= OPf_REF;
break;
case OP_SCALAR:
case OP_NULL:
if (!(o->op_flags & OPf_KIDS))
break;
- ref(cBINOPo->op_first, type);
+ doref(cBINOPo->op_first, type, set_op_ref);
break;
case OP_AELEM:
case OP_HELEM:
- ref(cBINOPo->op_first, o->op_type);
+ doref(cBINOPo->op_first, o->op_type, set_op_ref);
if (type == OP_RV2SV || type == OP_RV2AV || type == OP_RV2HV) {
o->op_private |= (type == OP_RV2AV ? OPpDEREF_AV
: type == OP_RV2HV ? OPpDEREF_HV
@@ -1498,11 +1500,13 @@ Perl_ref(pTHX_ OP *o, I32 type)
case OP_SCOPE:
case OP_LEAVE:
+ set_op_ref = FALSE;
+ /* FALL THROUGH */
case OP_ENTER:
case OP_LIST:
if (!(o->op_flags & OPf_KIDS))
break;
- ref(cLISTOPo->op_last, type);
+ doref(cLISTOPo->op_last, type, set_op_ref);
break;
default:
break;
@@ -1511,6 +1515,15 @@ Perl_ref(pTHX_ OP *o, I32 type)
}
+/* ref() is now a macro using Perl_doref;
+ * this version provided for binary compatibility only.
+ */
+OP *
+Perl_ref(pTHX_ OP *o, I32 type)
+{
+ return doref(o, type, TRUE);
+}
+
STATIC OP *
S_dup_attrlist(pTHX_ OP *o)
{