summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-05 08:48:35 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-05 08:48:35 -0800
commita46b39a853149ac3ddcaad16f3c7be0b86d520d0 (patch)
tree2e348384b86880b5278f7bebfec766ac1a3295e9 /toke.c
parentbade7fbcf63fdefa0b4fd8a0321087860e413483 (diff)
downloadperl-a46b39a853149ac3ddcaad16f3c7be0b86d520d0.tar.gz
[perl #90030] sort with no arguments
This eliminates the error ‘sort is now a reserved word’, which was added for the sake of code that does close(sort) at about the time that sort became a keyword. As Tom Christiansen pointed out, it has been long enough. This error only occurred with ) or ; after the keyword. In other cases with no arguments, like {sort} and (sort,0), it was treated as an empty list. So this commit makes it follow that. Since the tests triggered it, this commit also fixes a crash caused by commit 540dd770, which, when seeing whether it can optimise something like ‘@a = sort @a’, assumes that there is something after the sort, and crashes when there isn’t, as in {@a = sort}.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index a40dd39acf..6766c0561c 100644
--- a/toke.c
+++ b/toke.c
@@ -8003,8 +8003,6 @@ Perl_yylex(pTHX)
case KEY_sort:
checkcomma(s,PL_tokenbuf,"subroutine name");
s = SKIPSPACE1(s);
- if (*s == ';' || *s == ')') /* probably a close */
- Perl_croak(aTHX_ "sort is now a reserved word");
PL_expect = XTERM;
s = force_word(s,WORD,TRUE,TRUE,FALSE);
LOP(OP_SORT,XREF);