summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-02-27 18:24:57 +0100
committerNicholas Clark <nick@ccl4.org>2012-03-19 10:21:54 +0100
commitd37572645496516ed45536ef36684ba890c8f09b (patch)
tree2dc502f448dae61ebbb333be7c5bb78448faa639 /regen
parent36143a0c55b8cfba5c5c2c2b40c5e00bce067bf2 (diff)
downloadperl-d37572645496516ed45536ef36684ba890c8f09b.tar.gz
Merge the code common to feature::import and feature::unimport.
Diffstat (limited to 'regen')
-rwxr-xr-xregen/feature.pl35
1 files changed, 11 insertions, 24 deletions
diff --git a/regen/feature.pl b/regen/feature.pl
index 6d276ce511..79aa471687 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -606,29 +606,7 @@ sub import {
croak("No features specified");
}
- if (my $features = current_bundle) {
- # Features are enabled implicitly via bundle hints.
- normalise_hints $features;
- }
- while (@_) {
- my $name = shift;
- if (substr($name, 0, 1) eq ":") {
- my $v = substr($name, 1);
- if (!exists $feature_bundle{$v}) {
- $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
- if (!exists $feature_bundle{$v}) {
- unknown_feature_bundle(substr($name, 1));
- }
- }
- unshift @_, @{$feature_bundle{$v}};
- next;
- }
- if (!exists $feature{$name}) {
- unknown_feature($name);
- }
- $^H{$feature{$name}} = 1;
- $^H |= $hint_uni8bit if $name eq 'unicode_strings';
- }
+ __common(1, @_);
}
sub unimport {
@@ -640,6 +618,12 @@ sub unimport {
return;
}
+ __common(0, @_);
+}
+
+
+sub __common {
+ my $import = shift;
if (my $features = current_bundle) {
# Features are enabled implicitly via bundle hints.
normalise_hints $features;
@@ -660,7 +644,10 @@ sub unimport {
if (!exists $feature{$name}) {
unknown_feature($name);
}
- else {
+ if ($import) {
+ $^H{$feature{$name}} = 1;
+ $^H |= $hint_uni8bit if $name eq 'unicode_strings';
+ } else {
delete $^H{$feature{$name}};
$^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';
}