File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -307,12 +307,19 @@ enum {
307
307
ds = 0 ;
308
308
while (index < SERIES_TAIL (block )) {
309
309
index = Do_Next (block , index , 0 ); // stack volatile
310
+ // ignore unset result
311
+ if (IS_UNSET (DS_TOP )) {
312
+ DS_DROP ;
313
+ continue ;
314
+ }
310
315
ds = DS_POP ; // volatile stack reference
311
316
if (IS_FALSE (ds )) return R_NONE ;
317
+ // store the value as a potencial result
318
+ DS_RET_VALUE (ds );
319
+ // stop precessing if the value was thrown
312
320
if (THROWN (ds )) break ;
313
321
}
314
- if (ds == 0 ) return R_TRUE ;
315
- return R_TOS1 ;
322
+ return R_RET ;
316
323
}
317
324
318
325
@@ -328,6 +335,7 @@ enum {
328
335
while (index < SERIES_TAIL (block )) {
329
336
index = Do_Next (block , index , 0 ); // stack volatile
330
337
ds = DS_POP ; // volatile stack reference
338
+ if (IS_UNSET (ds )) continue ; // ignore unset result
331
339
if (!IS_FALSE (ds )) return R_TOS1 ;
332
340
}
333
341
return R_NONE ;
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ Rebol [
10
10
11
11
===start-group=== "Dealing with unset! value in conditions"
12
12
--test-- "any"
13
- --assert unset? any [() 2 ]
13
+ --assert 2 = any [() 2 ]
14
14
--assert true? any [() 2 ]
15
15
--test-- "all"
16
16
--assert true? all []
17
17
--assert true? all [()]
18
18
--assert 3 = all [() 1 2 3 ]
19
- --assert unset? all [1 ()]
19
+ --assert 1 = all [1 ()]
20
20
--assert 1 = if all [1 ()][1 ]
21
21
--assert 1 = either all [()][1 ][2 ]
22
22
--test-- "any and all"
@@ -25,6 +25,13 @@ Rebol [
25
25
all [true x: 2 ()]
26
26
][ x: 2 * x]
27
27
--assert x = 4
28
+ ;@@ https://github.com/Oldes/Rebol3/discussions/88
29
+ --assert none? any []
30
+ --assert none? any [()]
31
+ --assert 1 = any [() 1 ]
32
+ --assert 1 = all [1 ()]
33
+ --assert #[true] = all []
34
+ --assert #[true] = all [()]
28
35
===end-group===
29
36
30
37
===start-group=== "SWITCH"
You can’t perform that action at this time.
0 commit comments