Skip to content

Commit

Permalink
FIX: resolve/all bypassing protect/hide
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Sep 23, 2021
1 parent b60ef7d commit ad28197
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/c-frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@
// Done by marking all source words (in bind table):
words = FRM_WORDS(source)+1;
for (n = 1; NOT_END(words); n++, words++) {
if (IS_NONE(only_words) || binds[VAL_BIND_CANON(words)])
if ((IS_NONE(only_words) || binds[VAL_BIND_CANON(words)]) && !VAL_HIDDEN(words))
binds[VAL_WORD_CANON(words)] = n;
}

Expand Down
1 change: 1 addition & 0 deletions src/include/sys-value.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ enum {
#define VAL_CLR_LINE(v) VAL_CLR_OPT((v), OPTS_LINE)

#define VAL_PROTECTED(v) VAL_GET_OPT((v), OPTS_LOCK)
#define VAL_HIDDEN(v) VAL_GET_OPT((v), OPTS_HIDE)

// Used for datatype-dependent data (e.g. op! stores action!)
#define VAL_GET_EXT(v) ((v)->flags.flags.exts)
Expand Down
7 changes: 7 additions & 0 deletions src/tests/units/protect-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ Rebol [
;@@ https://github.com/Oldes/Rebol-issues/issues/1137
--assert 0 = length? trim make object! [f: 1 protect/hide 'f]
--assert 0 = length? trim make object! [f: none protect/hide 'f]
--test-- "resolve/all hidden"
;@@ https://github.com/Oldes/Rebol-issues/issues/1769
con1: context [a: 1 b: 2 c: "hidden" protect/hide 'c]
con2: context [a: 9 b: 8 c: none]
--assert object? resolve/all con2 con
--assert all [con2/a = 1 con2/b = 2]
--assert none? con2/c ;- not holding "hidden"!

===end-group===

Expand Down

0 comments on commit ad28197

Please sign in to comment.