This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Replace change #4100 with
[perl5.git] / op.c
diff --git a/op.c b/op.c
index 3f5541c..0053bdd 100644 (file)
--- a/op.c
+++ b/op.c
@@ -1267,19 +1267,19 @@ Perl_mod(pTHX_ OP *o, I32 type)
                    if (kid->op_type == OP_METHOD_NAMED
                        || kid->op_type == OP_METHOD)
                    {
-                       OP *new;
+                       OP *newop;
 
                        if (kid->op_sibling || kid->op_next != kid) {
                            yyerror("panic: unexpected optree near method call");
                            break;
                        }
                        
-                       NewOp(1101, new, 1, OP);
-                       new->op_type = OP_RV2CV;
-                       new->op_ppaddr = PL_ppaddr[OP_RV2CV];
-                       new->op_next = new;
-                       kid->op_sibling = new;
-                       new->op_private |= OPpLVAL_INTRO;
+                       NewOp(1101, newop, 1, OP);
+                       newop->op_type = OP_RV2CV;
+                       newop->op_ppaddr = PL_ppaddr[OP_RV2CV];
+                       newop->op_next = newop;
+                       kid->op_sibling = newop;
+                       newop->op_private |= OPpLVAL_INTRO;
                        break;
                    }
                    
@@ -5381,14 +5381,13 @@ Perl_ck_sassign(pTHX_ OP *o)
            && !(kkid->op_private & OPpLVAL_INTRO))
        {
            /* Concat has problems if target is equal to right arg. */
-           if (kid->op_type == OP_CONCAT
-               && kLISTOP->op_first->op_sibling->op_type == OP_PADSV
-               && kLISTOP->op_first->op_sibling->op_targ == kkid->op_targ)
-           {
-               return o;
+           if (kid->op_type == OP_CONCAT) {
+               if (kLISTOP->op_first->op_sibling->op_type == OP_PADSV
+                   && kLISTOP->op_first->op_sibling->op_targ == kkid->op_targ)
+                   return o;
            }
-           if (kid->op_type == OP_JOIN) {
-               /* do_join has problems the arguments coincide with target.
+           else if (kid->op_type == OP_JOIN) {
+               /* do_join has problems if the arguments coincide with target.
                   In fact the second argument *can* safely coincide,
                   but ignore=pessimize this rare occasion. */
                OP *arg = kLISTOP->op_first->op_sibling; /* Skip PUSHMARK */
@@ -5400,6 +5399,12 @@ Perl_ck_sassign(pTHX_ OP *o)
                    arg = arg->op_sibling;
                }
            }
+           else if (kid->op_type == OP_QUOTEMETA) {
+               /* quotemeta has problems if the argument coincides with target. */
+               if (kLISTOP->op_first->op_type == OP_PADSV
+                   && kLISTOP->op_first->op_targ == kkid->op_targ)
+                   return o;
+           }
            kid->op_targ = kkid->op_targ;
            /* Now we do not need PADSV and SASSIGN. */
            kid->op_sibling = o->op_sibling;    /* NULL */