diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-02-28 23:09:02 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-02-28 23:09:02 +0100 |
commit | 1fd9cf1d698de217573cd523a125c8b4ebd498d7 (patch) | |
tree | e4d073c9fcd2331d6a5c58fbfaa0056fb59772d9 | |
parent | 764455d648b5ba6c32ab47ed783865304d65a524 (diff) | |
download | perl-1fd9cf1d698de217573cd523a125c8b4ebd498d7.tar.gz |
In B::Deparse, refactor common code into _features_from_bundle().
-rw-r--r-- | dist/B-Deparse/Deparse.pm | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm index c1032705d8..72ad357455 100644 --- a/dist/B-Deparse/Deparse.pm +++ b/dist/B-Deparse/Deparse.pm @@ -1450,6 +1450,18 @@ sub seq_subs { 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. + foreach (@{feature::current_bundle()}) { + $hh->{$feature::feature{$_}} = 1; + } + return $hh; +} + # Notice how subs and formats are inserted between statements here; # also $[ assignments and pragmas. sub pp_nextstate { @@ -1514,10 +1526,8 @@ sub pp_nextstate { for grep /^feature_/, keys %{$self->{'hinthash'}}; } else { $self->{'hinthash'} = {} } - local $^H = $from; - foreach (@{feature::current_bundle()}) { - $self->{'hinthash'}{$feature::feature{$_}} = 1; - } + $self->{'hinthash'} + = _features_from_bundle($from, $self->{'hinthash'}); } else { my $bundle = @@ -1683,13 +1693,7 @@ sub keyword { 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. - foreach (@{feature::current_bundle()}) { - $hh->{$feature::feature{$_}} = 1; - } + $hh = _features_from_bundle($self->{hints}); } elsif ($hints) { $hh = $self->{'hinthash'} } return "CORE::$name" |