Front page | perl.perl5.changes |
Postings from March 2012
[perl.git] branch smoke-me/Deparse-feature-detangle, updated. v5.15.8-125-g3a56084
From:
Nicholas Clark
Date:
March 13, 2012 09:28
Subject:
[perl.git] branch smoke-me/Deparse-feature-detangle, updated. v5.15.8-125-g3a56084
Message ID:
E1S7UZk-00030I-U6@camel.ams6.corp.booking.com
In perl.git, the branch smoke-me/Deparse-feature-detangle has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/3a56084401f5e1a2432dd1e0a7aea0efd2ed28f4?hp=c2357b5c6baff9eb71fd8560bf76082546b1555c>
- Log -----------------------------------------------------------------
commit 3a56084401f5e1a2432dd1e0a7aea0efd2ed28f4
Author: Nicholas Clark <nick@ccl4.org>
Date: Tue Feb 28 23:30:30 2012 +0100
In B::Deparse::_features_from_bundle(), don't call feature::current_bundle()
Instead, directly access feature's package variables, as B::Deparse already
does in 14 other places. (It also has its tentacles firmly into strict
and warning's package variables - it's not fussy)
feature::current_bundle() was not part of the documented API of feature
either, so B::Deparse wasn't clean previously.
M dist/B-Deparse/Deparse.pm
commit 9a53ca2e18f447e4e39ade4bdf9eb750a8c1a4a7
Author: Nicholas Clark <nick@ccl4.org>
Date: Tue Feb 28 11:11:02 2012 +0100
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.
M dist/B-Deparse/Deparse.pm
commit b27dd1a8a91ec060119ea499731ff5d43e8e92ce
Author: Nicholas Clark <nick@ccl4.org>
Date: Tue Feb 28 23:09:02 2012 +0100
In B::Deparse, refactor common code into _features_from_bundle().
M dist/B-Deparse/Deparse.pm
commit fe445c4fdd855a69c8c7dc0b6c47958cc5dfb0cb
Author: Nicholas Clark <nick@ccl4.org>
Date: Tue Feb 28 22:57:31 2012 +0100
In B::Deparse, refactor the two places that feature::current_bundle()
Converge the code, so that it's easy to extract out into a subroutine.
M dist/B-Deparse/Deparse.pm
-----------------------------------------------------------------------
Summary of changes:
dist/B-Deparse/Deparse.pm | 44 ++++++++++++++++++++------------------------
1 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm
index de768d9..eb24214 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,7 +1449,13 @@ sub seq_subs {
return @text;
}
-my $feature_bundle_mask = 0x1c000000;
+sub _features_from_bundle {
+ my ($hints, $hh) = @_;
+ foreach (@{$feature::feature_bundle{@feature::hint_bundles[$hints >> $feature::hint_shift]}}) {
+ $hh->{$feature::feature{$_}} = 1;
+ }
+ return $hh;
+}
# Notice how subs and formats are inserted between statements here;
# also $[ assignments and pragmas.
@@ -1504,22 +1511,17 @@ 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'}};
}
else { $self->{'hinthash'} = {} }
- local $^H = $from;
- %{$self->{'hinthash'}} = (
- %{$self->{'hinthash'}},
- map +($feature::feature{$_} => 1),
- @{feature::current_bundle()},
- );
+ $self->{'hinthash'}
+ = _features_from_bundle($from, $self->{'hinthash'});
}
else {
my $bundle =
@@ -1593,7 +1595,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?
@@ -1624,7 +1626,6 @@ sub declare_hinthash {
}
my @ret;
if (@features || @unfeatures) {
- require feature;
if (!%rev_feature) { %rev_feature = reverse %feature::feature }
}
if (@features) {
@@ -1683,13 +1684,9 @@ 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) {
- require feature;
- local $^H = $self->{hints};
- # Shh! Keep quite about this function. It is not to be
- # relied upon.
- $hh = { map +($feature::feature{$_} => 1), @{feature::current_bundle()} };
+ my $hints = $self->{hints} & $feature::hint_mask;
+ if ($hints && $hints != $feature::hint_mask) {
+ $hh = _features_from_bundle($hints);
}
elsif ($hints) { $hh = $self->{'hinthash'} }
return "CORE::$name"
@@ -4546,11 +4543,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;
}
) {
--
Perl5 Master Repository
-
[perl.git] branch smoke-me/Deparse-feature-detangle, updated. v5.15.8-125-g3a56084
by Nicholas Clark