summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-24 00:06:20 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-24 09:25:21 -0800
commit223b1722e239dec6362760bb4d15561271c666bf (patch)
tree6ecf0c591bf99b30ac516fb2d0b8173b9e61ab97 /dist
parent6389c77752f6ccdaf7373d97ae65079e9f58d270 (diff)
downloadperl-223b1722e239dec6362760bb4d15561271c666bf.tar.gz
Deparse CORE::say, etc., when bundle hints are in use
Diffstat (limited to 'dist')
-rw-r--r--dist/B-Deparse/Deparse.pm16
-rw-r--r--dist/B-Deparse/t/deparse.t35
2 files changed, 49 insertions, 2 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm
index d7a5caacc2..b78ef671f4 100644
--- a/dist/B-Deparse/Deparse.pm
+++ b/dist/B-Deparse/Deparse.pm
@@ -1583,14 +1583,26 @@ my %feature_keywords = (
__SUB__ => '__SUB__',
);
+my $feature_bundle_mask = 0x1c000000;
+
sub keyword {
my $self = shift;
my $name = shift;
return $name if $name =~ /^CORE::/; # just in case
if (exists $feature_keywords{$name}) {
+ my $hh;
+ my $hints = $self->{hints} & $feature_bundle_mask;
+ if ($hints && $hints != $feature_bundle_mask) {
+ require feature;
+ local $^H = $self->{hints};
+ # Shh! Keep quite about this function. It is not to be
+ # relied upon.
+ $hh = { map +($_ => 1), feature::current_bundle() };
+ }
+ elsif ($hints) { $hh = $self->{'hinthash'} }
return "CORE::$name"
- if !$self->{'hinthash'}
- || !$self->{'hinthash'}{"feature_$feature_keywords{$name}"}
+ if !$hh
+ || !$hh->{"feature_$feature_keywords{$name}"}
}
if (
$name !~ /^(?:chom?p|do|exec|glob|s(?:elect|ystem))\z/
diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t
index 046d276416..92917fd276 100644
--- a/dist/B-Deparse/t/deparse.t
+++ b/dist/B-Deparse/t/deparse.t
@@ -837,6 +837,41 @@ CORE::given ($x) {
CORE::evalbytes '';
() = CORE::__SUB__;
####
+# feature features when feature has been disabled by use VERSION
+use feature (sprintf(":%vd", $^V));
+use 1;
+CORE::state $x;
+CORE::say $x;
+CORE::given ($x) {
+ CORE::when (3) {
+ continue;
+ }
+ CORE::default {
+ CORE::break;
+ }
+}
+CORE::evalbytes '';
+() = CORE::__SUB__;
+>>>>
+BEGIN {
+ $^H{'feature___SUB__'} = '1';
+ $^H{'feature_unieval'} = '1';
+ $^H{'feature_unicode'} = '1';
+ $^H{'feature_evalbytes'} = '1';
+}
+CORE::state $x;
+CORE::say $x;
+CORE::given ($x) {
+ CORE::when (3) {
+ continue;
+ }
+ CORE::default {
+ CORE::break;
+ }
+}
+CORE::evalbytes '';
+() = CORE::__SUB__;
+####
# $#- $#+ $#{%} etc.
my @x;
@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&}, $#{*});