Change 33710 by [EMAIL PROTECTED] on 2008/04/18 10:42:17

        Fix the line-number-in-elsif longstanding bug.
        This patch does two things :
        - newSTATEOP now nullifies the state op it
          just created if OPf_SPECIAL is passed to it
          in flags
        - the parser now inserts a nullified stateop
          in the expression block of an elsif

Affected files ...

... //depot/perl/op.c#1002 edit
... //depot/perl/perly.act#38 edit
... //depot/perl/perly.y#92 edit
... //depot/perl/t/lib/warnings/9uninit#24 edit

Differences ...

==== //depot/perl/op.c#1002 (text) ====
Index: perl/op.c
--- perl/op.c#1001~33695~       2008-04-15 08:54:31.000000000 -0700
+++ perl/op.c   2008-04-18 03:42:17.000000000 -0700
@@ -4419,6 +4419,8 @@
        }
     }
 
+    if (flags & OPf_SPECIAL)
+       op_null((OP*)cop);
     return prepend_elem(OP_LINESEQ, (OP*)cop, o);
 }
 

==== //depot/perl/perly.act#38 (text) ====
Index: perl/perly.act
--- perl/perly.act#37~33269~    2008-02-10 02:21:04.000000000 -0800
+++ perl/perly.act      2008-04-18 03:42:17.000000000 -0700
@@ -186,7 +186,7 @@
   case 27:
 #line 277 "perly.y"
     { PL_parser->copline = (line_t)IVAL((ps[(1) - (6)].val.i_tkval));
-                           (yyval.opval) = newCONDOP(0, (ps[(3) - 
(6)].val.opval), scope((ps[(5) - (6)].val.opval)), (ps[(6) - (6)].val.opval));
+                           (yyval.opval) = newCONDOP(0, 
newSTATEOP(OPf_SPECIAL,NULL,(ps[(3) - (6)].val.opval)), scope((ps[(5) - 
(6)].val.opval)), (ps[(6) - (6)].val.opval));
                            PL_hints |= HINT_BLOCK_SCOPE;
                          TOKEN_GETMAD((ps[(1) - 
(6)].val.i_tkval),(yyval.opval),'I');
                          TOKEN_GETMAD((ps[(2) - 
(6)].val.i_tkval),(yyval.opval),'(');

==== //depot/perl/perly.y#92 (text) ====
Index: perl/perly.y
--- perl/perly.y#91~33269~      2008-02-10 02:21:04.000000000 -0800
+++ perl/perly.y        2008-04-18 03:42:17.000000000 -0700
@@ -275,7 +275,7 @@
                        }
        |       ELSIF '(' mexpr ')' mblock else
                        { PL_parser->copline = (line_t)IVAL($1);
-                           $$ = newCONDOP(0, $3, scope($5), $6);
+                           $$ = newCONDOP(0, newSTATEOP(OPf_SPECIAL,NULL,$3), 
scope($5), $6);
                            PL_hints |= HINT_BLOCK_SCOPE;
                          TOKEN_GETMAD($1,$$,'I');
                          TOKEN_GETMAD($2,$$,'(');

==== //depot/perl/t/lib/warnings/9uninit#24 (text) ====
Index: perl/t/lib/warnings/9uninit
--- perl/t/lib/warnings/9uninit#23~33709~       2008-04-17 13:17:14.000000000 
-0700
+++ perl/t/lib/warnings/9uninit 2008-04-18 03:42:17.000000000 -0700
@@ -1322,7 +1322,6 @@
 EXPECT
 Use of uninitialized value $m1 in exit at - line 4.
 ########
-# TODO long standing bug - PL_curcop is not updated before the elsif
 use warnings 'uninitialized';
 my $undef;
 
End of Patch.

Reply via email to