Change 18571 by rgs@rgs-home on 2003/01/22 21:22:31
Subject: [PATCH] Re: difference between my and our before introduction
From: Dave Mitchell <[EMAIL PROTECTED]>
Date: Thu, 16 Jan 2003 17:12:37 +0000
Message-ID: <[EMAIL PROTECTED]>
(with a small test tweak)
Affected files ...
... //depot/perl/pad.c#13 edit
... //depot/perl/t/comp/our.t#3 edit
... //depot/perl/toke.c#456 edit
Differences ...
==== //depot/perl/pad.c#13 (text) ====
Index: perl/pad.c
--- perl/pad.c#12~18456~ Tue Jan 7 01:20:22 2003
+++ perl/pad.c Wed Jan 22 13:22:31 2003
@@ -552,13 +552,8 @@
continue;
}
else {
- if (
- ( seq > (U32)I_32(SvNVX(sv)) /* min */
- && seq <= (U32)SvIVX(sv)) /* max */
- ||
- /* 'our' is visible before introduction */
- (!SvIVX(sv) && (SvFLAGS(sv) & SVpad_OUR))
- )
+ if ( seq > (U32)I_32(SvNVX(sv)) /* min */
+ && seq <= (U32)SvIVX(sv)) /* max */
return off;
}
}
==== //depot/perl/t/comp/our.t#3 (text) ====
Index: perl/t/comp/our.t
--- perl/t/comp/our.t#2~17963~ Wed Oct 2 07:15:22 2002
+++ perl/t/comp/our.t Wed Jan 22 13:22:31 2003
@@ -6,7 +6,7 @@
require './test.pl';
}
-print "1..6\n";
+print "1..7\n";
{
package TieAll;
@@ -48,3 +48,13 @@
{our (@x);}
is(TieAll->calls, '', 'our (@x) has no runtime effect');
+
+
+$y = 1;
+{
+ my $y = 2;
+ {
+ our $y = $y;
+ is($y, 2, 'our shouldnt be visible until introduced')
+ }
+}
==== //depot/perl/toke.c#456 (text) ====
Index: perl/toke.c
--- perl/toke.c#455~18456~ Tue Jan 7 01:20:22 2003
+++ perl/toke.c Wed Jan 22 13:22:31 2003
@@ -5279,7 +5279,9 @@
*/
if (!strchr(PL_tokenbuf,':')) {
- if ((tmp = pad_findmy(PL_tokenbuf)) != NOT_IN_PAD) {
+ if (!PL_in_my)
+ tmp = pad_findmy(PL_tokenbuf);
+ if (tmp != NOT_IN_PAD) {
/* might be an "our" variable" */
if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
/* build ops for a bareword */
End of Patch.