summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorGerard Goossen <gerard@ggoossen.net>2011-08-31 15:55:26 +0200
committerFather Chrysostomos <sprout@cpan.org>2011-09-01 12:45:11 -0700
commit0e9700df31679b575960004d0c9d53e4f67341b3 (patch)
treea173c48eb7c8aaec2532c0b2b58d70c639630960 /pp_ctl.c
parent6c5d44995b59b5064afd13d482ddd637f85f4db5 (diff)
downloadperl-0e9700df31679b575960004d0c9d53e4f67341b3.tar.gz
Use OPpDEREF for lvalue sub, such that the flags contains the deref type, instead of deriving it from the opchain.
Also contains a test where using the opchain to determine the deref type fails.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 67b11e3228..0d2aae1639 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2365,24 +2365,15 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme,
EXTEND(newsp,1);
*++newsp = &PL_sv_undef;
}
- if (CxLVAL(cx) & OPpENTERSUB_DEREF) {
+ if (CxLVAL(cx) & OPpDEREF) {
SvGETMAGIC(TOPs);
if (!SvOK(TOPs)) {
- U8 deref_type;
- if (cx->blk_sub.retop->op_type == OP_RV2SV)
- deref_type = OPpDEREF_SV;
- else if (cx->blk_sub.retop->op_type == OP_RV2AV)
- deref_type = OPpDEREF_AV;
- else {
- assert(cx->blk_sub.retop->op_type == OP_RV2HV);
- deref_type = OPpDEREF_HV;
- }
- TOPs = vivify_ref(TOPs, deref_type);
+ TOPs = vivify_ref(TOPs, CxLVAL(cx) & OPpDEREF);
}
}
}
else if (gimme == G_ARRAY) {
- assert (!(CxLVAL(cx) & OPpENTERSUB_DEREF));
+ assert (!(CxLVAL(cx) & OPpDEREF));
if (ref || !CxLVAL(cx))
while (++MARK <= SP)
*++newsp =