summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-03 17:48:31 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-03 17:48:31 +0000
commit10c8fecdc2f0a2ef9c548abff5961fa25cd83eca (patch)
tree750e204e55ff0008040249f2114df3d38df43fcf /op.c
parent49cb0e56d106a6666efa8660569a458b7eb3368b (diff)
downloadperl-10c8fecdc2f0a2ef9c548abff5961fa25cd83eca.tar.gz
support for list assignment to pseudohashes (from John Tobey
<jtobey@john-edwin-tobey.org>) p4raw-id: //depot/perl@5492
Diffstat (limited to 'op.c')
-rw-r--r--op.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/op.c b/op.c
index 9a3a187004..adf6aee7e0 100644
--- a/op.c
+++ b/op.c
@@ -3273,6 +3273,8 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
if (list_assignment(left)) {
dTHR;
+ OP *curop;
+
PL_modcount = 0;
PL_eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
left = mod(left, OP_AASSIGN);
@@ -3283,12 +3285,19 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
op_free(right);
return Nullop;
}
- o = newBINOP(OP_AASSIGN, flags,
- list(force_list(right)),
- list(force_list(left)) );
+ curop = list(force_list(left));
+ o = newBINOP(OP_AASSIGN, flags, list(force_list(right)), curop);
o->op_private = 0 | (flags >> 8);
+ for (curop = ((LISTOP*)curop)->op_first;
+ curop; curop = curop->op_sibling)
+ {
+ if (curop->op_type == OP_RV2HV &&
+ ((UNOP*)curop)->op_first->op_type != OP_GV) {
+ o->op_private |= OPpASSIGN_HASH;
+ break;
+ }
+ }
if (!(left->op_private & OPpLVAL_INTRO)) {
- OP *curop;
OP *lastop = o;
PL_generation++;
for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
@@ -3332,7 +3341,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
lastop = curop;
}
if (curop != o)
- o->op_private = OPpASSIGN_COMMON;
+ o->op_private |= OPpASSIGN_COMMON;
}
if (right && right->op_type == OP_SPLIT) {
OP* tmpop;