File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,13 @@ static void No_Nones_Or_Logic(REBVAL *arg) {
353
353
goto done ;
354
354
}
355
355
356
+ // use `make block! pair!` for block preallocation
357
+ if (IS_PAIR (arg )) {
358
+ len = (REBCNT )MAX (1 , VAL_PAIR_X_INT (arg )) * (REBCNT )MAX (1 , VAL_PAIR_Y_INT (arg ));
359
+ Set_Series (type , value , Make_Block (len ));
360
+ return ;
361
+ }
362
+
356
363
// else not supported make block! ...
357
364
Trap_Arg (arg );
358
365
Original file line number Diff line number Diff line change @@ -227,7 +227,9 @@ Rebol [
227
227
--assert error? try [make block! quote 4 % ] ; percent!
228
228
--assert error? try [make block! quote $4 ] ; money!
229
229
--assert error? try [make block! quote #"a" ] ; char!
230
- --assert error? try [make block! quote 2x2 ] ; pair!
230
+ --assert [] = try [make block! quote 2x2 ] ; pair! - preallocated for at least 4 values
231
+ --assert [] = try [make block! quote 0x2.2 ] ; pair! - preallocated for at least 2 values (1*2)
232
+ --assert [] = try [make block! quote 2x-2 ] ; pair! - preallocated for at least 2 values (2*1)
231
233
--assert error? try [make block! quote 1.1.1 ] ; tuple!
232
234
--assert error? try [make block! quote 10:00 ] ; time!
233
235
--assert error? try [make block! quote 2000 -01 -01 ] ; date!
You can’t perform that action at this time.
0 commit comments