This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c:S_lop: Don’t set PL_expect if PL_nexttoke
authorFather Chrysostomos <sprout@cpan.org>
Fri, 22 Aug 2014 00:59:06 +0000 (17:59 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 25 Aug 2014 02:02:56 +0000 (19:02 -0700)
Don’t set PL_expect if we have a ‘next token’, because when it is
popped off the pending token stack PL_expect will be set to the
saved value, clobbering this assigned value.  So the assignment is
unnecessary.

toke.c

diff --git a/toke.c b/toke.c
index 6ebbcc8..b5efb7a 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1863,12 +1863,12 @@ S_lop(pTHX_ I32 f, int x, char *s)
 
     pl_yylval.ival = f;
     CLINE;
-    PL_expect = x;
     PL_bufptr = s;
     PL_last_lop = PL_oldbufptr;
     PL_last_lop_op = (OPCODE)f;
     if (PL_nexttoke)
        goto lstop;
+    PL_expect = x;
     if (*s == '(')
        return REPORT(FUNC);
     s = PEEKSPACE(s);