This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: PL_in_eval purge
authorFather Chrysostomos <sprout@cpan.org>
Thu, 30 Aug 2012 20:34:14 +0000 (13:34 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 01:18:11 +0000 (18:18 -0700)
Many uses of PL_in_eval in toke.c are redundant.

PL_in_eval indicates not that we are parsing a string eval, but that
we are being called from an eval, whether stringy on not.  Even if
PL_in_eval were only for string eval, it would still not indicate that
we are parsing a string eval, because of eval 'require'.

This commit removes redundant uses of it (making things theoretically
slightly faster).

toke.c

diff --git a/toke.c b/toke.c
index ba7b920..c9384d2 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5250,8 +5250,8 @@ Perl_yylex(pTHX)
            PL_faketokens = 0;
 #endif
        if (PL_lex_state != LEX_NORMAL ||
            PL_faketokens = 0;
 #endif
        if (PL_lex_state != LEX_NORMAL ||
-            (PL_in_eval && !PL_rsfp && !PL_parser->filtered)) {
-           if (*s == '#' && s == PL_linestart && PL_in_eval
+            (!PL_rsfp && !PL_parser->filtered)) {
+           if (*s == '#' && s == PL_linestart
             && !PL_rsfp && !PL_parser->filtered) {
                /* handle eval qq[#line 1 "foo"\n ...] */
                CopLINE_dec(PL_curcop);
             && !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_madskills && !PL_lex_formbrack && !PL_in_eval) {
                s = SKIPSPACE0(s);
-               if (!PL_in_eval || PL_rsfp || PL_parser->filtered)
+               if (PL_rsfp || PL_parser->filtered)
                    incline(s);
            }
            else {
                    incline(s);
            }
            else {
@@ -6039,7 +6039,7 @@ Perl_yylex(pTHX)
            if (PL_expect == XSTATE && isALPHA(tmp) &&
                (s == PL_linestart+1 || s[-2] == '\n') )
                {
            if (PL_expect == XSTATE && isALPHA(tmp) &&
                (s == PL_linestart+1 || s[-2] == '\n') )
                {
-                   if ((PL_in_eval && !PL_rsfp && !PL_parser->filtered)
+                   if ((!PL_rsfp && !PL_parser->filtered)
                        || PL_lex_state != LEX_NORMAL) {
                        d = PL_bufend;
                        while (s < d) {
                        || PL_lex_state != LEX_NORMAL) {
                        d = PL_bufend;
                        while (s < d) {