From 62e4c90a271e4c9a7e8d172f3d36399885df56bc Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 31 Aug 2012 09:52:53 -0700 Subject: [PATCH] Revert "toke.c: PL_in_eval purge" This reverts commit 5c49e90fd624f3ab1cdb1f1d8e4f0525d7881b99. This change broke line numbers under mad when the last statement in the main program lacks a semicolon. I was mistaken in thinking that PL_rsfp would always be true when PL_in_eval is false. But the use of PL_in_eval is still wrong. Under a mad build, we get this inconsistency in line numbers: $ perl -e 'print "\n-e undef\n"' > foo $ ./miniperl foo Use of uninitialized value in -e at foo line 2. $ ./miniperl -we 'require "foo"' Use of uninitialized value in -e at foo line 3. foo did not return a true value at -e line 1. --- toke.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toke.c b/toke.c index ec633c4..2b6cf61 100644 --- a/toke.c +++ b/toke.c @@ -5250,8 +5250,8 @@ Perl_yylex(pTHX) PL_faketokens = 0; #endif if (PL_lex_state != LEX_NORMAL || - (!PL_rsfp && !PL_parser->filtered)) { - if (*s == '#' && s == PL_linestart + (PL_in_eval && !PL_rsfp && !PL_parser->filtered)) { + if (*s == '#' && s == PL_linestart && PL_in_eval && !PL_rsfp && !PL_parser->filtered) { /* handle eval qq[#line 1 "foo"\n ...] */ CopLINE_dec(PL_curcop); @@ -5259,7 +5259,7 @@ Perl_yylex(pTHX) } if (PL_madskills && !PL_lex_formbrack && !PL_in_eval) { s = SKIPSPACE0(s); - if (PL_rsfp || PL_parser->filtered) + if (!PL_in_eval || PL_rsfp || PL_parser->filtered) incline(s); } else { @@ -6047,7 +6047,7 @@ Perl_yylex(pTHX) if (PL_expect == XSTATE && isALPHA(tmp) && (s == PL_linestart+1 || s[-2] == '\n') ) { - if ((!PL_rsfp && !PL_parser->filtered) + if ((PL_in_eval && !PL_rsfp && !PL_parser->filtered) || PL_lex_state != LEX_NORMAL) { d = PL_bufend; while (s < d) { -- 2.7.4