summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGerard Goossen <gerard@ggoossen.net>2011-08-06 17:50:40 +0200
committerFather Chrysostomos <sprout@cpan.org>2011-08-08 15:49:45 -0700
commit3023b5f30c62e26185b48118c7c84030adb5b623 (patch)
treeb9d1e004c45ec9433e09894f46dd6cdca71663ea /op.c
parent83f9fced9447634b1f940717275290f7a74ab633 (diff)
downloadperl-3023b5f30c62e26185b48118c7c84030adb5b623.tar.gz
Change aassign_common_vars to check using the optree without using the linked list.
Besides no longer depending on the op chain this also solves a bug where the common vars where not detected because of logical operators.
Diffstat (limited to 'op.c')
-rw-r--r--op.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/op.c b/op.c
index 4187b50c6b..f862cd88ff 100644
--- a/op.c
+++ b/op.c
@@ -4806,9 +4806,8 @@ S_is_list_assignment(pTHX_ register const OP *o)
PERL_STATIC_INLINE bool
S_aassign_common_vars(pTHX_ OP* o)
{
- OP *lastop = o;
OP *curop;
- for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
+ for (curop = cUNOPo->op_first; curop; curop=curop->op_sibling) {
if (PL_opargs[curop->op_type] & OA_DANGEROUS) {
if (curop->op_type == OP_GV) {
GV *gv = cGVOPx_gv(curop);
@@ -4834,7 +4833,7 @@ S_aassign_common_vars(pTHX_ OP* o)
curop->op_type == OP_RV2AV ||
curop->op_type == OP_RV2HV ||
curop->op_type == OP_RV2GV) {
- if (lastop->op_type != OP_GV) /* funny deref? */
+ if (cUNOPx(curop)->op_first->op_type != OP_GV) /* funny deref? */
return TRUE;
}
else if (curop->op_type == OP_PUSHRE) {
@@ -4860,7 +4859,11 @@ S_aassign_common_vars(pTHX_ OP* o)
else
return TRUE;
}
- lastop = curop;
+
+ if (curop->op_flags & OPf_KIDS) {
+ if (aassign_common_vars(curop))
+ return TRUE;
+ }
}
return FALSE;
}
@@ -5006,6 +5009,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
PL_generation++;
if (aassign_common_vars(o))
o->op_private |= OPpASSIGN_COMMON;
+ LINKLIST(o);
}
if (right && right->op_type == OP_SPLIT && !PL_madskills) {