toke.c: Remove dead code handling <FH> //
authorFather Chrysostomos <sprout@cpan.org>
Wed, 6 Nov 2013 18:55:36 +0000 (10:55 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 8 Nov 2013 16:15:58 +0000 (08:15 -0800)
A few lines of code added by this commit:

commit 6f33ba736d46c2f5bfdb2405fd09d82ec18a1d07
Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date:   Sun Aug 25 18:42:46 2002 +0000

    Fix parsing problems with the // operator.
    Make // able to follow various unary operators used without
    arguments or parens (shift, pop, getc, pos, readline,
    readlink, undef, umask, and the filetest operators), as
    well as the <FH> operator.

were already unreachable when they were added, specifically the code
for handling // after <FH> (which is fortunate, because XTERMORDORDOR
after <FH> would break <FH>+1).

S_scan_inputsymbol sets pl_yylval.ival to OP_NULL, since it has
already created the ops; it has done so since perl 5.000.  So this
branch is never reached when parsing <FH>.

The if-block containing these lines has had ‘|| op_type ==
OP_READLINE’ since perl 5.000, which has also always been redundant
for the same reason.

toke.c

diff --git a/toke.c b/toke.c
index 0773036..1b26d43 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2588,7 +2588,7 @@ S_sublex_start(pTHX)
        PL_lex_op = NULL;
        return THING;
     }
-    if (op_type == OP_CONST || op_type == OP_READLINE) {
+    if (op_type == OP_CONST) {
        SV *sv = tokeq(PL_lex_stuff);
 
        if (SvTYPE(sv) == SVt_PVIV) {
@@ -2601,9 +2601,6 @@ S_sublex_start(pTHX)
        }
        pl_yylval.opval = (OP*)newSVOP(op_type, 0, sv);
        PL_lex_stuff = NULL;
-       /* Allow <FH> // "foo" */
-       if (op_type == OP_READLINE)
-           PL_expect = XTERMORDORDOR;
        return THING;
     }