summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-06-09 21:24:01 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-06-09 21:24:01 -0700
commitfad4a2e4a4e2d22bf0b29de7f20808f0a01e79a2 (patch)
treef6b51a40b445bc5fa5ddd5159e0b5422935eba82 /op.c
parent6a8709a60c31d74562d0cb240c7a34a5768b3a94 (diff)
downloadperl-fad4a2e4a4e2d22bf0b29de7f20808f0a01e79a2.tar.gz
Scalar keys assignment through lvalue subs
This used not to work: sub foo :lvalue { keys %wallet } foo = 37; Now it does. It was just a matter of following the right code path in op_lvalue when the parent op is a leavesublv instead of a sassign.
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/op.c b/op.c
index ecbf4c53d6..b91f32284e 100644
--- a/op.c
+++ b/op.c
@@ -1681,7 +1681,7 @@ Perl_op_lvalue(pTHX_ OP *o, I32 type)
case OP_KEYS:
case OP_RKEYS:
- if (type != OP_SASSIGN)
+ if (type != OP_SASSIGN && type != OP_LEAVESUBLV)
goto nomod;
goto lvalue_func;
case OP_SUBSTR:
@@ -1690,9 +1690,9 @@ Perl_op_lvalue(pTHX_ OP *o, I32 type)
/* FALL THROUGH */
case OP_POS:
case OP_VEC:
+ lvalue_func:
if (type == OP_LEAVESUBLV)
o->op_private |= OPpMAYBE_LVSUB;
- lvalue_func:
pad_free(o->op_targ);
o->op_targ = pad_alloc(o->op_type, SVs_PADMY);
assert(SvTYPE(PAD_SV(o->op_targ)) == SVt_NULL);