From 1b438339fe4a79ea019ab3758be0993b9b0b71df Mon Sep 17 00:00:00 2001 From: Gerard Goossen Date: Thu, 19 Apr 2007 17:31:27 +0200 Subject: [PATCH] Disable operator target setting for 'my' variables (OPpTARGET_MY) 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 | 23 ++++------------------- op.c | 10 ++++------ op.h | 1 - 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/mad/Nomad.pm b/mad/Nomad.pm index 1378e7b..c20d8b4 100755 --- a/mad/Nomad.pm +++ b/mad/Nomad.pm @@ -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 --- 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 --- 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 -- 1.8.3.1