U8 sbu_rflags;
U16 sbu_rxtainted;
I32 sbu_oldsaveix; /* same as blku_oldsaveix */
- /* all the fields above must be aligned with same-sized fields as blku * */
+ /* all the fields above must be aligned with same-sized fields as blk_u */
SSize_t sbu_iters;
SSize_t sbu_maxiters;
char * sbu_orig;
== (CXt_EVAL|CXp_REAL))
#define CxTRYBLOCK(c) (((c)->cx_type & (CXTYPEMASK|CXp_TRYBLOCK)) \
== (CXt_EVAL|CXp_TRYBLOCK))
-#define CxFOREACH(c) ( CxTYPE(cx) >= CXt_LOOP_LAZYSV \
+#define CxFOREACH(c) ( CxTYPE(cx) >= CXt_LOOP_LAZYIV \
&& CxTYPE(cx) <= CXt_LOOP_ARY)
#define CXINC (cxstack_ix < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc()))
use warnings;
no warnings 'experimental::smartmatch';
-plan tests => 189;
+plan tests => 193;
# The behaviour of the feature pragma should be tested by lib/feature.t
# using the tests in t/lib/feature/*. This file tests the behaviour of
f2();
}
+# check that 'when' handles all 'for' loop types
+
+{
+ my $i;
+
+ $i = 0;
+ for (1..3) {
+ when (1) {$i += 1 }
+ when (2) {$i += 10 }
+ when (3) {$i += 100 }
+ default { $i += 1000 }
+ }
+ is($i, 111, "when in for 1..3");
+
+ $i = 0;
+ for ('a'..'c') {
+ when ('a') {$i += 1 }
+ when ('b') {$i += 10 }
+ when ('c') {$i += 100 }
+ default { $i += 1000 }
+ }
+ is($i, 111, "when in for a..c");
+
+ $i = 0;
+ for (1,2,3) {
+ when (1) {$i += 1 }
+ when (2) {$i += 10 }
+ when (3) {$i += 100 }
+ default { $i += 1000 }
+ }
+ is($i, 111, "when in for 1,2,3");
+
+ $i = 0;
+ my @a = (1,2,3);
+ for (@a) {
+ when (1) {$i += 1 }
+ when (2) {$i += 10 }
+ when (3) {$i += 100 }
+ default { $i += 1000 }
+ }
+ is($i, 111, 'when in for @a');
+}
# Okay, that'll do for now. The intricacies of the smartmatch