summaryrefslogtreecommitdiff
path: root/dist/B-Deparse
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-10-09 15:50:12 +0100
committerDavid Mitchell <davem@iabyn.com>2012-10-10 16:39:21 +0100
commit3ac5308ab39749a39e7bc0b3c492597ed2a8bd2f (patch)
treee6a16374d7e9fa5bedd172fd3f7270ba4cb6f743 /dist/B-Deparse
parentca3319858bbce2cc97800745a8a871cd3cab6a87 (diff)
downloadperl-3ac5308ab39749a39e7bc0b3c492597ed2a8bd2f.tar.gz
Deparse: handle some strong keywords better
In general, a strong keyword 'foo' will get deparsed as plain 'foo' rather than 'CORE::foo', even in the presence of a sub foo{}. However, these weren't: glob pos prototype scalar study undef This was due to them having prototypes.
Diffstat (limited to 'dist/B-Deparse')
-rw-r--r--dist/B-Deparse/Deparse.pm17
1 files changed, 14 insertions, 3 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm
index 354e30f62c..1dc1ef435b 100644
--- a/dist/B-Deparse/Deparse.pm
+++ b/dist/B-Deparse/Deparse.pm
@@ -1681,6 +1681,17 @@ my %feature_keywords = (
fc => 'fc',
);
+# keywords that are strong and also have a prototype
+#
+my %strong_proto_keywords = map { $_ => 1 } qw(
+ glob
+ pos
+ prototype
+ scalar
+ study
+ undef
+);
+
sub keyword {
my $self = shift;
my $name = shift;
@@ -1696,9 +1707,9 @@ sub keyword {
if !$hh
|| !$hh->{"feature_$feature_keywords{$name}"}
}
- if (
- $name !~ /^(?:chom?p|do|exec|glob|s(?:elect|ystem))\z/
- && !defined eval{prototype "CORE::$name"}
+ if ($strong_proto_keywords{$name}
+ || ($name !~ /^(?:chom?p|do|exec|glob|s(?:elect|ystem))\z/
+ && !defined eval{prototype "CORE::$name"})
) { return $name }
if (
exists $self->{subs_declared}{$name}