summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-05-20 14:30:14 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-05-20 15:59:58 -0700
commitdb629560b69530994e144a9d538421f72ec29483 (patch)
treebea0ae385bfc7a34ee6815833920d04ddb3b93fc /lib
parentc2c360591864547f4210a9df74e0064cff39a11b (diff)
downloadperl-db629560b69530994e144a9d538421f72ec29483.tar.gz
Give feature.pm the concept of no-op features
Diffstat (limited to 'lib')
-rw-r--r--lib/B/Deparse.t10
-rw-r--r--lib/feature.pm11
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index 19db4040bc..fe13aae2a8 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -1941,12 +1941,11 @@ my($a, $b, $c) = @_;
####
# SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
# lexical subroutine
-use feature 'lexical_subs';
+# CONTEXT use feature 'lexical_subs';
no warnings "experimental::lexical_subs";
my sub f {}
print f();
>>>>
-use feature 'lexical_subs';
BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x15"}
my sub f {
BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"}
@@ -1957,20 +1956,17 @@ print f();
####
# SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
# lexical "state" subroutine
-use feature 'state', 'lexical_subs';
+# CONTEXT use feature 'state', 'lexical_subs';
no warnings 'experimental::lexical_subs';
state sub f {}
print f();
>>>>
-use feature 'lexical_subs';
BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x15"}
-CORE::state sub f {
+state sub f {
BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"}
- use feature 'state';
}
BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"}
-use feature 'state';
print f();
####
# SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
diff --git a/lib/feature.pm b/lib/feature.pm
index f197f48e26..caa7326ba9 100644
--- a/lib/feature.pm
+++ b/lib/feature.pm
@@ -14,12 +14,10 @@ our %feature = (
switch => 'feature_switch',
bitwise => 'feature_bitwise',
evalbytes => 'feature_evalbytes',
- postderef => 'feature_postderef',
array_base => 'feature_arybase',
signatures => 'feature_signatures',
current_sub => 'feature___SUB__',
refaliasing => 'feature_refaliasing',
- lexical_subs => 'feature_lexsubs',
postderef_qq => 'feature_postderef_qq',
unicode_eval => 'feature_unieval',
unicode_strings => 'feature_unicode',
@@ -30,7 +28,7 @@ our %feature_bundle = (
"5.11" => [qw(array_base say state switch unicode_strings)],
"5.15" => [qw(current_sub evalbytes fc say state switch unicode_eval unicode_strings)],
"5.23" => [qw(current_sub evalbytes fc postderef_qq say state switch unicode_eval unicode_strings)],
- "all" => [qw(array_base bitwise current_sub evalbytes fc lexical_subs postderef postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)],
+ "all" => [qw(array_base bitwise current_sub evalbytes fc postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)],
"default" => [qw(array_base)],
);
@@ -48,6 +46,10 @@ $feature_bundle{"5.24"} = $feature_bundle{"5.23"};
$feature_bundle{"5.25"} = $feature_bundle{"5.23"};
$feature_bundle{"5.26"} = $feature_bundle{"5.23"};
$feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
+my %noops = (
+ postderef => 1,
+ lexical_subs => 1,
+);
our $hint_shift = 26;
our $hint_mask = 0x1c000000;
@@ -497,6 +499,9 @@ sub __common {
next;
}
if (!exists $feature{$name}) {
+ if (exists $noops{$name}) {
+ next;
+ }
unknown_feature($name);
}
if ($import) {