Fix regression in deparsing say (etc) under use 5.10.0
authorNicholas Clark <nick@ccl4.org>
Tue, 28 Feb 2012 16:32:08 +0000 (17:32 +0100)
committerNicholas Clark <nick@ccl4.org>
Mon, 19 Mar 2012 09:21:54 +0000 (10:21 +0100)
Commit 6634bb9d0ed117be introduced a regression, causing this

    use 5.10.0;
    say "Perl rules";

to be deparsed as C<CORE::say>, not C<say>, etc. It wasn't actually possible
to write tests for this within the t/deparse.t framework until the recent
refactoring.

dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/deparse.t

index 054b919..de768d9 100644 (file)
@@ -20,7 +20,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring
          CVf_METHOD CVf_LVALUE
         PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE
         PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED);
-$VERSION = "1.12";
+$VERSION = '1.13';
 use strict;
 use vars qw/$AUTOLOAD/;
 use warnings ();
@@ -1689,7 +1689,7 @@ sub keyword {
            local $^H = $self->{hints};
            # Shh! Keep quite about this function.  It is not to be
            # relied upon.
-           $hh = { map +($_ => 1), feature::current_bundle() };
+           $hh = { map +($feature::feature{$_} => 1), @{feature::current_bundle()} };
        }
        elsif ($hints) { $hh = $self->{'hinthash'} }
        return "CORE::$name"
index 1861fd2..0fa3cbf 100644 (file)
@@ -458,13 +458,11 @@ foo { @bar } 1 xor foo();
 say 'foo';
 ####
 # SKIP ?$] < 5.010 && "say not implemented on this Perl version"
-# TODO B::Deparse outputs CORE::say
 # CONTEXT use 5.10.0;
 # say in the context of use 5.10.0
 say 'foo';
 ####
 # SKIP ?$] < 5.010 && "say not implemented on this Perl version"
-# TODO B::Deparse outputs CORE::say
 # say with use 5.10.0
 use 5.10.0;
 say 'foo';
@@ -482,7 +480,6 @@ use feature 'say', 'state', 'switch';
 say 'foo';
 ####
 # SKIP ?$] < 5.010 && "say not implemented on this Perl version"
-# TODO B::Deparse outputs CORE::say
 # CONTEXT use feature ':5.10';
 # say with use 5.10.0 in the context of use feature
 use 5.10.0;
@@ -506,13 +503,11 @@ say 'foo';
 __SUB__;
 ####
 # SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
-# TODO B::Deparse outputs CORE::__SUB__
 # CONTEXT use 5.15.0;
 # __SUB__ in the context of use 5.15.0
 __SUB__;
 ####
 # SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
-# TODO B::Deparse outputs CORE::__SUB__
 # __SUB__ with use 5.15.0
 use 5.15.0;
 __SUB__;
@@ -530,7 +525,6 @@ use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode
 __SUB__;
 ####
 # SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
-# TODO B::Deparse outputs CORE::__SUB__
 # CONTEXT use feature ':5.15';
 # __SUB__ with use 5.15.0 in the context of use feature
 use 5.15.0;