This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In B::Deparse, refactor the two places that feature::current_bundle()
authorNicholas Clark <nick@ccl4.org>
Tue, 28 Feb 2012 21:57:31 +0000 (22:57 +0100)
committerNicholas Clark <nick@ccl4.org>
Mon, 19 Mar 2012 09:21:54 +0000 (10:21 +0100)
Converge the code, so that it's easy to extract out into a subroutine.

dist/B-Deparse/Deparse.pm

index de768d9..c103270 100644 (file)
@@ -1515,11 +1515,9 @@ sub pp_nextstate {
                }
                else { $self->{'hinthash'} = {} }
                local $^H = $from;
-               %{$self->{'hinthash'}} = (
-                   %{$self->{'hinthash'}},
-                   map +($feature::feature{$_} => 1),
-                        @{feature::current_bundle()},
-               );
+               foreach (@{feature::current_bundle()}) {
+                   $self->{'hinthash'}{$feature::feature{$_}} = 1;
+               }
            }
            else {
                my $bundle =
@@ -1689,7 +1687,9 @@ sub keyword {
            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()} };
+           foreach (@{feature::current_bundle()}) {
+               $hh->{$feature::feature{$_}} = 1;
+           }
        }
        elsif ($hints) { $hh = $self->{'hinthash'} }
        return "CORE::$name"