6 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
7 print "1..0 # Skip -- Perl configured without B module\n";
10 if (!$Config::Config{useperlio}) {
11 print "1..0 # Skip -- need perlio to walk the optree\n";
20 Code test snippets here are adapted from `perldoc -f map`
22 Due to a bleadperl optimization (Dave Mitchell, circa apr 04), the
23 (map|grep)(start|while) opcodes have different flags in 5.9, their
24 private flags /1, /2 are gone in blead (for the cases covered)
26 When the optree stuff was integrated into 5.8.6, these tests failed,
27 and were todo'd. They're now done, by version-specific tweaking in
28 mkCheckRex(), therefore the skip is removed too.
33 #examples poached from perldoc -f sort
35 NOTE: name is no longer a required arg for checkOptree, as label is
36 synthesized out of others. HOWEVER, if the test-code has newlines in
37 it, the label must be overridden by an explicit name.
39 This is because t/TEST is quite particular about the test output it
40 processes, and multi-line labels violate its 1-line-per-test
45 # chunk: # sort lexically
46 @articles = sort @files;
50 checkOptree(note => q{},
52 code => q{@articles = sort @files; },
53 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
54 # 1 <;> nextstate(main 545 (eval 15):1) v
58 # 5 <1> rv2av[t4] lK/1
61 # 8 <#> gv[*articles] s
62 # 9 <1> rv2av[t2] lKRM*/1
63 # a <2> aassign[t5] KS/COM_AGG
64 # b <1> leavesub[1 ref] K/REFC,1
66 # 1 <;> nextstate(main 545 (eval 15):1) v
70 # 5 <1> rv2av[t2] lK/1
73 # 8 <$> gv(*articles) s
74 # 9 <1> rv2av[t1] lKRM*/1
75 # a <2> aassign[t3] KS/COM_AGG
76 # b <1> leavesub[1 ref] K/REFC,1
82 # chunk: # same thing, but with explicit sort routine
83 @articles = sort {$a cmp $b} @files;
87 checkOptree(note => q{},
89 code => q{@articles = sort {$a cmp $b} @files; },
90 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
91 # 1 <;> nextstate(main 546 (eval 15):1) v
95 # 5 <1> rv2av[t7] lK/1
98 # 8 <#> gv[*articles] s
99 # 9 <1> rv2av[t2] lKRM*/1
100 # a <2> aassign[t3] KS/COM_AGG
101 # b <1> leavesub[1 ref] K/REFC,1
103 # 1 <;> nextstate(main 546 (eval 15):1) v
107 # 5 <1> rv2av[t3] lK/1
110 # 8 <$> gv(*articles) s
111 # 9 <1> rv2av[t1] lKRM*/1
112 # a <2> aassign[t2] KS/COM_AGG
113 # b <1> leavesub[1 ref] K/REFC,1
119 # chunk: # now case-insensitively
120 @articles = sort {uc($a) cmp uc($b)} @files;
124 checkOptree(note => q{},
126 code => q{@articles = sort {uc($a) cmp uc($b)} @files; },
127 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
128 # 1 <;> nextstate(main 546 (eval 15):1) v
132 # 5 <1> rv2av[t9] lK/1 < 5.019002
133 # 5 <1> rv2av[t9] lKM/1 >=5.019002
136 # 8 <#> gv[*articles] s
137 # 9 <1> rv2av[t2] lKRM*/1
138 # a <2> aassign[t10] KS/COM_AGG
139 # b <1> leavesub[1 ref] K/REFC,1
141 # 1 <;> nextstate(main 546 (eval 15):1) v
145 # 5 <1> rv2av[t5] lK/1 < 5.019002
146 # 5 <1> rv2av[t5] lKM/1 >=5.019002
149 # 8 <$> gv(*articles) s
150 # 9 <1> rv2av[t1] lKRM*/1
151 # a <2> aassign[t6] KS/COM_AGG
152 # b <1> leavesub[1 ref] K/REFC,1
158 # chunk: # same thing in reversed order
159 @articles = sort {$b cmp $a} @files;
163 checkOptree(note => q{},
165 code => q{@articles = sort {$b cmp $a} @files; },
166 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
167 # 1 <;> nextstate(main 546 (eval 15):1) v
171 # 5 <1> rv2av[t7] lK/1
174 # 8 <#> gv[*articles] s
175 # 9 <1> rv2av[t2] lKRM*/1
176 # a <2> aassign[t3] KS/COM_AGG
177 # b <1> leavesub[1 ref] K/REFC,1
179 # 1 <;> nextstate(main 546 (eval 15):1) v
183 # 5 <1> rv2av[t3] lK/1
186 # 8 <$> gv(*articles) s
187 # 9 <1> rv2av[t1] lKRM*/1
188 # a <2> aassign[t2] KS/COM_AGG
189 # b <1> leavesub[1 ref] K/REFC,1
195 # chunk: # sort numerically ascending
196 @articles = sort {$a <=> $b} @files;
200 checkOptree(note => q{},
202 code => q{@articles = sort {$a <=> $b} @files; },
203 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
204 # 1 <;> nextstate(main 546 (eval 15):1) v
208 # 5 <1> rv2av[t7] lK/1
211 # 8 <#> gv[*articles] s
212 # 9 <1> rv2av[t2] lKRM*/1
213 # a <2> aassign[t3] KS/COM_AGG
214 # b <1> leavesub[1 ref] K/REFC,1
216 # 1 <;> nextstate(main 546 (eval 15):1) v
220 # 5 <1> rv2av[t3] lK/1
223 # 8 <$> gv(*articles) s
224 # 9 <1> rv2av[t1] lKRM*/1
225 # a <2> aassign[t2] KS/COM_AGG
226 # b <1> leavesub[1 ref] K/REFC,1
232 # chunk: # sort numerically descending
233 @articles = sort {$b <=> $a} @files;
237 checkOptree(note => q{},
239 code => q{@articles = sort {$b <=> $a} @files; },
240 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
241 # 1 <;> nextstate(main 587 (eval 26):1) v
245 # 5 <1> rv2av[t7] lK/1
246 # 6 <@> sort lK/DESC,NUM
248 # 8 <#> gv[*articles] s
249 # 9 <1> rv2av[t2] lKRM*/1
250 # a <2> aassign[t3] KS/COM_AGG
251 # b <1> leavesub[1 ref] K/REFC,1
253 # 1 <;> nextstate(main 546 (eval 15):1) v
257 # 5 <1> rv2av[t3] lK/1
258 # 6 <@> sort lK/DESC,NUM
260 # 8 <$> gv(*articles) s
261 # 9 <1> rv2av[t1] lKRM*/1
262 # a <2> aassign[t2] KS/COM_AGG
263 # b <1> leavesub[1 ref] K/REFC,1
269 # chunk: # this sorts the %age hash by value instead of key
270 # using an in-line function
271 @eldest = sort { $age{$b} <=> $age{$a} } keys %age;
275 checkOptree(note => q{},
277 code => q{@eldest = sort { $age{$b} <=> $age{$a} } keys %age; },
278 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
279 # 1 <;> nextstate(main 592 (eval 28):1) v
283 # 5 <1> rv2hv[t9] lKRM
284 # 6 <1> keys[t10] lK/1 < 5.019002
285 # 6 <1> keys[t10] lKM/1 >=5.019002
288 # 9 <#> gv[*eldest] s
289 # a <1> rv2av[t2] lKRM*/1
290 # b <2> aassign[t11] KS/COM_AGG
291 # c <1> leavesub[1 ref] K/REFC,1
293 # 1 <;> nextstate(main 546 (eval 15):1) v
297 # 5 <1> rv2hv[t3] lKRM
298 # 6 <1> keys[t4] lK/1 < 5.019002
299 # 6 <1> keys[t4] lKM/1 >=5.019002
302 # 9 <$> gv(*eldest) s
303 # a <1> rv2av[t1] lKRM*/1
304 # b <2> aassign[t5] KS/COM_AGG
305 # c <1> leavesub[1 ref] K/REFC,1
311 # chunk: # sort using explicit subroutine name
313 $age{$a} <=> $age{$b}; # presuming numeric
315 @sortedclass = sort byage @class;
319 checkOptree(note => q{},
321 code => q{sub byage { $age{$a} <=> $age{$b}; } @sortedclass = sort byage @class; },
322 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
323 # 1 <;> nextstate(main 597 (eval 30):1) v
326 # 4 <$> const[PV "byage"] s/BARE
328 # 6 <1> rv2av[t4] lK/1 < 5.019002
329 # 6 <1> rv2av[t4] lKM/1 >=5.019002
332 # 9 <#> gv[*sortedclass] s
333 # a <1> rv2av[t2] lKRM*/1
334 # b <2> aassign[t5] KS/COM_AGG
335 # c <1> leavesub[1 ref] K/REFC,1
337 # 1 <;> nextstate(main 546 (eval 15):1) v
340 # 4 <$> const(PV "byage") s/BARE
342 # 6 <1> rv2av[t2] lK/1 < 5.019002
343 # 6 <1> rv2av[t2] lKM/1 >=5.019002
346 # 9 <$> gv(*sortedclass) s
347 # a <1> rv2av[t1] lKRM*/1
348 # b <2> aassign[t3] KS/COM_AGG
349 # c <1> leavesub[1 ref] K/REFC,1
355 # chunk: sub backwards { $b cmp $a }
356 @harry = qw(dog cat x Cain Abel);
357 @george = qw(gone chased yz Punished Axed);
359 # prints AbelCaincatdogx
360 print sort backwards @harry;
361 # prints xdogcatCainAbel
362 print sort @george, 'to', @harry;
363 # prints AbelAxedCainPunishedcatchaseddoggonetoxyz
367 checkOptree(name => q{sort USERSUB LIST },
369 code => q{sub backwards { $b cmp $a }
370 @harry = qw(dog cat x Cain Abel);
371 @george = qw(gone chased yz Punished Axed);
372 print sort @harry; print sort backwards @harry;
373 print sort @george, 'to', @harry; },
374 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
375 # 1 <;> nextstate(main 602 (eval 32):2) v
377 # 3 <$> const[PV "dog"] s
378 # 4 <$> const[PV "cat"] s
379 # 5 <$> const[PV "x"] s
380 # 6 <$> const[PV "Cain"] s
381 # 7 <$> const[PV "Abel"] s
384 # a <1> rv2av[t2] lKRM*/1
385 # b <2> aassign[t3] vKS
386 # c <;> nextstate(main 602 (eval 32):3) v
388 # e <$> const[PV "gone"] s
389 # f <$> const[PV "chased"] s
390 # g <$> const[PV "yz"] s
391 # h <$> const[PV "Punished"] s
392 # i <$> const[PV "Axed"] s
394 # k <#> gv[*george] s
395 # l <1> rv2av[t5] lKRM*/1
396 # m <2> aassign[t6] vKS
397 # n <;> nextstate(main 602 (eval 32):4) v:{
401 # r <1> rv2av[t8] lK/1
404 # u <;> nextstate(main 602 (eval 32):4) v:{
407 # x <$> const[PV "backwards"] s/BARE
409 # z <1> rv2av[t10] lK/1 < 5.019002
410 # z <1> rv2av[t10] lKM/1 >=5.019002
413 # 12 <;> nextstate(main 602 (eval 32):5) v:{
416 # 15 <#> gv[*george] s
417 # 16 <1> rv2av[t12] lK/1
418 # 17 <$> const[PV "to"] s
419 # 18 <#> gv[*harry] s
420 # 19 <1> rv2av[t14] lK/1
423 # 1c <1> leavesub[1 ref] K/REFC,1
425 # 1 <;> nextstate(main 602 (eval 32):2) v
427 # 3 <$> const(PV "dog") s
428 # 4 <$> const(PV "cat") s
429 # 5 <$> const(PV "x") s
430 # 6 <$> const(PV "Cain") s
431 # 7 <$> const(PV "Abel") s
434 # a <1> rv2av[t1] lKRM*/1
435 # b <2> aassign[t2] vKS
436 # c <;> nextstate(main 602 (eval 32):3) v
438 # e <$> const(PV "gone") s
439 # f <$> const(PV "chased") s
440 # g <$> const(PV "yz") s
441 # h <$> const(PV "Punished") s
442 # i <$> const(PV "Axed") s
444 # k <$> gv(*george) s
445 # l <1> rv2av[t3] lKRM*/1
446 # m <2> aassign[t4] vKS
447 # n <;> nextstate(main 602 (eval 32):4) v:{
451 # r <1> rv2av[t5] lK/1
454 # u <;> nextstate(main 602 (eval 32):4) v:{
457 # x <$> const(PV "backwards") s/BARE
459 # z <1> rv2av[t6] lK/1 < 5.019002
460 # z <1> rv2av[t6] lKM/1 >=5.019002
463 # 12 <;> nextstate(main 602 (eval 32):5) v:{
466 # 15 <$> gv(*george) s
467 # 16 <1> rv2av[t7] lK/1
468 # 17 <$> const(PV "to") s
469 # 18 <$> gv(*harry) s
470 # 19 <1> rv2av[t8] lK/1
473 # 1c <1> leavesub[1 ref] K/REFC,1
479 # chunk: # inefficiently sort by descending numeric compare using
480 # the first integer after the first = sign, or the
481 # whole record case-insensitively otherwise
483 $nums[$b] <=> $nums[$a]
484 || $caps[$a] cmp $caps[$b]
490 # chunk: # same thing, but without any temps
491 @new = map { $_->[0] }
492 sort { $b->[1] <=> $a->[1]
493 || $a->[2] cmp $b->[2]
494 } map { [$_, /=(\d+)/, uc($_)] } @old;
498 checkOptree(name => q{Compound sort/map Expression },
500 code => q{ @new = map { $_->[0] }
501 sort { $b->[1] <=> $a->[1] || $a->[2] cmp $b->[2] }
502 map { [$_, /=(\d+)/, uc($_)] } @old; },
503 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
504 # 1 <;> nextstate(main 609 (eval 34):3) v:{
510 # 7 <1> rv2av[t19] lKM/1
512 # 9 <|> mapwhile(other->a)[t20] lKM
514 # b <;> nextstate(main 608 (eval 34):2) v:{
517 # e </> match(/"=(\\d+)"/) l
520 # h <@> anonlist sK*/1
525 # l <|> mapwhile(other->m)[t26] lK
526 # m <+> multideref($_->[0]) sK
530 # p <1> rv2av[t2] lKRM*/1
531 # q <2> aassign[t22] KS/COM_AGG
532 # r <1> leavesub[1 ref] K/REFC,1
534 # 1 <;> nextstate(main 609 (eval 34):3) v:{
540 # 7 <1> rv2av[t10] lKM/1
542 # 9 <|> mapwhile(other->a)[t11] lKM
544 # b <;> nextstate(main 608 (eval 34):2) v:{
547 # e </> match(/"=(\\d+)"/) l
550 # h <@> anonlist sK*/1
555 # l <|> mapwhile(other->m)[t12] lK
556 # m <+> multideref($_->[0]) sK
560 # p <1> rv2av[t1] lKRM*/1
561 # q <2> aassign[t13] KS/COM_AGG
562 # r <1> leavesub[1 ref] K/REFC,1
568 # chunk: # using a prototype allows you to use any comparison subroutine
569 # as a sort subroutine (including other package's subroutines)
571 sub backwards ($$) { $_[1] cmp $_[0]; } # $a and $b are not set here
573 @new = sort other::backwards @old;
577 checkOptree(name => q{sort other::sub LIST },
579 code => q{package other; sub backwards ($$) { $_[1] cmp $_[0]; }
580 package main; @new = sort other::backwards @old; },
581 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
582 # 1 <;> nextstate(main 614 (eval 36):2) v:{
585 # 4 <$> const[PV "other::backwards"] s/BARE
587 # 6 <1> rv2av[t4] lK/1 < 5.019002
588 # 6 <1> rv2av[t4] lKM/1 >=5.019002
592 # a <1> rv2av[t2] lKRM*/1
593 # b <2> aassign[t5] KS/COM_AGG
594 # c <1> leavesub[1 ref] K/REFC,1
596 # 1 <;> nextstate(main 614 (eval 36):2) v:{
599 # 4 <$> const(PV "other::backwards") s/BARE
601 # 6 <1> rv2av[t2] lK/1 < 5.019002
602 # 6 <1> rv2av[t2] lKM/1 >=5.019002
606 # a <1> rv2av[t1] lKRM*/1
607 # b <2> aassign[t3] KS/COM_AGG
608 # c <1> leavesub[1 ref] K/REFC,1
614 # chunk: # repeat, condensed. $main::a and $b are unaffected
615 sub other::backwards ($$) { $_[1] cmp $_[0]; }
616 @new = sort other::backwards @old;
620 checkOptree(note => q{},
622 code => q{sub other::backwards ($$) { $_[1] cmp $_[0]; } @new = sort other::backwards @old; },
623 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
624 # 1 <;> nextstate(main 619 (eval 38):1) v
627 # 4 <$> const[PV "other::backwards"] s/BARE
629 # 6 <1> rv2av[t4] lK/1 < 5.019002
630 # 6 <1> rv2av[t4] lKM/1 >=5.019002
634 # a <1> rv2av[t2] lKRM*/1
635 # b <2> aassign[t5] KS/COM_AGG
636 # c <1> leavesub[1 ref] K/REFC,1
638 # 1 <;> nextstate(main 546 (eval 15):1) v
641 # 4 <$> const(PV "other::backwards") s/BARE
643 # 6 <1> rv2av[t2] lK/1 < 5.019002
644 # 6 <1> rv2av[t2] lKM/1 >=5.019002
648 # a <1> rv2av[t1] lKRM*/1
649 # b <2> aassign[t3] KS/COM_AGG
650 # c <1> leavesub[1 ref] K/REFC,1
656 # chunk: # guarantee stability, regardless of algorithm
658 @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
662 my ($expect, $expect_nt) = (<<'EOT_EOT', <<'EONT_EONT');
663 # 1 <;> nextstate(main 656 (eval 40):1) v:%,{
667 # 5 <1> rv2av[t9] lK/1 < 5.019002
668 # 5 <1> rv2av[t9] lKM/1 >=5.019002
669 # 6 <@> sort lKS*/STABLE
672 # 9 <1> rv2av[t2] lKRM*/1
673 # a <2> aassign[t14] KS/COM_AGG
674 # b <1> leavesub[1 ref] K/REFC,1
676 # 1 <;> nextstate(main 578 (eval 15):1) v:%,{
680 # 5 <1> rv2av[t5] lK/1 < 5.019002
681 # 5 <1> rv2av[t5] lKM/1 >=5.019002
682 # 6 <@> sort lKS*/STABLE
685 # 9 <1> rv2av[t1] lKRM*/1
686 # a <2> aassign[t6] KS/COM_AGG
687 # b <1> leavesub[1 ref] K/REFC,1
691 checkOptree(note => q{},
693 code => q{use sort 'stable'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; },
694 expect => $expect, expect_nt => $expect_nt);
698 # chunk: # force use of mergesort (not portable outside Perl 5.8)
699 use sort '_mergesort';
700 @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
704 checkOptree(note => q{},
706 code => q{use sort '_mergesort'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; },
707 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
708 # 1 <;> nextstate(main 662 (eval 42):1) v:%,{
712 # 5 <1> rv2av[t9] lK/1 < 5.019002
713 # 5 <1> rv2av[t9] lKM/1 >=5.019002
717 # 9 <1> rv2av[t2] lKRM*/1
718 # a <2> aassign[t14] KS/COM_AGG
719 # b <1> leavesub[1 ref] K/REFC,1
721 # 1 <;> nextstate(main 578 (eval 15):1) v:%,{
725 # 5 <1> rv2av[t5] lK/1 < 5.019002
726 # 5 <1> rv2av[t5] lKM/1 >=5.019002
730 # 9 <1> rv2av[t1] lKRM*/1
731 # a <2> aassign[t6] KS/COM_AGG
732 # b <1> leavesub[1 ref] K/REFC,1
738 # chunk: # you should have a good reason to do this!
739 @articles = sort {$FooPack::b <=> $FooPack::a} @files;
743 checkOptree(note => q{},
745 code => q{@articles = sort {$FooPack::b <=> $FooPack::a} @files; },
746 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
747 # 1 <;> nextstate(main 667 (eval 44):1) v
751 # 5 <1> rv2av[t7] lK/1 < 5.019002
752 # 5 <1> rv2av[t7] lKM/1 >=5.019002
755 # 8 <#> gv[*articles] s
756 # 9 <1> rv2av[t2] lKRM*/1
757 # a <2> aassign[t8] KS/COM_AGG
758 # b <1> leavesub[1 ref] K/REFC,1
760 # 1 <;> nextstate(main 546 (eval 15):1) v
764 # 5 <1> rv2av[t3] lK/1 < 5.019002
765 # 5 <1> rv2av[t3] lKM/1 >=5.019002
768 # 8 <$> gv(*articles) s
769 # 9 <1> rv2av[t1] lKRM*/1
770 # a <2> aassign[t4] KS/COM_AGG
771 # b <1> leavesub[1 ref] K/REFC,1
778 @result = sort { $a <=> $b } grep { $_ == $_ } @input;
782 checkOptree(note => q{},
784 code => q{@result = sort { $a <=> $b } grep { $_ == $_ } @input; },
785 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
786 # 1 <;> nextstate(main 673 (eval 46):1) v
791 # 6 <1> rv2av[t9] lKM/1
792 # 7 <@> grepstart lK* < 5.017002
793 # 7 <@> grepstart lK >=5.017002
794 # 8 <|> grepwhile(other->9)[t10] lK
798 # - <@> scope sK < 5.017002
802 # e <#> gv[*result] s
803 # f <1> rv2av[t2] lKRM*/1
804 # g <2> aassign[t3] KS/COM_AGG
805 # h <1> leavesub[1 ref] K/REFC,1
807 # 1 <;> nextstate(main 547 (eval 15):1) v
812 # 6 <1> rv2av[t3] lKM/1
813 # 7 <@> grepstart lK* < 5.017002
814 # 7 <@> grepstart lK >=5.017002
815 # 8 <|> grepwhile(other->9)[t4] lK
819 # - <@> scope sK < 5.017002
823 # e <$> gv(*result) s
824 # f <1> rv2av[t1] lKRM*/1
825 # g <2> aassign[t2] KS/COM_AGG
826 # h <1> leavesub[1 ref] K/REFC,1
832 # chunk: # void return context sort
833 sort { $a <=> $b } @input;
837 checkOptree(note => q{},
839 code => q{sort { $a <=> $b } @input; },
840 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
841 # 1 <;> nextstate(main 678 (eval 48):1) v
844 # 4 <1> rv2av[t5] lK/1
846 # 6 <1> leavesub[1 ref] K/REFC,1
848 # 1 <;> nextstate(main 546 (eval 15):1) v
851 # 4 <1> rv2av[t2] lK/1
853 # 6 <1> leavesub[1 ref] K/REFC,1
859 # chunk: # more void context, propagating ?
860 sort { $a <=> $b } grep { $_ == $_ } @input;
864 checkOptree(note => q{},
866 code => q{sort { $a <=> $b } grep { $_ == $_ } @input; },
867 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
868 # 1 <;> nextstate(main 684 (eval 50):1) v
872 # 5 <1> rv2av[t7] lKM/1
873 # 6 <@> grepstart lK* < 5.017002
874 # 6 <@> grepstart lK >=5.017002
875 # 7 <|> grepwhile(other->8)[t8] lK
879 # - <@> scope sK < 5.017002
882 # c <1> leavesub[1 ref] K/REFC,1
884 # 1 <;> nextstate(main 547 (eval 15):1) v
888 # 5 <1> rv2av[t2] lKM/1
889 # 6 <@> grepstart lK* < 5.017002
890 # 6 <@> grepstart lK >=5.017002
891 # 7 <|> grepwhile(other->8)[t3] lK
895 # - <@> scope sK < 5.017002
898 # c <1> leavesub[1 ref] K/REFC,1
904 # chunk: # scalar return context sort
905 $s = sort { $a <=> $b } @input;
909 checkOptree(note => q{},
911 code => q{$s = sort { $a <=> $b } @input; },
912 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
913 # 1 <;> nextstate(main 689 (eval 52):1) v:{
916 # 4 <1> rv2av[t6] lK/1
919 # 7 <2> sassign sKS/2
920 # 8 <1> leavesub[1 ref] K/REFC,1
922 # 1 <;> nextstate(main 546 (eval 15):1) v:{
925 # 4 <1> rv2av[t2] lK/1
928 # 7 <2> sassign sKS/2
929 # 8 <1> leavesub[1 ref] K/REFC,1
935 # chunk: $s = sort { $a <=> $b } grep { $_ == $_ } @input;
939 checkOptree(note => q{},
941 code => q{$s = sort { $a <=> $b } grep { $_ == $_ } @input; },
942 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
943 # 1 <;> nextstate(main 695 (eval 54):1) v:{
947 # 5 <1> rv2av[t8] lKM/1
948 # 6 <@> grepstart lK* < 5.017002
949 # 6 <@> grepstart lK >=5.017002
950 # 7 <|> grepwhile(other->8)[t9] lK
954 # - <@> scope sK < 5.017002
958 # d <2> sassign sKS/2
959 # e <1> leavesub[1 ref] K/REFC,1
961 # 1 <;> nextstate(main 547 (eval 15):1) v:{
965 # 5 <1> rv2av[t2] lKM/1
966 # 6 <@> grepstart lK* < 5.017002
967 # 6 <@> grepstart lK >=5.017002
968 # 7 <|> grepwhile(other->8)[t3] lK
972 # - <@> scope sK < 5.017002
976 # d <2> sassign sKS/2
977 # e <1> leavesub[1 ref] K/REFC,1