mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
Revert "switch removal: remove the feature from feature.pm"
This reverts commit 149bea6edf8c49a1faf4fac124567101172d96bd.
This commit is contained in:
parent
cc963bbe18
commit
9a10079617
29
feature.h
generated
29
feature.h
generated
@ -34,9 +34,10 @@
|
||||
#define FEATURE_SAY_BIT 0x00040000
|
||||
#define FEATURE_SIGNATURES_BIT 0x00080000
|
||||
#define FEATURE_STATE_BIT 0x00100000
|
||||
#define FEATURE_TRY_BIT 0x00200000
|
||||
#define FEATURE_UNIEVAL_BIT 0x00400000
|
||||
#define FEATURE_UNICODE_BIT 0x00800000
|
||||
#define FEATURE_SWITCH_BIT 0x00200000
|
||||
#define FEATURE_TRY_BIT 0x00400000
|
||||
#define FEATURE_UNIEVAL_BIT 0x00800000
|
||||
#define FEATURE_UNICODE_BIT 0x01000000
|
||||
|
||||
#define FEATURE_ALL_INDEX 0
|
||||
#define FEATURE_ANY_INDEX 0
|
||||
@ -59,6 +60,7 @@
|
||||
#define FEATURE_SAY_INDEX 0
|
||||
#define FEATURE_SIGNATURES_INDEX 0
|
||||
#define FEATURE_STATE_INDEX 0
|
||||
#define FEATURE_SWITCH_INDEX 0
|
||||
#define FEATURE_TRY_INDEX 0
|
||||
#define FEATURE_UNIEVAL_INDEX 0
|
||||
#define FEATURE_UNICODE_INDEX 0
|
||||
@ -163,6 +165,14 @@
|
||||
FEATURE_IS_ENABLED_MASK(FEATURE_STATE_INDEX, FEATURE_STATE_BIT)) \
|
||||
)
|
||||
|
||||
#define FEATURE_SWITCH_IS_ENABLED \
|
||||
( \
|
||||
(CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
|
||||
CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
|
||||
|| (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
|
||||
FEATURE_IS_ENABLED_MASK(FEATURE_SWITCH_INDEX, FEATURE_SWITCH_BIT)) \
|
||||
)
|
||||
|
||||
#define FEATURE_BITWISE_IS_ENABLED \
|
||||
( \
|
||||
(CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_527 && \
|
||||
@ -504,6 +514,12 @@ S_magic_sethint_feature(pTHX_ SV *keysv, const char *keypv, STRLEN keylen,
|
||||
index = FEATURE_STATE_INDEX;
|
||||
break;
|
||||
}
|
||||
else if (keylen == sizeof("feature_switch")-1
|
||||
&& memcmp(subf+1, "witch", keylen - sizeof("feature_")) == 0) {
|
||||
mask = FEATURE_SWITCH_BIT;
|
||||
index = FEATURE_SWITCH_INDEX;
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
case 't':
|
||||
@ -700,6 +716,13 @@ PL_feature_bits[] = {
|
||||
FEATURE_STATE_BIT,
|
||||
FEATURE_STATE_INDEX
|
||||
},
|
||||
{
|
||||
/* feature switch */
|
||||
"feature_switch",
|
||||
STRLENs("feature_switch"),
|
||||
FEATURE_SWITCH_BIT,
|
||||
FEATURE_SWITCH_INDEX
|
||||
},
|
||||
{
|
||||
/* feature try */
|
||||
"feature_try",
|
||||
|
||||
@ -978,7 +978,7 @@ say 'foo';
|
||||
use feature ':5.10';
|
||||
say 'foo';
|
||||
>>>>
|
||||
use feature 'say', 'state';
|
||||
use feature 'say', 'state', 'switch';
|
||||
say 'foo';
|
||||
####
|
||||
# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
|
||||
@ -1023,7 +1023,7 @@ __SUB__;
|
||||
use feature ':5.15';
|
||||
__SUB__;
|
||||
>>>>
|
||||
use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'unicode_strings', 'unicode_eval';
|
||||
use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval';
|
||||
__SUB__;
|
||||
####
|
||||
# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
|
||||
|
||||
61
lib/feature.pm
generated
61
lib/feature.pm
generated
@ -4,7 +4,7 @@
|
||||
# Any changes made here will be lost!
|
||||
|
||||
package feature;
|
||||
our $VERSION = '1.93';
|
||||
our $VERSION = '1.94';
|
||||
|
||||
our %feature = (
|
||||
fc => 'feature_fc',
|
||||
@ -16,6 +16,7 @@ our %feature = (
|
||||
class => 'feature_class',
|
||||
defer => 'feature_defer',
|
||||
state => 'feature_state',
|
||||
switch => 'feature_switch',
|
||||
bitwise => 'feature_bitwise',
|
||||
indirect => 'feature_indirect',
|
||||
evalbytes => 'feature_evalbytes',
|
||||
@ -34,16 +35,16 @@ our %feature = (
|
||||
);
|
||||
|
||||
our %feature_bundle = (
|
||||
"5.10" => [qw(apostrophe_as_package_separator bareword_filehandles indirect multidimensional say state)],
|
||||
"5.11" => [qw(apostrophe_as_package_separator bareword_filehandles indirect multidimensional say state unicode_strings)],
|
||||
"5.15" => [qw(apostrophe_as_package_separator bareword_filehandles current_sub evalbytes fc indirect multidimensional say state unicode_eval unicode_strings)],
|
||||
"5.23" => [qw(apostrophe_as_package_separator bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq say state unicode_eval unicode_strings)],
|
||||
"5.27" => [qw(apostrophe_as_package_separator bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state unicode_eval unicode_strings)],
|
||||
"5.10" => [qw(apostrophe_as_package_separator bareword_filehandles indirect multidimensional say state switch)],
|
||||
"5.11" => [qw(apostrophe_as_package_separator bareword_filehandles indirect multidimensional say state switch unicode_strings)],
|
||||
"5.15" => [qw(apostrophe_as_package_separator bareword_filehandles current_sub evalbytes fc indirect multidimensional say state switch unicode_eval unicode_strings)],
|
||||
"5.23" => [qw(apostrophe_as_package_separator bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)],
|
||||
"5.27" => [qw(apostrophe_as_package_separator bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)],
|
||||
"5.35" => [qw(apostrophe_as_package_separator bareword_filehandles bitwise current_sub evalbytes fc isa postderef_qq say signatures state unicode_eval unicode_strings)],
|
||||
"5.37" => [qw(apostrophe_as_package_separator bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state unicode_eval unicode_strings)],
|
||||
"5.39" => [qw(apostrophe_as_package_separator bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state try unicode_eval unicode_strings)],
|
||||
"5.41" => [qw(bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state try unicode_eval unicode_strings)],
|
||||
"all" => [qw(all any apostrophe_as_package_separator bareword_filehandles bitwise class current_sub declared_refs defer evalbytes extra_paired_delimiters fc indirect isa module_true multidimensional postderef_qq refaliasing say signatures state try unicode_eval unicode_strings)],
|
||||
"all" => [qw(all any apostrophe_as_package_separator bareword_filehandles bitwise class current_sub declared_refs defer evalbytes extra_paired_delimiters fc indirect isa module_true multidimensional postderef_qq refaliasing say signatures state switch try unicode_eval unicode_strings)],
|
||||
"default" => [qw(apostrophe_as_package_separator bareword_filehandles indirect multidimensional)],
|
||||
);
|
||||
|
||||
@ -78,7 +79,6 @@ my %noops = (
|
||||
);
|
||||
my %removed = (
|
||||
array_base => 1,
|
||||
switch => 1,
|
||||
);
|
||||
|
||||
our $hint_shift = 26;
|
||||
@ -178,10 +178,21 @@ This feature is available starting with Perl 5.10.
|
||||
|
||||
=head2 The 'switch' feature
|
||||
|
||||
C<use feature 'switch'> told the compiler to enable the Raku
|
||||
B<WARNING>: This feature is still experimental and the implementation may
|
||||
change or be removed in future versions of Perl. For this reason, Perl will
|
||||
warn when you use the feature, unless you have explicitly disabled the warning:
|
||||
|
||||
no warnings "experimental::smartmatch";
|
||||
|
||||
C<use feature 'switch'> tells the compiler to enable the Raku
|
||||
given/when construct.
|
||||
|
||||
This feature was removed in Perl 5.42.
|
||||
See L<perlsyn/"Switch Statements"> for details.
|
||||
|
||||
This feature is available starting with Perl 5.10.
|
||||
It is deprecated starting with Perl 5.38, and using
|
||||
C<given>, C<when> or smartmatch will throw a warning.
|
||||
It will be removed in Perl 5.42.
|
||||
|
||||
=head2 The 'unicode_strings' feature
|
||||
|
||||
@ -568,68 +579,72 @@ The following feature bundles are available:
|
||||
|
||||
:5.10 apostrophe_as_package_separator
|
||||
bareword_filehandles indirect
|
||||
multidimensional say state
|
||||
multidimensional say state switch
|
||||
|
||||
:5.12 apostrophe_as_package_separator
|
||||
bareword_filehandles indirect
|
||||
multidimensional say state unicode_strings
|
||||
multidimensional say state switch
|
||||
unicode_strings
|
||||
|
||||
:5.14 apostrophe_as_package_separator
|
||||
bareword_filehandles indirect
|
||||
multidimensional say state unicode_strings
|
||||
multidimensional say state switch
|
||||
unicode_strings
|
||||
|
||||
:5.16 apostrophe_as_package_separator
|
||||
bareword_filehandles current_sub evalbytes
|
||||
fc indirect multidimensional say state
|
||||
unicode_eval unicode_strings
|
||||
switch unicode_eval unicode_strings
|
||||
|
||||
:5.18 apostrophe_as_package_separator
|
||||
bareword_filehandles current_sub evalbytes
|
||||
fc indirect multidimensional say state
|
||||
unicode_eval unicode_strings
|
||||
switch unicode_eval unicode_strings
|
||||
|
||||
:5.20 apostrophe_as_package_separator
|
||||
bareword_filehandles current_sub evalbytes
|
||||
fc indirect multidimensional say state
|
||||
unicode_eval unicode_strings
|
||||
switch unicode_eval unicode_strings
|
||||
|
||||
:5.22 apostrophe_as_package_separator
|
||||
bareword_filehandles current_sub evalbytes
|
||||
fc indirect multidimensional say state
|
||||
unicode_eval unicode_strings
|
||||
switch unicode_eval unicode_strings
|
||||
|
||||
:5.24 apostrophe_as_package_separator
|
||||
bareword_filehandles current_sub evalbytes
|
||||
fc indirect multidimensional postderef_qq
|
||||
say state unicode_eval unicode_strings
|
||||
say state switch unicode_eval
|
||||
unicode_strings
|
||||
|
||||
:5.26 apostrophe_as_package_separator
|
||||
bareword_filehandles current_sub evalbytes
|
||||
fc indirect multidimensional postderef_qq
|
||||
say state unicode_eval unicode_strings
|
||||
say state switch unicode_eval
|
||||
unicode_strings
|
||||
|
||||
:5.28 apostrophe_as_package_separator
|
||||
bareword_filehandles bitwise current_sub
|
||||
evalbytes fc indirect multidimensional
|
||||
postderef_qq say state unicode_eval
|
||||
postderef_qq say state switch unicode_eval
|
||||
unicode_strings
|
||||
|
||||
:5.30 apostrophe_as_package_separator
|
||||
bareword_filehandles bitwise current_sub
|
||||
evalbytes fc indirect multidimensional
|
||||
postderef_qq say state unicode_eval
|
||||
postderef_qq say state switch unicode_eval
|
||||
unicode_strings
|
||||
|
||||
:5.32 apostrophe_as_package_separator
|
||||
bareword_filehandles bitwise current_sub
|
||||
evalbytes fc indirect multidimensional
|
||||
postderef_qq say state unicode_eval
|
||||
postderef_qq say state switch unicode_eval
|
||||
unicode_strings
|
||||
|
||||
:5.34 apostrophe_as_package_separator
|
||||
bareword_filehandles bitwise current_sub
|
||||
evalbytes fc indirect multidimensional
|
||||
postderef_qq say state unicode_eval
|
||||
postderef_qq say state switch unicode_eval
|
||||
unicode_strings
|
||||
|
||||
:5.36 apostrophe_as_package_separator
|
||||
|
||||
@ -26,6 +26,7 @@ use warnings;
|
||||
my %feature = (
|
||||
say => 'say',
|
||||
state => 'state',
|
||||
switch => 'switch',
|
||||
bitwise => 'bitwise',
|
||||
evalbytes => 'evalbytes',
|
||||
current_sub => '__SUB__',
|
||||
@ -57,13 +58,14 @@ my %feature = (
|
||||
# 5.odd implies the next 5.even, but an explicit 5.even can override it.
|
||||
|
||||
# features bundles
|
||||
use constant V5_9_5 => sort qw{say state indirect multidimensional bareword_filehandles apostrophe_as_package_separator};
|
||||
use constant V5_9_5 => sort qw{say state switch indirect multidimensional bareword_filehandles apostrophe_as_package_separator};
|
||||
use constant V5_11 => sort ( +V5_9_5, qw{unicode_strings} );
|
||||
use constant V5_15 => sort ( +V5_11, qw{unicode_eval evalbytes current_sub fc} );
|
||||
use constant V5_23 => sort ( +V5_15, qw{postderef_qq} );
|
||||
use constant V5_27 => sort ( +V5_23, qw{bitwise} );
|
||||
|
||||
use constant V5_35 => sort grep {; $_ ne 'indirect'
|
||||
use constant V5_35 => sort grep {; $_ ne 'switch'
|
||||
&& $_ ne 'indirect'
|
||||
&& $_ ne 'multidimensional' } +V5_27, qw{isa signatures};
|
||||
|
||||
use constant V5_37 => sort grep {; $_ ne 'bareword_filehandles' } +V5_35, qw{module_true};
|
||||
@ -110,7 +112,7 @@ my %feature_bundle = (
|
||||
);
|
||||
|
||||
my @noops = qw( postderef lexical_subs );
|
||||
my @removed = qw( array_base switch );
|
||||
my @removed = qw( array_base );
|
||||
|
||||
|
||||
###########################################################################
|
||||
@ -609,7 +611,7 @@ read_only_bottom_close_and_rename($h);
|
||||
|
||||
__END__
|
||||
package feature;
|
||||
our $VERSION = '1.93';
|
||||
our $VERSION = '1.94';
|
||||
|
||||
FEATURES
|
||||
|
||||
@ -701,10 +703,21 @@ This feature is available starting with Perl 5.10.
|
||||
|
||||
=head2 The 'switch' feature
|
||||
|
||||
C<use feature 'switch'> told the compiler to enable the Raku
|
||||
B<WARNING>: This feature is still experimental and the implementation may
|
||||
change or be removed in future versions of Perl. For this reason, Perl will
|
||||
warn when you use the feature, unless you have explicitly disabled the warning:
|
||||
|
||||
no warnings "experimental::smartmatch";
|
||||
|
||||
C<use feature 'switch'> tells the compiler to enable the Raku
|
||||
given/when construct.
|
||||
|
||||
This feature was removed in Perl 5.42.
|
||||
See L<perlsyn/"Switch Statements"> for details.
|
||||
|
||||
This feature is available starting with Perl 5.10.
|
||||
It is deprecated starting with Perl 5.38, and using
|
||||
C<given>, C<when> or smartmatch will throw a warning.
|
||||
It will be removed in Perl 5.42.
|
||||
|
||||
=head2 The 'unicode_strings' feature
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ EXPECT
|
||||
default: apostrophe_as_package_separator bareword_filehandles indirect multidimensional
|
||||
unicode_strings is not enabled
|
||||
bundle: default
|
||||
5.12: apostrophe_as_package_separator bareword_filehandles indirect multidimensional say state unicode_strings
|
||||
5.12: apostrophe_as_package_separator bareword_filehandles indirect multidimensional say state switch unicode_strings
|
||||
unicode_strings is enabled
|
||||
bundle: 5.11
|
||||
########
|
||||
|
||||
@ -8,12 +8,3 @@ OPTIONS regex
|
||||
########
|
||||
no feature "array_base";
|
||||
EXPECT
|
||||
########
|
||||
# NAME switch feature removed
|
||||
use feature "switch";
|
||||
EXPECT
|
||||
OPTIONS regex
|
||||
^Feature "switch" is not supported by Perl [v0-9.]+ at - line 1.
|
||||
########
|
||||
no feature "switch";
|
||||
EXPECT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user