develooper Front page | perl.perl5.porters | Postings from August 2011

Re: [perl #97110] perlbug AutoReply: User-defined functions with (;$)prototype should warn "Warning: Use of "%s" without parentheses is ambiguous"when applicable

From:
Matthew Horsfall
Date:
August 22, 2011 20:44
Subject:
Re: [perl #97110] perlbug AutoReply: User-defined functions with (;$)prototype should warn "Warning: Use of "%s" without parentheses is ambiguous"when applicable
Message ID:
CAJ0K8bgwYsxchCHVWy-noB-s0p_iDeWUuz+hMiUKwg=MBVXSjQ@mail.gmail.com
From 262668c3f5664bdb272326754ad3bebc59f22a0b Mon Sep 17 00:00:00 2001
From: Matthew Horsfall (alh) <wolfsage@gmail.com>
Date: Mon, 22 Aug 2011 23:32:10 -0400
Subject: [PATCH] When parsing subs with user-defined prototypes, store information needed to throw warnings

---
 toke.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/toke.c b/toke.c
index 1bf7e18..70250e2 100644
--- a/toke.c
+++ b/toke.c
@@ -285,6 +285,10 @@ 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; \
+	OPERATOR(f); \
+	}
 
 #define UNIBRACK(f) { \
 	pl_yylval.ival = f; \
@@ -6791,12 +6795,12 @@ Perl_yylex(pTHX)
 			     *proto == '\\' && proto[1] && proto[2] == '\0'
 			    )
 			)
-			    OPERATOR(UNIOPSUB);
+			    UNIPROTO(UNIOPSUB);
 			if (*proto == '\\' && proto[1] == '[') {
 			    const char *p = proto + 2;
 			    while(*p && *p != ']')
 				++p;
-			    if(*p == ']' && !p[1]) OPERATOR(UNIOPSUB);
+			    if(*p == ']' && !p[1]) UNIPROTO(UNIOPSUB);
 			}
 			if (*proto == '&' && *s == '{') {
 			    if (PL_curstash)
-- 
1.7.0.4




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About