Skip to content

Commit f7e8e8f

Browse files
committed
FIX: PROTECT and UNPROTECT bitset!
fixes: Oldes/Rebol-issues#977
1 parent 7c409fb commit f7e8e8f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/core/n-control.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ enum {
8888
**
8989
***********************************************************************/
9090
{
91-
if (ANY_SERIES(value) || IS_MAP(value))
91+
if (ANY_SERIES(value) || IS_MAP(value) || IS_BITSET(value))
9292
Protect_Series(value, flags);
9393
else if (IS_OBJECT(value) || IS_MODULE(value))
9494
Protect_Object(value, flags);

src/core/t-bitset.c

+4
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@
293293
{
294294
REBCNT n = VAL_INDEX(val);
295295

296+
if(IS_PROTECT_SERIES(bset)) Trap0(RE_PROTECTED);
297+
296298
if (VAL_BYTE_SIZE(val)) {
297299
REBYTE *bp = VAL_BIN(val);
298300
for (; n < VAL_TAIL(val); n++)
@@ -317,6 +319,8 @@
317319
REBCNT n;
318320
REBCNT c;
319321

322+
if(IS_PROTECT_SERIES(bset)) Trap0(RE_PROTECTED);
323+
320324
if (IS_CHAR(val)) {
321325
Set_Bit(bset, VAL_CHAR(val), set);
322326
return TRUE;

src/tests/units/protect-test.r3

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Rebol [
5252
protect out
5353
--assert is-protected-error? [delect dialect inp out]
5454

55+
--test-- "protect bitset"
56+
;@@ https://github.com/Oldes/Rebol-issues/issues/977
57+
ws: protect charset "^- "
58+
--assert is-protected-error? [clear ws ]
59+
--assert is-protected-error? [ws/1: true]
60+
5561
===end-group===
5662

5763
~~~end-file~~~

0 commit comments

Comments
 (0)