Re: Optree Generation
[p5sagit/p5-mst-13.2.git] / ext / B / B / Concise.pm
index 20c443d..d24f857 100644 (file)
@@ -627,7 +627,7 @@ sub private_flags {
 }
 
 sub concise_sv {
-    my($sv, $hr) = @_;
+    my($sv, $hr, $preferpv) = @_;
     $hr->{svclass} = class($sv);
     $hr->{svclass} = "UV"
       if $hr->{svclass} eq "IV" and $sv->FLAGS & SVf_IVisUV;
@@ -650,6 +650,8 @@ sub concise_sv {
        }
        if (class($sv) eq "SPECIAL") {
            $hr->{svval} .= ["Null", "sv_undef", "sv_yes", "sv_no"]->[$$sv];
+       } elsif ($preferpv && $sv->FLAGS & SVf_POK) {
+           $hr->{svval} .= cstring($sv->PV);
        } elsif ($sv->FLAGS & SVf_NOK) {
            $hr->{svval} .= $sv->NV;
        } elsif ($sv->FLAGS & SVf_IOK) {
@@ -764,12 +766,13 @@ sub concise_op {
     elsif ($h{class} eq "SVOP" or $h{class} eq "PADOP") {
        unless ($h{name} eq 'aelemfast' and $op->flags & OPf_SPECIAL) {
            my $idx = ($h{class} eq "SVOP") ? $op->targ : $op->padix;
+           my $preferpv = $h{name} eq "method_named";
            if ($h{class} eq "PADOP" or !${$op->sv}) {
                my $sv = (($curcv->PADLIST->ARRAY)[1]->ARRAY)[$idx];
-               $h{arg} = "[" . concise_sv($sv, \%h) . "]";
+               $h{arg} = "[" . concise_sv($sv, \%h, $preferpv) . "]";
                $h{targarglife} = $h{targarg} = "";
            } else {
-               $h{arg} = "(" . concise_sv($op->sv, \%h) . ")";
+               $h{arg} = "(" . concise_sv($op->sv, \%h, $preferpv) . ")";
            }
        }
     }