From: Robin Houston Date: Thu, 26 Apr 2001 21:08:32 +0000 (+0100) Subject: C<$x = /(.)/> ne C<($x) = /(.)/> X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7013e6ae0ee41c19b7e4c3937d6f838af15b9af8;p=p5sagit%2Fp5-mst-13.2.git C<$x = /(.)/> ne C<($x) = /(.)/> Message-ID: <20010426210832.A28419@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9863 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 7e14c8e..a982da2 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -1581,6 +1581,7 @@ sub pp_ftbinary { ftst(@_, "-B") } sub SWAP_CHILDREN () { 1 } sub ASSIGN () { 2 } # has OP= variant +sub LIST_CONTEXT () { 4 } # Assignment is in list context my(%left, %right); @@ -1683,6 +1684,7 @@ sub binop { ($left, $right) = ($right, $left); } $left = $self->deparse_binop_left($op, $left, $prec); + $left = "($left)" if $flags & LIST_CONTEXT && $left =~ /^\$/; $right = $self->deparse_binop_right($op, $right, $prec); return $self->maybe_parens("$left $opname$eq $right", $cx, $prec); } @@ -1729,7 +1731,7 @@ sub pp_sle { binop(@_, "le", 15) } sub pp_scmp { binop(@_, "cmp", 14) } sub pp_sassign { binop(@_, "=", 7, SWAP_CHILDREN) } -sub pp_aassign { binop(@_, "=", 7, SWAP_CHILDREN) } +sub pp_aassign { binop(@_, "=", 7, SWAP_CHILDREN | LIST_CONTEXT) } # `.' is special because concats-of-concats are optimized to save copying # by making all but the first concat stacked. The effect is as if the