diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-24 19:20:00 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-24 21:11:05 -0800 |
commit | b5fb7ce319b450b42f4660d7628cff404a3f29f4 (patch) | |
tree | bb21013b1794064ed9496d77612801d29f4f6e16 /toke.c | |
parent | 547ae1291622100dc17f3ab6cb5aac35f22c5e43 (diff) | |
download | perl-b5fb7ce319b450b42f4660d7628cff404a3f29f4.tar.gz |
Don’t warn for foo+1 with ($) proto
Commit 22393538 added the warning for (;$) prototypes, but
ended up adding it for ($) as well.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -285,8 +285,8 @@ static const char* const lex_state_names[] = { } #define UNI(f) UNI2(f,XTERM) #define UNIDOR(f) UNI2(f,XTERMORDORDOR) -#define UNIPROTO(f) { \ - PL_last_uni = PL_oldbufptr; \ +#define UNIPROTO(f,optional) { \ + if (optional) PL_last_uni = PL_oldbufptr; \ OPERATOR(f); \ } @@ -6851,10 +6851,13 @@ Perl_yylex(pTHX) { STRLEN protolen = CvPROTOLEN(cv); const char *proto = CvPROTO(cv); + bool optional; if (!protolen) TERM(FUNC0SUB); - while (*proto == ';') + if ((optional = *proto == ';')) + do proto++; + while (*proto == ';'); if ( ( ( @@ -6867,12 +6870,13 @@ Perl_yylex(pTHX) *proto == '\\' && proto[1] && proto[2] == '\0' ) ) - UNIPROTO(UNIOPSUB); + UNIPROTO(UNIOPSUB,optional); if (*proto == '\\' && proto[1] == '[') { const char *p = proto + 2; while(*p && *p != ']') ++p; - if(*p == ']' && !p[1]) UNIPROTO(UNIOPSUB); + if(*p == ']' && !p[1]) + UNIPROTO(UNIOPSUB,optional); } if (*proto == '&' && *s == '{') { if (PL_curstash) |