diff options
author | David Mitchell <davem@iabyn.com> | 2018-03-20 09:51:37 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-03-20 09:51:37 +0000 |
commit | d2a5d4734224aa3f826a63fe4add5c9082a4c798 (patch) | |
tree | 27cc4fbec694af12a57e9d3d8530538ebda2ca8c /lib | |
parent | 1200fc239c567abfe6f2d129157e11d9f185968b (diff) | |
download | perl-d2a5d4734224aa3f826a63fe4add5c9082a4c798.tar.gz |
Deparse: handle \our @a
\our @a
was being deparsed as
\our(@a)
which incorrectly converts the \ from a scalar op to a list op
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Deparse.pm | 2 | ||||
-rw-r--r-- | lib/B/Deparse.t | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index af64cd23f4..7fca6886d7 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -1575,7 +1575,7 @@ sub maybe_local { if $self->{'avoid_local'}{$$op}; if ($need_parens) { return "$our_local($text)"; - } elsif (want_scalar($op)) { + } elsif (want_scalar($op) || $our_local eq 'our') { return "$our_local $text"; } else { return $self->maybe_parens_func("$our_local", $text, $cx, 16); diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 983956d476..9c25007ea3 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -3039,3 +3039,8 @@ state @a :shared; state @b :shared = (1, 2); state %h :shared; state %i :shared = ('a', 1, 'b', 2); +#### +# \our @a shouldn't be a list +my $r = \our @a; +my(@l) = \our((@b)); +@l = \our(@c, @d); |