diff options
author | Robin Houston <robin@cpan.org> | 2005-12-19 18:46:00 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-12-19 18:17:19 +0000 |
commit | 7b9ef14019d3c4d1aa14641dbd421c81c2cd18a4 (patch) | |
tree | 5069228d909a52c1423c3eb7067f78b74869b0ef /op.c | |
parent | 25ae1130f781118f78fbcd7bd13d6c8f4f21734a (diff) | |
download | perl-7b9ef14019d3c4d1aa14641dbd421c81c2cd18a4.tar.gz |
Re: [PATCH] Make the 'sort' pragma lexically scoped
Message-ID: <20051219174620.GA17940@rpc142.cs.man.ac.uk>
p4raw-id: //depot/perl@26402
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -6231,6 +6231,21 @@ Perl_ck_sort(pTHX_ OP *o) { OP *firstkid; + if (o->op_type == OP_SORT && (PL_hints & HINT_LOCALIZE_HH) != 0) + { + HV *hinthv = GvHV(PL_hintgv); + if (hinthv) { + SV **svp = hv_fetch(hinthv, "sort", 4, 0); + if (svp) { + I32 sorthints = (I32)SvIV(*svp); + if ((sorthints & HINT_SORT_QUICKSORT) != 0) + o->op_private |= OPpSORT_QSORT; + if ((sorthints & HINT_SORT_STABLE) != 0) + o->op_private |= OPpSORT_STABLE; + } + } + } + if (o->op_type == OP_SORT && o->op_flags & OPf_STACKED) simplify_sort(o); firstkid = cLISTOPo->op_first->op_sibling; /* get past pushmark */ |