This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Disable operator target setting for 'my' variables (OPpTARGET_MY)
authorGerard Goossen <gerard@tty.nl>
Thu, 19 Apr 2007 15:31:27 +0000 (17:31 +0200)
committerDave Mitchell <davem@fdisolutions.com>
Sat, 12 May 2007 22:40:05 +0000 (22:40 +0000)
when madskills is active. Remove the p55 code required for dealing
with the optimized tree.

Subject:  [PATCH] disable operator with target my when madskills enabled
Message-Id:  <20070419133822.GG19244@ostwald>

also:

Remove the just remove madprop 'M' doc

Message-ID: <20070419134549.GH19244@ostwald>

p4raw-id: //depot/perl@31204

mad/Nomad.pm
op.c
op.h

index 1378e7b..c20d8b4 100755 (executable)
@@ -598,7 +598,6 @@ sub ast {
 
     my @retval;
     my @newkids;
-    push @retval, $self->madness('M ox');
     for my $kid (@{$$self{Kids}}) {
        push @newkids, $kid->ast($self, @_);
     }
@@ -615,7 +614,7 @@ package PLXML::baseop_unop;
 
 sub ast {
     my $self = shift;
-    my @newkids = $self->madness('d M ox o (');
+    my @newkids = $self->madness('d o (');
 
     if (exists $$self{Kids}) {
        my $arg = $$self{Kids}[0];
@@ -632,8 +631,6 @@ sub ast {
     my $self = shift;
     my @newkids;
 
-    push @newkids, $self->madness('M ox');
-
     my $left = $$self{Kids}[0];
     push @newkids, $left->ast($self, @_);
 
@@ -675,13 +672,9 @@ sub ast {
     my $self = shift;
 
     my @retval;
-    my @before;
     my @after;
-    if (@before = $self->madness('M')) {
-       push @before, $self->madness('ox');     # o is the function name
-    }
     if (@retval = $self->madness('X')) {
-       push @before, $self->madness('o x');
+       my @before, $self->madness('o x');
        return P5AST::listop->new(Kids => [@before,@retval]);
     }
 
@@ -703,7 +696,7 @@ sub ast {
     push @retval, @newkids;
 
     push @retval, $self->madness('} ] )');
-    return $self->newtype->new(Kids => [@before,@retval,@after]);
+    return $self->newtype->new(Kids => [@retval,@after]);
 }
 
 package PLXML::logop;
@@ -1858,10 +1851,6 @@ sub astnull {
     my $self = shift;
     my @newkids;
 
-    my @before;
-    if (@before = $self->madness('M')) {
-       push @before, $self->madness('ox');     # o is the .
-    }
     my @after;
     my $left = $$self{Kids}[0];
     push @newkids, $left->ast($self, @_);
@@ -1878,10 +1867,6 @@ sub ast {
     my $parent = $_[0];
     my @newkids;
 
-    my @before;
-    if (@before = $self->madness('M')) {
-       push @before, $self->madness('ox');     # o is the .
-    }
     my @after;
     my $left = $$self{Kids}[0];
     push @newkids, $left->ast($self, @_);
@@ -1891,7 +1876,7 @@ sub ast {
     my $right = $$self{Kids}[1];
     push @newkids, $right->ast($self, @_);
 
-    return $self->newtype->new(Kids => [@before, @newkids, @after]);
+    return $self->newtype->new(Kids => [@newkids, @after]);
 }
 
 package PLXML::op_stringify;
diff --git a/op.c b/op.c
index 481bf3e..30fb7fc 100644 (file)
--- a/op.c
+++ b/op.c
@@ -6975,7 +6975,10 @@ Perl_ck_sassign(pTHX_ OP *o)
     if ((PL_opargs[kid->op_type] & OA_TARGLEX)
        && !(kid->op_flags & OPf_STACKED)
        /* Cannot steal the second time! */
-       && !(kid->op_private & OPpTARGET_MY))
+       && !(kid->op_private & OPpTARGET_MY)
+       /* Keep the full thing for madskills */
+       && !PL_madskills
+       )
     {
        OP * const kkid = kid->op_sibling;
 
@@ -6988,13 +6991,8 @@ Perl_ck_sassign(pTHX_ OP *o)
            /* Now we do not need PADSV and SASSIGN. */
            kid->op_sibling = o->op_sibling;    /* NULL */
            cLISTOPo->op_first = NULL;
-#ifdef PERL_MAD
-           op_getmad(o,kid,'O');
-           op_getmad(kkid,kid,'M');
-#else
            op_free(o);
            op_free(kkid);
-#endif
            kid->op_private |= OPpTARGET_MY;    /* Used for context settings */
            return kid;
        }
diff --git a/op.h b/op.h
index f53c7a5..b835f9d 100644 (file)
--- a/op.h
+++ b/op.h
@@ -700,7 +700,6 @@ struct token {
  * l       last index of array ($#foo)
  * L       label
  * m       modifier on regex
- * M       my assignment slurped into some other operator's target
  * n       sub or format name
  * o       current operator/declarator name
  * o       else/continue