summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-07-19 14:12:38 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-07-19 14:12:38 +0000
commit7f73a9f140198d1b3d1c2f2b62d4fd14dc5667c3 (patch)
treeb2b93ed533f5fe20f74d67c1e63e28e1675cbbe4 /pad.c
parent4e3bc6ae6a0630a65b9a3f0043bebeeaa828d763 (diff)
downloadperl-7f73a9f140198d1b3d1c2f2b62d4fd14dc5667c3.tar.gz
Extend the the "our variable redeclared" warning to the case:
our $x; our $x; and add more tests p4raw-id: //depot/perl@25187
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pad.c b/pad.c
index 7366c9ae0e..58a37e6660 100644
--- a/pad.c
+++ b/pad.c
@@ -515,9 +515,10 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
- && !(is_our && (SvFLAGS(sv) & SVpad_OUR))
&& strEQ(name, SvPVX_const(sv)))
{
+ if (is_our && (SvFLAGS(sv) & SVpad_OUR))
+ break; /* "our" masking "our" */
Perl_warner(aTHX_ packWARN(WARN_MISC),
"\"%s\" variable %s masks earlier declaration in same %s",
(is_our ? "our" : "my"),
@@ -540,8 +541,9 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
{
Perl_warner(aTHX_ packWARN(WARN_MISC),
"\"our\" variable %s redeclared", name);
- Perl_warner(aTHX_ packWARN(WARN_MISC),
- "\t(Did you mean \"local\" instead of \"our\"?)\n");
+ if (off <= PL_comppad_name_floor)
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ "\t(Did you mean \"local\" instead of \"our\"?)\n");
break;
}
} while ( off-- > 0 );