summaryrefslogtreecommitdiff
path: root/ext/B
diff options
context:
space:
mode:
authorRobin Houston <robin@cpan.org>2001-04-26 22:08:32 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-26 19:10:35 +0000
commit7013e6ae0ee41c19b7e4c3937d6f838af15b9af8 (patch)
tree79c68baeb2224d60fc635995ab5260be97a4d075 /ext/B
parent1ced0934e21e7f931312ef2a026cf1ae22815ba3 (diff)
downloadperl-7013e6ae0ee41c19b7e4c3937d6f838af15b9af8.tar.gz
C<$x = /(.)/> ne C<($x) = /(.)/>
Message-ID: <20010426210832.A28419@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9863
Diffstat (limited to 'ext/B')
-rw-r--r--ext/B/B/Deparse.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm
index 7e14c8e5cc..a982da217f 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