This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In B::Deparse, refactor common code into _features_from_bundle().
[perl5.git] / dist / B-Deparse / Deparse.pm
index c103270..72ad357 100644 (file)
@@ -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"