This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop using the value of PL_expect
authorFather Chrysostomos <sprout@cpan.org>
Fri, 22 Aug 2014 12:53:42 +0000 (05:53 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 25 Aug 2014 02:02:57 +0000 (19:02 -0700)
The changes in commits leading up to this one avoided unnecessary
PL_expect assignments that would soon be clobbered by this
‘PL_expect = PL_lex_expect’ that restores the previous value.

Hence, we no longer even need to read the value of PL_lex_expect since
PL_expect hasn’t changed.

Just one piece of code (KEY_package) was setting PL_lex_expect
directly instead of having force_next copy it from PL_expect, so this
commit changes it to set PL_expect to the correct value.

toke.c

diff --git a/toke.c b/toke.c
index 7f89e54..3595570 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4282,7 +4282,6 @@ Perl_yylex(pTHX)
        pl_yylval = PL_nextval[PL_nexttoke];
        if (!PL_nexttoke) {
            PL_lex_state = PL_lex_defer;
-           PL_expect = PL_lex_expect;
            PL_lex_defer = LEX_NORMAL;
        }
        {
@@ -7519,8 +7518,7 @@ Perl_yylex(pTHX)
            s = force_word(s,WORD,FALSE,TRUE);
            s = SKIPSPACE1(s);
            s = force_strict_version(s);
-           PL_lex_expect = XBLOCK;
-           OPERATOR(PACKAGE);
+           PREBLOCK(PACKAGE);
 
        case KEY_pipe:
            LOP(OP_PIPE_OP,XTERM);