diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2004-02-20 15:34:27 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-02-20 15:34:27 +0000 |
commit | 2b6e98cb0bc81ffc31a6d3baf33465260376f405 (patch) | |
tree | c481e57162cae3bd7b2132b8a09b9cb2bfde467b /ext/B | |
parent | fe1bc4cf71e7b04d33e679798964a090d9fa7b46 (diff) | |
download | perl-2b6e98cb0bc81ffc31a6d3baf33465260376f405.tar.gz |
add Deparse/Concise support for inplace sort (change 22349)
p4raw-id: //depot/perl@22350
Diffstat (limited to 'ext/B')
-rw-r--r-- | ext/B/B/Concise.pm | 2 | ||||
-rw-r--r-- | ext/B/B/Deparse.pm | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 2b8a612b67..5c5fd5d2ce 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -416,7 +416,7 @@ $priv{"exists"}{64} = "SUB"; $priv{$_}{64} = "LOCALE" for ("sort", "prtf", "sprintf", "slt", "sle", "seq", "sne", "sgt", "sge", "scmp", "lc", "uc", "lcfirst", "ucfirst"); -@{$priv{"sort"}}{1,2,4} = ("NUM", "INT", "REV"); +@{$priv{"sort"}}{1,2,4,8} = ("NUM", "INT", "REV", "INPLACE"); $priv{"threadsv"}{64} = "SVREFd"; @{$priv{$_}}{16,32,64,128} = ("INBIN","INCR","OUTBIN","OUTCR") for ("open", "backtick"); diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 21a33799be..65f314db6d 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -14,7 +14,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring OPpLVAL_INTRO OPpOUR_INTRO OPpENTERSUB_AMPER OPpSLICE OPpCONST_BARE OPpTRANS_SQUASH OPpTRANS_DELETE OPpTRANS_COMPLEMENT OPpTARGET_MY OPpCONST_ARYBASE OPpEXISTS_SUB OPpSORT_NUMERIC OPpSORT_INTEGER - OPpSORT_REVERSE + OPpSORT_REVERSE OPpSORT_INPLACE SVf_IOK SVf_NOK SVf_ROK SVf_POK SVpad_OUR SVf_FAKE SVs_RMG SVs_SMG CVf_METHOD CVf_LOCKED CVf_LVALUE CVf_ASSERTION PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_SKIPWHITE @@ -2311,6 +2311,10 @@ sub indirop { $expr = $self->deparse($kid, 6); push @exprs, $expr; } + if ($name eq "sort" && ($op->private & OPpSORT_INPLACE)) { + return "$exprs[0] = sort $indir $exprs[0]"; + } + my $args = $indir . join(", ", @exprs); if ($indir ne "" and $name eq "sort") { # We don't want to say "sort(f 1, 2, 3)", since perl -w will |