File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -742,7 +742,7 @@ enum {
742
742
REBVAL * val = D_ARG (1 );
743
743
REBVAL * into = D_REF (5 ) ? D_ARG (6 ) : 0 ;
744
744
745
- if (IS_BLOCK (val )) {
745
+ if (IS_BLOCK (val ) || IS_PAREN ( val ) ) {
746
746
REBSER * ser = VAL_SERIES (val );
747
747
REBCNT index = VAL_INDEX (val );
748
748
@@ -752,6 +752,10 @@ enum {
752
752
Reduce_Only (ser , index , D_ARG (4 ), into );
753
753
else
754
754
Reduce_Block (ser , index , into );
755
+
756
+ if (!into )
757
+ SET_TYPE (DS_TOP , VAL_TYPE (val ));
758
+
755
759
return R_TOS ;
756
760
}
757
761
else if (into != 0 ) {
Original file line number Diff line number Diff line change @@ -288,6 +288,32 @@ Rebol [
288
288
===end-group===
289
289
290
290
291
+ ===start-group=== "REDUCE"
292
+ --test-- "reduce block!"
293
+ --assert [2 6 ] == reduce [1 + 1 3 + 3 ]
294
+ --assert all [
295
+ [x] == reduce /into [1 + 1 3 + 3 ] b: [x]
296
+ b = [2 6 x]
297
+ ]
298
+ --assert all [
299
+ tail? reduce /into ['a 1 + 1 3 + 3 ] p: make path! 3
300
+ p = 'a/2/6
301
+ ]
302
+ --test-- "reduce paren!"
303
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2060
304
+ --assert 2 = reduce (1 + 1 )
305
+ --assert quote (2 6 ) == reduce quote (1 + 1 3 + 3 )
306
+ --assert all [
307
+ [x] == reduce /into quote (1 + 1 3 + 3 ) b: [x]
308
+ b = [2 6 x]
309
+ ]
310
+ --assert all [
311
+ tail? reduce /into quote ('a 1 + 1 3 + 3 ) p: make path! 3
312
+ p = 'a/2/6
313
+ ]
314
+ ===end-group===
315
+
316
+
291
317
===start-group=== "TRIM"
292
318
--test-- "trim string!"
293
319
str1: " a b c "
You can’t perform that action at this time.
0 commit comments