summaryrefslogtreecommitdiff
path: root/lib/B/Deparse.t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-01-18 09:44:10 +0000
committerDavid Mitchell <davem@iabyn.com>2018-01-19 21:01:21 +0000
commit894f226e51fd4f80c130447477b789cd25f37574 (patch)
tree8ece1b7b33c24bd2fca57a1c37329b7636c3fb2f /lib/B/Deparse.t
parent8162c1afb1f54c157e62cc2627c156ef349a83d4 (diff)
downloadperl-894f226e51fd4f80c130447477b789cd25f37574.tar.gz
move sub attributes before the signature
RT #132141 Attributes such as :lvalue have to come *before* the signature to ensure that they're applied to any code block within the signature; e.g. sub f :lvalue ($a = do { $x = "abc"; return substr($x,0,1)}) { .... } So this commit moves sub attributes to come before the signature. This is how they were originally, but they were swapped with v5.21.7-394-gabcf453. This commit is essentially a revert of that commit (and its followups v5.21.7-395-g71917f6, v5.21.7-421-g63ccd0d), plus some extra work for Deparse, and an extra test. See: RT #123069 for why they were originally swapped RT #132141 for why that broke :lvalue http://nntp.perl.org/group/perl.perl5.porters/247999 for a general discussion about RT #132141
Diffstat (limited to 'lib/B/Deparse.t')
-rw-r--r--lib/B/Deparse.t6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index cbee5427a8..3219e19b81 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -2586,7 +2586,7 @@ $x++;
no warnings;
use feature 'signatures';
my $x;
-sub ($a, $b) : prototype($$) {
+my $f = sub : prototype($$) ($a, $b) {
$x++;
}
;
@@ -2596,7 +2596,7 @@ $x++;
no warnings;
use feature 'signatures';
my $x;
-sub ($a, $b) : prototype($$) lvalue {
+my $f = sub : prototype($$) lvalue ($a, $b) {
$x++;
}
;
@@ -2606,7 +2606,7 @@ $x++;
no warnings;
use feature 'signatures';
my $x;
-sub ($a, $b) : lvalue method {
+my $f = sub : lvalue method ($a, $b) {
$x++;
}
;