diff options
author | Gerard Goossen <gerard@ggoossen.net> | 2011-08-13 18:38:13 +0200 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-08-15 20:27:01 -0700 |
commit | 5c906035ffb6b2857a0f941a97ac9e7bb4126275 (patch) | |
tree | 1207023797ece7e334d596be0a38f272bf596734 /op.c | |
parent | c192154b7b5060196110d20f17b18135fa216641 (diff) | |
download | perl-5c906035ffb6b2857a0f941a97ac9e7bb4126275.tar.gz |
Propagate lvalue context only to children of list ops which are not in void context.
Children list ops might be in void context because the list is in scalar
context. A test that discarded elements in a list are not assigned lvalue
context is added.
Children of a list op might also be in void context because they are
special entersub ops for attributes. This patch makes the
OPpENTERSUB_NOMOD flag redundant.
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1718,6 +1718,8 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) return o; } + assert( (o->op_flags & OPf_WANT) != OPf_WANT_VOID ); + switch (o->op_type) { case OP_UNDEF: localize = 0; @@ -2016,7 +2018,10 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) case OP_LIST: localize = 0; for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling) - op_lvalue(kid, type); + /* elements might be in void context because the list is + in scalar context or because they are attribute sub calls */ + if ( (kid->op_flags & OPf_WANT) != OPf_WANT_VOID ) + op_lvalue(kid, type); break; case OP_RETURN: |