This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #133850) allow attributes in sub-parses
authorTony Cook <tony@develop-help.com>
Wed, 29 May 2019 04:37:25 +0000 (14:37 +1000)
committerTony Cook <tony@develop-help.com>
Tue, 11 Jun 2019 06:08:36 +0000 (16:08 +1000)
t/op/attrs.t
toke.c

index 649525c..dd230b3 100644 (file)
@@ -507,4 +507,7 @@ BEGIN failed--compilation aborted at - line 1.
 EOS
               "attribute on our hash with sub of same name");
 
+fresh_perl_is('$_ = ""; s/^/ { my $x : shared = 1; } /e;', "", {},
+              "attributes in sub-parse");
+
 done_testing();
diff --git a/toke.c b/toke.c
index 61cdac4..dba907d 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5991,7 +5991,7 @@ Perl_yylex(pTHX)
 
        switch (PL_expect) {
        case XOPERATOR:
-           if (!PL_in_my || PL_lex_state != LEX_NORMAL)
+           if (!PL_in_my || (PL_lex_state != LEX_NORMAL && !PL_lex_brackets))
                break;
            PL_bufptr = s;      /* update in case we back off */
            if (*s == '=') {