summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-06-22 19:03:32 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-06-23 06:04:02 -0700
commit50e9a4a73ae0d7fd56e72d5cd3befa63d9ebaa7b (patch)
treeebaeba050dfeea61602a9f1c479ed75f5b6c655b /pp_ctl.c
parent943d76f23b94ab9adf16ba9537d0c969a62828c6 (diff)
downloadperl-50e9a4a73ae0d7fd56e72d5cd3befa63d9ebaa7b.tar.gz
pp_leavesublv: Put the deref code inside if(scalar)
No need to check it in list context (but still assert that).
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index af520af67e..95f28566de 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2500,8 +2500,24 @@ PP(pp_leavesublv)
}
SP = MARK;
}
+ if (CxLVAL(cx) & OPpENTERSUB_DEREF) {
+ 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;
+ }
+ vivify_ref(TOPs, deref_type);
+ }
+ }
}
else if (gimme == G_ARRAY) {
+ assert(!(CxLVAL(cx) & OPpENTERSUB_DEREF));
if (CxLVAL(cx) & OPpENTERSUB_INARGS) {
/* We are an argument to a function or grep().
* This kind of lvalueness was legal before lvalue
@@ -2555,23 +2571,6 @@ PP(pp_leavesublv)
}
}
- if (CxLVAL(cx) & OPpENTERSUB_DEREF) {
- assert(gimme == G_SCALAR);
- 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;
- }
- vivify_ref(TOPs, deref_type);
- }
- }
-
PUTBACK;
LEAVE;