diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-24 18:07:33 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-24 19:14:25 -0800 |
commit | dff5ffe48973403ad9fd15472a494ceb8a4df109 (patch) | |
tree | 013f13a906394f8aba211959708bc11a112cb616 /dist | |
parent | 36727b534b2c3bc6309920028fdbb8df5f8f8578 (diff) | |
download | perl-dff5ffe48973403ad9fd15472a494ceb8a4df109.tar.gz |
Deparse the /d flag with implicit features
Before the recent feature revamp (2fc860ee1e0), loading the
unicode_strings feature would always set the feature_unicode %^H ele-
ment, even though the core did not actually use it. Now it is some-
times not set. So we have to check the hint bits as well. Since
feature.pm has it hardcoded, load feature.pm to get the right bit.
The stuff with $feature_bundle_mask is redundant, but it avoids load-
ing feature.pm unnecessarily.
Diffstat (limited to 'dist')
-rw-r--r-- | dist/B-Deparse/Deparse.pm | 10 | ||||
-rw-r--r-- | dist/B-Deparse/t/deparse.t | 9 |
2 files changed, 18 insertions, 1 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm index 648a17c14a..27c6773cae 100644 --- a/dist/B-Deparse/Deparse.pm +++ b/dist/B-Deparse/Deparse.pm @@ -4537,7 +4537,15 @@ sub re_flags { # The /d flag is indicated by 0; only show it if necessary. elsif ($self->{hinthash} and $self->{hinthash}{reflags_charset} - || $self->{hinthash}{feature_unicode}) { + || $self->{hinthash}{feature_unicode} + or $self->{hints} & $feature_bundle_mask + && ($self->{hints} & $feature_bundle_mask) + != $feature_bundle_mask + && do { + require feature; + $self->{hints} & $feature::hint_uni8bit; + } + ) { $flags .= 'd'; } $flags; diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t index a7aaa3181d..b56978bfe4 100644 --- a/dist/B-Deparse/t/deparse.t +++ b/dist/B-Deparse/t/deparse.t @@ -801,6 +801,10 @@ print /a/u, s/b/c/u; use re "/u"; print /a/d, s/b/c/d; } +{ + use 5.012; + print /a/d, s/b/c/d; +} >>>> print /a/a, s/b/c/a; print /a/aa, s/b/c/aa; @@ -816,6 +820,11 @@ print /a/u, s/b/c/u; $^H{'reflags_charset'} = '2'; } print /a/d, s/b/c/d; } +{ + no feature; + use feature ':5.12'; + print /a/d, s/b/c/d; +} #### # Test @threadsv_names under 5005threads foreach $' (1, 2) { |