From: Gurusamy Sarathy Date: Sun, 23 May 1999 05:00:55 +0000 (+0000) Subject: remove redundant part of change#1169 superseded by change#2061; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a9ef352ac26829339bf17aa20568b3bde2fb1dd0;p=p5sagit%2Fp5-mst-13.2.git remove redundant part of change#1169 superseded by change#2061; avoid "future reserved word" warning on prototypical bearwords p4raw-link: @2061 on //depot/perl: bf8481137c02593eb36f8d0e234a2ec41a1c92e4 p4raw-link: @1169 on //depot/perl: 2a841d1398ee9bbf30a942905192cc2591b3e92a p4raw-id: //depot/perl@3446 --- diff --git a/t/lib/fatal.t b/t/lib/fatal.t index fb3757f..0192658 100755 --- a/t/lib/fatal.t +++ b/t/lib/fatal.t @@ -3,11 +3,11 @@ BEGIN { chdir 't' if -d 't'; unshift @INC, '../lib'; - print "1..9\n"; + print "1..13\n"; } use strict; -use Fatal qw(open); +use Fatal qw(open close); my $i = 1; eval { open FOO, ') =~ m|^#!./perl|; + print "not " if $@ or scalar(<$foo>) !~ m|^#!./perl|; + print "ok $i\n"; ++$i; + eval qq{ close FOO }; print "not " if $@; print "ok $i\n"; ++$i; - close FOO; } diff --git a/toke.c b/toke.c index 6f846dc..739c666 100644 --- a/toke.c +++ b/toke.c @@ -3154,11 +3154,8 @@ int yylex(PERL_YYLEX_PARAM_DECL) PL_oldoldbufptr < PL_bufptr && (PL_oldoldbufptr == PL_last_lop || PL_oldoldbufptr == PL_last_uni) && /* NO SKIPSPACE BEFORE HERE! */ - (PL_expect == XREF - || ((PL_opargs[PL_last_lop_op] >> OASHIFT)& 7) == OA_FILEREF - || (PL_last_lop_op == OP_ENTERSUB - && PL_last_proto - && PL_last_proto[PL_last_proto[0] == ';' ? 1 : 0] == '*')) ) + (PL_expect == XREF || + ((PL_opargs[PL_last_lop_op] >> OASHIFT)& 7) == OA_FILEREF)) { bool immediate_paren = *s == '('; @@ -3174,8 +3171,10 @@ int yylex(PERL_YYLEX_PARAM_DECL) /* (But it's an indir obj regardless for sort.) */ if ((PL_last_lop_op == OP_SORT || - (!immediate_paren && (!gv || !GvCVu(gv))) ) && - (PL_last_lop_op != OP_MAPSTART && PL_last_lop_op != OP_GREPSTART)){ + (!immediate_paren && (!gv || !GvCVu(gv)))) && + (PL_last_lop_op != OP_MAPSTART && + PL_last_lop_op != OP_GREPSTART)) + { PL_expect = (PL_last_lop == PL_oldoldbufptr) ? XTERM : XOPERATOR; goto bareword; } @@ -3187,6 +3186,7 @@ int yylex(PERL_YYLEX_PARAM_DECL) s = skipspace(s); if (*s == '(') { CLINE; + PL_last_proto = Nullch; if (gv && GvCVu(gv)) { CV *cv; if ((cv = GvCV(gv)) && SvPOK(cv)) @@ -3227,6 +3227,7 @@ int yylex(PERL_YYLEX_PARAM_DECL) PL_tokenbuf, PL_tokenbuf); PL_last_lop = PL_oldbufptr; PL_last_lop_op = OP_ENTERSUB; + PL_last_proto = Nullch; /* Check for a constant sub */ cv = GvCV(gv); if ((sv = cv_const_sv(cv))) { @@ -3253,24 +3254,28 @@ int yylex(PERL_YYLEX_PARAM_DECL) sv_setpv(PL_subname,"__ANON__"); PREBLOCK(LSTOPSUB); } - } else - PL_last_proto = NULL; + } PL_nextval[PL_nexttoke].opval = yylval.opval; PL_expect = XTERM; force_next(WORD); TOKEN(NOAMP); } + /* It could be a prototypical bearword. */ + if (PL_last_lop_op == OP_ENTERSUB && PL_last_proto && + PL_last_proto[PL_last_proto[0] == ';' ? 1 : 0] == '*') + { + PL_last_proto = Nullch; + TOKEN(WORD); + } + if (PL_hints & HINT_STRICT_SUBS && lastchar != '-' && strnNE(s,"->",2) && PL_last_lop_op != OP_TRUNCATE && /* S/F prototype in opcode.pl */ PL_last_lop_op != OP_ACCEPT && PL_last_lop_op != OP_PIPE_OP && - PL_last_lop_op != OP_SOCKPAIR && - !(PL_last_lop_op == OP_ENTERSUB - && PL_last_proto - && PL_last_proto[PL_last_proto[0] == ';' ? 1 : 0] == '*')) + PL_last_lop_op != OP_SOCKPAIR) { warn( "Bareword \"%s\" not allowed while \"strict subs\" in use",