This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add &CORE::delete
authorFather Chrysostomos <sprout@cpan.org>
Fri, 27 Apr 2012 03:40:48 +0000 (20:40 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 29 May 2012 16:36:24 +0000 (09:36 -0700)
gv.c
t/op/coreamp.t
t/op/coresubs.t

diff --git a/gv.c b/gv.c
index b8f92e7..091fa96 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -458,7 +458,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
         no support for funcs that do not parse like funcs */
     case KEY___DATA__: case KEY___END__: case KEY_and: case KEY_AUTOLOAD:
     case KEY_BEGIN   : case KEY_CHECK  : case KEY_cmp: case KEY_CORE    :
-    case KEY_default : case KEY_delete : case KEY_DESTROY:
+    case KEY_default : case KEY_DESTROY:
     case KEY_do      : case KEY_dump   : case KEY_else  : case KEY_elsif  :
     case KEY_END     : case KEY_eq     : case KEY_eval  : case KEY_exists :
     case KEY_for     : case KEY_foreach: case KEY_format: case KEY_ge     :
@@ -476,7 +476,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
     case KEY_x    : case KEY_xor  : case KEY_y        :
        return NULL;
     case KEY_chdir:
-    case KEY_chomp: case KEY_chop: case KEY_defined:
+    case KEY_chomp: case KEY_chop: case KEY_defined: case KEY_delete:
     case KEY_each: case KEY_eof: case KEY_exec:
     case KEY_keys:
     case KEY_lstat:
index 65b299f..7928680 100644 (file)
@@ -885,8 +885,8 @@ like $@, qr'^Undefined format "STDOUT" called',
     if (m?__END__?..${\0} and /^[-+](.*)/) {
       my $word = $1;
       next if
-       $word =~ /^(?:s(?:t(?:ate|udy)|(?:pli|or)t|calar|ay|ub)?|d(?:e(?:f
-                  ault|lete)|ump|o)|p(?:r(?:ototype|intf?)|ackag
+       $word =~ /^(?:s(?:t(?:ate|udy)|(?:pli|or)t|calar|ay|ub)?|d(?:ef
+                  ault|ump|o)|p(?:r(?:ototype|intf?)|ackag
                   e|os)|e(?:ls(?:if|e)|xists|val|q)|g(?:[et]|iven|lob|oto
                   |rep)|u(?:n(?:less|def|til)|se)|l(?:(?:as)?t|ocal|e)|re
                   (?:quire|turn|do)|__(?:DATA|END)__|for(?:each|mat)?|(?:
index 84528b5..2ebd3aa 100644 (file)
@@ -17,7 +17,7 @@ my $bd = new B::Deparse '-p';
 
 my %unsupported = map +($_=>1), qw (
  __DATA__ __END__ AUTOLOAD BEGIN UNITCHECK CORE DESTROY END INIT CHECK and
-  cmp default delete do  dump  else  elsif  eq  eval  exists  for  foreach
+  cmp default do dump else elsif eq eval exists for foreach
   format ge given glob goto grep gt if last le local lt m map my  ne  next
   no or our package pos print printf prototype q qq qr qw qx redo  require
   return s say scalar sort split state study sub tr undef unless until use
@@ -26,6 +26,7 @@ my %unsupported = map +($_=>1), qw (
 my %args_for = (
   dbmopen  => '%1,$2,$3',
   dbmclose => '%1',
+  delete   => '$1[2]',
 );
 
 use File::Spec::Functions;
@@ -50,7 +51,8 @@ while(<$kh>) {
 
       CORE::state $protochar = qr/([^\\]|\\(?:[^[]|\[[^]]+\]))/;
       my $numargs =
-            () = $proto =~ s/;.*//r =~ /\G$protochar/g;
+            $word eq 'delete' ? 1 :
+            (() = $proto =~ s/;.*//r =~ /\G$protochar/g);
       my $code =
          "#line 1 This-line-makes-__FILE__-easier-to-test.
           sub { () = (my$word("