Skip to content

Commit

Permalink
FIX/CHANGE: allow any value as a part of path!
Browse files Browse the repository at this point in the history
```
>> p: to-path b: [1 #[none] #[true] [] () #{}]
== 1/none/true/[]/()/#{}

```

related to: Oldes/Rebol-issues#477
  • Loading branch information
Oldes committed Apr 3, 2020
1 parent 0ad97ba commit 44b13f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/core/t-block.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@
return (num > 0);
}

#ifdef not_used
static void No_Nones_Or_Logic(REBVAL *arg) {
arg = VAL_BLK_DATA(arg);
for (; NOT_END(arg); arg++) {
if (IS_NONE(arg) || IS_LOGIC(arg)) Trap_Arg(arg);
}
}
#endif

/***********************************************************************
**
Expand Down Expand Up @@ -288,8 +290,10 @@ static void No_Nones_Or_Logic(REBVAL *arg) {
// make block! [1 2 3]
if (ANY_BLOCK(arg)) {
len = VAL_BLK_LEN(arg);
#ifdef not_used
if (len > 0 && type >= REB_PATH && type <= REB_LIT_PATH)
No_Nones_Or_Logic(arg);
#endif
ser = Copy_Values(VAL_BLK_DATA(arg), len);
goto done;
}
Expand Down
11 changes: 8 additions & 3 deletions src/tests/units/series-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,14 @@ Rebol [
--assert (mold to-path [1 2 3]) = "1/2/3"
--assert (mold to-path [1 none 3]) = "1/none/3"
;@@ https://github.com/Oldes/Rebol-issues/issues/477
--assert error? try [to-path [1 #[none] 3]]
--assert error? try [to-path [1 #[true] 3]]
--assert error? try [to-path [1 #[false] 3]]
--assert path? p: try [to-path b: [1 #[none] #[true] [] () #{}]]
--assert integer? p/1
--assert none? p/2
--assert true? p/3
--assert block? p/4
--assert paren? p/5
--assert binary? p/6
--assert b = to-block p

===end-group===

Expand Down

0 comments on commit 44b13f8

Please sign in to comment.