From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Sun, 27 Jan 2002 14:51:10 +0000 (+0100)
Subject: new switch: don't check prototypes while deparsing
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=acaaef34ab7836e502b053f317539b0368c50596;p=p5sagit%2Fp5-mst-13.2.git

new switch: don't check prototypes while deparsing
Message-ID: <20020127145110.A16332@rafael>

p4raw-id: //depot/perl@14440
---

diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm
index a0f0e78..c373a69 100644
--- a/ext/B/B/Deparse.pm
+++ b/ext/B/B/Deparse.pm
@@ -490,6 +490,8 @@ sub new {
 	    $self->{'files'}{$1} = 1;
 	} elsif ($arg eq "-p") {
 	    $self->{'parens'} = 1;
+	} elsif ($arg eq "-P") {
+	    $self->{'noproto'} = 1;
 	} elsif ($arg eq "-l") {
 	    $self->{'linenums'} = 1;
 	} elsif ($arg eq "-q") {
@@ -2779,6 +2781,7 @@ sub method {
 # or ("", $args_after_prototype_demunging) if it does.
 sub check_proto {
     my $self = shift;
+    return "&" if $self->{'noproto'};
     my($proto, @args) = @_;
     my($arg, $real);
     my $doneok = 0;
@@ -3781,6 +3784,22 @@ C<B::Deparse,-p> will print
 which probably isn't what you intended (the C<'???'> is a sign that
 perl optimized away a constant value).
 
+=item B<-P>
+
+Disable prototype checking. With this option, all function calls are
+deparsed as if no prototype was defined for them. In other words,
+
+    perl -MO=Deparse,-P -e 'sub foo (\@) { 1 } foo @x'
+
+will print
+
+    sub foo (\@) {
+	1;
+    }
+    &foo(\@x);
+
+making clear how the parameters are actually passed to C<foo>.
+
 =item B<-q>
 
 Expand double-quoted strings into the corresponding combinations of