toke.c: Remove redundant check
authorFather Chrysostomos <sprout@cpan.org>
Tue, 31 Dec 2013 05:18:54 +0000 (21:18 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 31 Dec 2013 05:18:54 +0000 (21:18 -0800)
(and turn it into an assertion.)

PL_lex_repl can only be set here if we are parsing a substitution
(OP_SUBST) or transliteration (OP_TRANS).  I believe this check
has been unnecessary since perl 5.000, which it was added.

toke.c

diff --git a/toke.c b/toke.c
index ca306f1..8ac0f31 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2746,7 +2746,8 @@ S_sublex_done(pTHX)
 
     /* Is there a right-hand side to take care of? (s//RHS/ or tr//RHS/) */
     assert(PL_lex_inwhat != OP_TRANSR);
-    if (PL_lex_repl && (PL_lex_inwhat == OP_SUBST || PL_lex_inwhat == OP_TRANS)) {
+    if (PL_lex_repl) {
+       assert (PL_lex_inwhat == OP_SUBST || PL_lex_inwhat == OP_TRANS);
        PL_linestr = PL_lex_repl;
        PL_lex_inpat = 0;
        PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart = SvPVX(PL_linestr);