Followup to b9bc576fd0: deparse s///applaud
authorFather Chrysostomos <sprout@cpan.org>
Sat, 24 Dec 2011 06:15:15 +0000 (22:15 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 24 Dec 2011 06:15:15 +0000 (22:15 -0800)
dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/deparse.t

index 6829bce..5167c3a 100644 (file)
@@ -4600,6 +4600,18 @@ sub pp_subst {
     $flags .= "o" if $op->pmflags & PMf_KEEP;
     $flags .= "s" if $op->pmflags & PMf_SINGLELINE;
     $flags .= "x" if $extended;
+    $flags .= "p" if $op->pmflags & RXf_PMf_KEEPCOPY;
+    if (my $charset = $op->pmflags & RXf_PMf_CHARSET) {
+       # Hardcoding this is fragile, but B does not yet export the
+       # constants we need.
+       $flags .= qw(d l u a aa)[$charset >> 5]
+    }
+    # The /d flag is indicated by 0; only show it if necessary.
+    elsif ($self->{hinthash} and
+            $self->{hinthash}{reflags_charset}
+           || $self->{hinthash}{feature_unicode}) {
+       $flags .= 'd';
+    }
     $flags = $substwords{$flags} if $substwords{$flags};
     if ($binop) {
        return $self->maybe_parens("$var =~ s"
index a40e3f5..046d276 100644 (file)
@@ -760,33 +760,33 @@ my @s;
 print /$s[1]/;
 ####
 # [perl #91318] /regexp/applaud
-print /a/a;
-print /a/aa;
-print /a/p;
-print /a/l;
-print /a/u;
+print /a/a, s/b/c/a;
+print /a/aa, s/b/c/aa;
+print /a/p, s/b/c/p;
+print /a/l, s/b/c/l;
+print /a/u, s/b/c/u;
 {
     use feature "unicode_strings";
-    print /a/d;
+    print /a/d, s/b/c/d;
 }
 {
     use re "/u";
-    print /a/d;
+    print /a/d, s/b/c/d;
 }
 >>>>
-print /a/a;
-print /a/aa;
-print /a/p;
-print /a/l;
-print /a/u;
+print /a/a, s/b/c/a;
+print /a/aa, s/b/c/aa;
+print /a/p, s/b/c/p;
+print /a/l, s/b/c/l;
+print /a/u, s/b/c/u;
 {
     BEGIN { $^H{'feature_unicode'} = '1'; }
-    print /a/d;
+    print /a/d, s/b/c/d;
 }
 {
     BEGIN { $^H{'reflags_charset'} = '2';
            $^H{'reflags'}         = '0'; }
-    print /a/d;
+    print /a/d, s/b/c/d;
 }
 ####
 # Test @threadsv_names under 5005threads