summaryrefslogtreecommitdiff
path: root/regen/feature.pl
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-22 22:31:59 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-24 09:25:19 -0800
commit83141fdc89d784eac3fe1e46c6b00a63c868774f (patch)
tree4b1b7c4cd1817d13b8576eccf603c8b788e15540 /regen/feature.pl
parent6634bb9d0ed117be3584c9446cc6b05b93e3c773 (diff)
downloadperl-83141fdc89d784eac3fe1e46c6b00a63c868774f.tar.gz
feature.pm: Move hint normalisation to separate function
PL_hints/$^H can hold feature bundle hints that cause %^H to be ignored when features are looked up. When feature->import and ->unimport are invoked, they set bits in $^H such that %^H is used once more. But they have to modify %^H to con- tain what the bits in $^H imply. Up till now, unimport was delegating to import, which meant that more work was being done than necessary, because import would then detect the special condition of $^H and repeat (some of) that work.
Diffstat (limited to 'regen/feature.pl')
-rwxr-xr-xregen/feature.pl23
1 files changed, 13 insertions, 10 deletions
diff --git a/regen/feature.pl b/regen/feature.pl
index cbf4db8cad..bbaf15744b 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -561,6 +561,16 @@ sub current_bundle {
return $feature_bundle{@hint_bundles[$bundle_number >> $hint_shift]};
}
+sub normalise_hints {
+ # Delete any keys that may be left over from last time.
+ delete @^H{ values(%feature) };
+ $^H |= $hint_mask;
+ for (@{+shift}) {
+ $^H{$feature{$_}} = 1;
+ $^H |= $hint_uni8bit if $_ eq 'unicode_strings';
+ }
+}
+
sub import {
my $class = shift;
if (@_ == 0) {
@@ -568,12 +578,7 @@ sub import {
}
if (my $features = current_bundle) {
# Features are enabled implicitly via bundle hints.
-
- # Delete any keys that may be left over from last time.
- delete @^H{ values(%feature) };
-
- unshift @_, @$features;
- $^H |= $hint_mask;
+ normalise_hints $features;
}
while (@_) {
my $name = shift(@_);
@@ -600,10 +605,8 @@ sub unimport {
my $class = shift;
if (my $features = current_bundle) {
- # Features are enabled implicitly via bundle hints
- # Pass them to import() to put them in a form we can handle.
- import(undef, @$features);
- $^H |= $hint_mask;
+ # Features are enabled implicitly via bundle hints.
+ normalise_hints $features;
}
# A bare C<no feature> should disable *all* features