diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-02-28 11:11:02 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-03-19 10:21:54 +0100 |
commit | 149758b3fc289aa2e2cbf92de18c3cee9475fe83 (patch) | |
tree | e6f40284d968d39d696b999396043600211fd0e3 | |
parent | 95c04cdeb56d45fc9abbac71ca13bfc750bc0a21 (diff) | |
download | perl-149758b3fc289aa2e2cbf92de18c3cee9475fe83.tar.gz |
In Deparse, use $feature::hint_mask directly, instead of copying its value.
Also, require feature unconditionally.
Deparse already directly uses data from feature, switch and warnings, so
this isn't a new trend in encapsulation breakage. Previously Deparse copied
the value of $feature::hint_mask, and lazily loaded require in 4 places.
-rw-r--r-- | dist/B-Deparse/Deparse.pm | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm index 72ad357455..2bd6b6317d 100644 --- a/dist/B-Deparse/Deparse.pm +++ b/dist/B-Deparse/Deparse.pm @@ -24,6 +24,7 @@ $VERSION = '1.13'; use strict; use vars qw/$AUTOLOAD/; use warnings (); +require feature; BEGIN { # List version-specific constants here. @@ -1448,11 +1449,8 @@ sub seq_subs { return @text; } -my $feature_bundle_mask = 0x1c000000; - sub _features_from_bundle { my ($hints, $hh) = @_; - require feature; local $^H = $hints; # Shh! Keep quite about this function. It is not to be # relied upon. @@ -1516,11 +1514,10 @@ sub pp_nextstate { if ($] >= 5.015006) { # feature bundle hints - my $from = $old_hints & $feature_bundle_mask; - my $to = $ hints & $feature_bundle_mask; + my $from = $old_hints & $feature::hint_mask; + my $to = $ hints & $feature::hint_mask; if ($from != $to) { - require feature; - if ($to == $feature_bundle_mask) { + if ($to == $feature::hint_mask) { if ($self->{'hinthash'}) { delete $self->{'hinthash'}{$_} for grep /^feature_/, keys %{$self->{'hinthash'}}; @@ -1601,7 +1598,7 @@ my %rev_feature; sub declare_hinthash { my ($from, $to, $indent, $hints) = @_; my $doing_features = - ($hints & $feature_bundle_mask) == $feature_bundle_mask; + ($hints & $feature::hint_mask) == $feature::hint_mask; my @decls; my @features; my @unfeatures; # bugs? @@ -1632,7 +1629,6 @@ sub declare_hinthash { } my @ret; if (@features || @unfeatures) { - require feature; if (!%rev_feature) { %rev_feature = reverse %feature::feature } } if (@features) { @@ -1691,8 +1687,8 @@ sub keyword { 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) { + my $hints = $self->{hints} & $feature::hint_mask; + if ($hints && $hints != $feature::hint_mask) { $hh = _features_from_bundle($self->{hints}); } elsif ($hints) { $hh = $self->{'hinthash'} } @@ -4550,11 +4546,10 @@ sub re_flags { elsif ($self->{hinthash} and $self->{hinthash}{reflags_charset} || $self->{hinthash}{feature_unicode} - or $self->{hints} & $feature_bundle_mask - && ($self->{hints} & $feature_bundle_mask) - != $feature_bundle_mask + or $self->{hints} & $feature::hint_mask + && ($self->{hints} & $feature::hint_mask) + != $feature::hint_mask && do { - require feature; $self->{hints} & $feature::hint_uni8bit; } ) { |